Unlearning OOP considered harmful

After reading “The faster you unlearn OOP, the better for you and your software” by Dawid Ciężarkiewicz, I though “Hey, this guy has a point”.

I totally agree on the diagnostic. It is true a lot of people tend to create classes and objects for every single thing they manipulate in their code. But then I felt the conclusion is a little extreme.

First of all, there is no such thing as unlearning. We cannot unlearn what we learnt, unless we use brain surgery or brain washing (which are two very controversial pedagogic technics).

What we can do is improve what we learnt, we can learn new concepts, new approaches, and we must use this new knowledge to question what we learnt at start.

I started programming with BASIC as a child, then as a student I used C, Lisp and Ada. In my career, I used a lot of different languages, but the one I used the most is Python and more recently TypeScript.

So I guess I was very lucky, as I had the opportunity to discover and (I hope) understand different programming styles (imperative, functional and object oriented), and I have never been exposed too long to any radical one-and-only-truth language standing for one of those programming styles (like Java is for OOP).

At this point of my journey in software development, I can say I really love OOP. OOP helps me to understand a lot of great things about programming, it helps me to solve complex problems with simple and elegant solutions.

The OOP approach is not “an exceptionally bad idea”, it is probably a good idea which got trapped into a dangerous megalomaniac syndrome: too many people think they can use OOP modeling to model the world.

That’s wrong.

It must be used to model software (remember, that’s just a software programming approach).

When I create a software, I think it makes a lot of sense that such UI component is an object, or such service or controller is an object, it is super useful and enlightening. But does it make sense we create an object to represent a customer or a purchase order, hmm… not that much. Why?

Because my software does not contain customers, it contains UI components, services, controllers, etc. That’s what it is about. Customers are from the outer world, they are not part of the software, as far as I am concerned, customers are just data.

I guess that’s what Dawid Ciężarkiewicz says in his article, when he says “data is definitely more important than code”.

Object should be used to address elements which are actually doing things in the software, the living parts of the software.

And here I have to confess something: since few years, I got this (weird) feeling that objects in my code are living beings, like small animals. In some extent, it is like they have some instinctive abilities and an autonomous behavior, and my job is to shepherd them so they go in the proper direction. That’s a fantastic feeling!

At the contrary, when I see a dumb object like the customer or the purchase order I was talking about, well I immediately feel like it is totally not a living being, that’s just a bunch of dead data injected in a body trying to fake life. Basically just a Frankeinstein monster, or a zombie.

I don’t like zombie and I certainly don’t want them to mess up with my small lovely animals.

So yes, OOP goes the wrong way in many cases. But maybe its biggest crime is just its bad naming. “Object” is certainly the wrong name here, because it does not clearly indicate objects are those small living beings. Maybe “subject” would have been a better name (I like the name “pokemon” too, it would make sense I think… Oh and “OOP” would be “POP” then! Isn’t it a much cooler name??!!).