Member-only story
OOP isn’t always the answer.
Why I Stopped Using Classes in Python (And What I Use Instead)
After years of writing class-based Python code, I realized simpler tools often get the job done better. Here’s what I switched to — and why you might want to as well.
There was a day when I enclosed everything in classes.
It seemed the “professional” thing to do. I mean, object-oriented programming (OOP) was the be all and end all, wasn’t it?
But after having developed APIs, automation scripts, and data pipelines for real-world products, I came up with a conclusion: I didn’t need classes as much as I thought.
In fact, classes in the majority of projects were inhibitive.
Show me.
The Class Obsession (And Where It Came From)
We all learned classes are the secret to clean, scalable code.
You’re taught about init, about inheritance, about encapsulation — and before you know it, you’re building complex class hierarchies for every little task.
I did likewise. My code was full of boilerplate like: