Jorge Castro
2 min readJul 12, 2019

It is the reason why we don’t let millennials take control over the project, they don’t get it and they took bad decisions over and over again. Maybe we will skip this entire generation. I wonder if millennials are good at serving coffee? (joke).

Functional programming is horrible, IS BAD, IT DIED 3 DECADES AGO. And now it was revived and duct-taped in JavaScript.

OOP is aimed at the reusability, maintainability, scalability, SRP, KISS and other concepts.

Functional programming is the opposite, it breaks SRP, it disallows reusability (each function is written for to be utilized once).

What is the problem with functional programming?

Let’s say the next example copied from the net

// non-functional smelly loop
redFruits = [];
for ( f in fruits ) {
if ( 'red' === fruits[f].color ) redFruits.push(fruits[f]);
}

versus

// fantastic functional alternative
greenFruits = fruits.filter(function(f) {
return 'green' === f.color;
});

Both works, while functional is short. Functional for some odd reasons prefer short-code (over clarity). Good riddance if you want to debug it.

And now, let’s say the next example:

// functional
applePrice = fruits[Object.keys(fruits).filter(function(f) {
return 'apple' === fruits[f].name;
})[0]].price;

In this later example, if find a fruit called apple and returns the first element, then returns the price of it. This later example IS SO AWFUL. For example, it’s hard to understand what is going on (because it’s doing so many logic at the same time, loop, logic,etc.) and it’s hard to debug. And what if the fruit does not exist?. It will crash.

Instead non-functional will work:

for ( f in fruits ) {
if ( 'apple' === fruits[f].name ) {
applePrice = fruits[f].price;
break;
}
}

and it’s easy to understand.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app