Seriously, OOP sux!
This is my first article in my "murdering your assumptions" series, where I will walk through one of your assumptions at the time, and murder it!
Join the DZone community and get the full member experience.Join For Free
I have decided I will commit several murders. My first victim will be OOP, or to be specific; Your assumptions about OOP. However, don't believe me, let's ask people smarter than me, right? Some wise guy once said "You want the banana, you get the gorilla, holding a banana, in the rainforest". I can't remember who it was, but he was talking about reuse in regards to OOP. I've got 20+ years of professional experience in OO, I think I'm still quoted in regards to virtual copy constructors in a couple of the C++ drafts, and I've got almost 3 digits numbers of emails back and forth with Bjarne Stroustrup in regards to the std - Hence, I (should) know what I'm talking about, and believe me, OOP seriously sux! If you're a noob programmer, trying to grasp polymorphism, constructors, inheritance, SOLID and encapsulation - Don't worry, it's not you - It's OOP!
But don't believe me, let's go ask 1.000 random software developers who's the best software developer on this planet. 999 of those will probably answer Thorvalds Linus. So let's ask Thorvalds what he thinks about OOP. He should know, right ...?
Well, there are no reasons to ask Thorvalds. In fact, it would be rude to ask Thorvalds, because the last time somebody asked him about why he's not using C++ in Linux, but relies exclusively upon C, he became so angry, that he had a nervous breakdown, and had to take a 12 month long vacation from maintaining the kernel due to suffering an anger burst, so large, he became a liability and danger to his surroundings and environment. Which kind of reminds me of Erik Naggum's Perl rant, where I may add, he also explicitly says that life is too short to learn C++.
The unexperienced programmer had a problem, so he said "I'll just use OOP". The unexperienced programmer now had TWO problems ...
However, let's explain it with code. Imagine creating an HTTP REST endpoint using an OO language, such as for instance C#. OK, here's the basic code to simply add n numbers together.
I'm not even sure if the above compiles, however - SERIOUSLY - 21 lines of code, giving most noobs an epileptic seizure, due to cognitive overload, requiring them to learn entire frameworks, to simply add two freakin' numbers ...?
Let's look at a more LISP'ish example, Naggum's favourite language - Or to be explicit, the Hyperlambda equivalent.
One line of code, and you'd have to be pretty dumb to not understand its nature. But the inexperienced programmer might now ask; "Where's the function? What's the name of the function?" - Well, if you save the above as a file on your disc, as follows "acme/add.get.hl", it has the URL of "acme/add", it resolves as an HTTP GET verb, and the hl extension makes the Hyperlambda parser kick in, and transpile it to CLR invocations. And since all Hyperlambda files by the very definition of Hyperlambda are, duh functions - Well, you get the point ...
If you're a noob programmer, and you struggle with OOP - Don't worry, it's OOP, it's not you. OOP sux! And the primary proof of that, is that OOP's basic ruleset, arguably being SOLID, makes OOP itself obsolete. Don't understand why? Realise LSP implies you can never use inheritance for all practical concerns, simply because there doesn't even exist a single type on this planet that has a perfect "is a relationship" to any other types. Something zoology's debunking of Lindbergh as of lately arguably have proven decades ago. Hence, OOP is obsolete!
Opinions expressed by DZone contributors are their own.