HackerTube

Stop Writing Classes

Next Day Video8 HN recommenders · recommended in 8 months, 2012–2025
YouTube
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.

12 comments from Hacker News

@michelpp2020-03 · in “I Don't Use Classes”

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."

Strongly recommends View on HN
@kyleperik2018-04 · in “Ask HN: What is your favourite tech talk?”

Stop writing classes is one of my favorites. Also many pycon talks are great, or any talks by Brandon Rhodes. ▶ this video

Strongly recommends View on HN
@Vaskivo2014-12 · in “Ask HN: What do you think about using classes in Python?”

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

Strongly recommends View on HN
@inglesp2012-10 · in “An Object is not a Hash”

I think you're thinking of Jack Diederich's talk "Stop Writing Classes". You can (and should!) watch it online here: ▶ this video

Strongly recommends View on HN
@zahlman2025-10 · in “Why Is Python So Popular in 2025?”

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 .

Recommends View on HN