
Stop Writing Classes
About this video
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 function.
Why it appears in the archive
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.
AI-generated summary and labels from the source dataset; verify important details against the video. Source & credits.
From the Hacker News discussion
I think you're thinking of Jack Diederich's talk "Stop Writing Classes". You can (and should!) watch it online here: [VIDEO]
Read original comment ↗Stop writing classes - Jack Diederich - [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]
Read original comment ↗Stop writing classes is one of my favorites. Also many pycon talks are great, or any talks by Brandon Rhodes. [VIDEO]
Read original comment ↗I also tend to avoid writing many classes (in Python). Jack Diederich has a great video called Stop Writing Classes: [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."
Read original comment ↗Hickey gives great talks, but I also really liked Jack Diederich's talk "stop writing classes" at PyCon 2012 [VIDEO]
Read original comment ↗I read this book: [LINK] While doing these labs: [LINK] Also a colleague made me watch this from Jack Diederich: [VIDEO]
Read original comment ↗Reminds me of this talk, "Stop Writing Classes": [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".
Read original comment ↗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, [VIDEO] .
Read original comment ↗