Stop Writing Classes
Next Day Video8 HN recommenders · recommended in 8 months, 2012–2025
talk · intermediate · evergreen · 2012–2025 on HN
Jack Diederich's PyCon 2012 talk argues that classes are overused in Python and walks through real code, refactoring away unnecessary classes, exceptions and modules. It popularized the heuristic that a class with two methods, one being __init__, should be a…
HN returns to it repeatedly as the canonical argument for simplicity and against premature abstraction, and several commenters say it changed how they write code.
Up next
5 mo on HNSpecial Topics - The Kalman Filter (1 of 55) What is a Kalman Filter?
Michel van Biezen
5 HN recommender · 2017–2025
3 mo on HNLower Latency Graph Queries in Cypher with Redis GraphRoi Lipman, Redis LabsTim Davis, Texas A&M U
Redis
3 HN recommender · 2018–2023
5 mo on HNNoether's Theorem and The Symmetries of Reality
PBS Space Time
5 HN recommender · 2018–2026
5 mo on HNYour dishwasher is better than you think (tips, tricks, and how they work)
Technology Connections
6 HN recommender · 2024–2026
3 mo on HNRenting vs. Buying a Home: What People Get Wrong
Ben Felix
3 HN recommender · 2025–2026
8 mo on HNI messed up. You're using too much detergent.
Technology Connections
10 HN recommender · 2021–2025
12 mo on HNDetergent packs are kinda wishy-washy (Dishwashers Explained)
Technology Connections
15 HN recommender · 2021–2025
3 mo on HNJordan Peterson - Controversial Facts about IQ
Bite-sized Philosophy
3 HN recommender · 2017–2025
18 mo on HNRuby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich
Confreaks
17 HN recommender · 2013–2026
16 mo on HNThe spelled-out intro to neural networks and backpropagation: building micrograd
Andrej Karpathy
17 HN recommender · 2022–2025
16 mo on HNHow Python was Shaped by leaky Internals, Armin Ronacher, Flask framework
Видео с мероприятий {speach!
15 HN recommender · 2017–2025
15 mo on HNRailsConf 2014 - All the Little Things by Sandi Metz
Confreaks
15 HN recommender · 2015–2025
12 comments from Hacker News
I also tend to avoid writing many classes (in Python). Jack Diederich has a great video called Stop Writing Classes: ▶ this video It's about Python, but the observation can apply to several languages. Pithy quote: "I hate code and I want as little of it as possible in our product."
Stop writing classes is one of my favorites. Also many pycon talks are great, or any talks by Brandon Rhodes. ▶ this video
Stop writing classes - Jack Diederich - ▶ this video Show them this. I'm still grateful for the moment I grew dissatisfied with OOP, or at least OOP in the Java/C# way. I was almost getting to an intermediate level in python (by myself) and had been thinking about a video game architecture problem I just couldn't solve. I was still "indoctrinated" in the gang-of-four patterns and inheritance. When I discovered the solution, Entity Component Architectures[1], I also discovered the "composition over inheritance" philosophy. My mind was blown! Coupled with some Python's characteristics (duck-typing, everything is public, first-class functions) I was having a blast. Then I saw the video above, and all fell into place. Class based OOP have specific uses, but It's a shame how heavily enforced the paradigm is. “Sometimes, the elegant implementation is just a function. Not a method. Not a class. Not a framework. Just a function.” – John Carmack Now, for scripts or not-to-big programs in Python, I mainly use NamedTuples for passing data around and (mostly) pure functions. P.S. Another funny thing: At my job I use J2EE aka "lots of hinheritance and classes and boilerplate". Sometimes I just have to go home and write some code in python or lua to "cleanse my palate". It helps me get motivated for my personal projects. [1] link
I think you're thinking of Jack Diederich's talk "Stop Writing Classes". You can (and should!) watch it online here: ▶ this video
Yes, the standard library has a lot of questionable design (some inspired by Java, some by C), and many programmers overuse classes. I'm a fan of (former core dev) Jack Diederich's talk, ▶ this video .
Reminds me of this talk, "Stop Writing Classes": ▶ this video Changed my perspective on this newfound tool I'd learned to use called "indirection". My favorite quote is something like "don't waste 10 minutes now to save yourself 2 minutes later".
I read this book: link While doing these labs: link Also a colleague made me watch this from Jack Diederich: ▶ this video
Hickey gives great talks, but I also really liked Jack Diederich's talk "stop writing classes" at PyCon 2012 ▶ this video
Type hints encourage this sort of object-oriented design though, in my experience. The resulting code is extremely verbose compared to Pythonic "executable pseudocode". For example, see Jack Diederich's talk "Stop Writing Classes": ▶ this video
I strongly disagree. You should always keep the code as simple as possible and only add abstractions once you really need them. Too many times I've found huge applications that it turns out be most scaffolding and fancy abstractions without any business logic. My biggest achievement is to delete code. 1. I've successfully removed 97% of all code while adding new features. 2. I replaced 500 lines with 17 lines (suddently you could fit it on a screen and understand what it did) Also: ▶ this video
Its onlt recently that classes are embraced by python community. Before that dictionaries where seen as pythonic and classes where not. ▶ this video
"Lots of times people think they might need something later. You don't. Or you can just do it later if it comes up." ▶ this video For glue code scripts like this you usually don't end up using encapsulation and inheritance or any other fancy OOP design patterns. It's usually grungy IO-bound procedural code, the sort of thing you'd write in bash if bash weren't terrible for long scripts. Don't burden it with premature abstractions. If you end up needing a class, just write the class later.