OOP vs FP

github logo 惻1 min read

Today I opened Medium and found this article in "Your Daily Read". I read it and, well, I got angry that Medium recommended it to me. I found it completely unreasoned. I thought this post is one of "if you want hype, just write any article about popular theme". That's why I wrote this comment. Later author banned me :)

I wanted discussion. Please explain me where I am wrong and why it is not possible to write good OOP code.

twitter logo DISCUSS (9)
markdown guide
 

I pulled this from the medium article:

I will also admit that Iā€™m angry. Very angry.

Discussing technical matters from an emotional standpoint rarely leads to a productive discussion.

The article is clickbait designed to trigger the pro-OOP reader and reinforce the anti-OOP reader's confirmation bais'. Sadly, this type of content is the most popular type of writing on the internet.

If you would like a far more boring yet trigger-free piece of content on the topic, you can read my Quora answer to "Is there currently a backlash against object-oriented programming in the software development industry?". I was unemotional when I wrote my answer, and it was not my goal to trigger anyone else.

As for the author of the piece, they shouldn't be angry that they don't know how to code effectively in a particular paradigm. It's ok to be a novice, as that's where we start when we are learning something new. That said, a modern developer should be flexible enough to switch between multiple paradigms depending on the nature of the problem their solving.

The world is only black-and-white to novices who are trying to make sense of a vast sea of overwhelming information. Over time, your brain adapts such that it is able to exist in grey areas where there are no clear right-or-wrong answers, also known as reality.

 

Thank you. I'm not really active on the web (as it said, I'm mostly in read-only mode), so when I got banned, first thing came to my mind was "What I did wrong?". Your comment does sounds cold-minded, I will read your Quora answer

 

Getting banned means, "I don't care what you have to say and don't want to hear you say it anymore." Fair enough - people have that right. I end up questioning myself as to why I even bothered to engage in the first place.

I've been banned, blocked, cursed at, and accused of being all manner of unpleasant things online. It's the internet - if you let it upset you, you'll go nuts.

 

I also got angry, so... I have to admit: I deserved it)

 

You got triggered by someone trying to trigger you. Happens a million times a minute all around the globe. I found a video that helped me better understand the phenomenon that's worth a watch.

 

Nowadays I do and prefer (simplified) functional programming. But in my estimation it is certainly well possible to write good OOP code. Big picture, the tools used play only a tiny role in the success of any product, so use whatever your team enjoys. (The business factors are the reason a product lives or dies.)

 

I read author is "Full stack programmer....", which tells me it is one man army kind of developer, FP is great for one man army kind, but if you want to build a large project with many teams and many developers, you are forced to document, make patterns in FP, and finally bring (OOPS) into FP.

Code is always functional, organization of code is object oriented !!

 

The ideology behind OOP is to create a code that must be reusable and clear. So, it is possible to create a huge project on OOP without messing with the code. OOP is 100% aimed to create a code that it's easy to maintenance.

Instead, FP is focused to create short code. OOP code tends to be verbose in comparison with FP but it sacrifices the clarity of the code.

 

The whole thing is wrong on both sides,
is possible to have OOP and FP if the programming language supports it,
if the most hipster langs dont support it, that wont change the fact that is doable.

Classic DEV Post from Apr 25

Form habits by making the right thing easiest

Tools should always work for you, not against you! Invest some time making sure you configure them to adapt to shifting conditions.

Andrew Andersen profile image
Student, love Python and Rust