Andrei Dascalu
1 min readAug 7, 2020

--

Sorry, but your definition of Functional Programming as well as that of OOP are dead wrong, even in simple terms.

There's no such thing as "immutable variables". Immutability is not a quality of a variable, otherwise it wouldn't be called a variable anymore. Immutability is simply a practice decision, but it has nothing to do with functional programming. Also, in OOP itself, there's widespread adoption of immutability as a practice, mainly due to DDD.

Functional Programming: functions go back to the mathematical definition - aka: a function is something that takes and input and provides an output without making changes outside its scope. I can define variables and I can change them, if I so wish, but these changes don't survive outside the scope of the function. It's not about killing side effects, it's about segregating side-effects (there will always be side effects like writing to a DB or calling an API).

Also for OOP, you're not primarily modifying (or adding variables, what's that even mean? adding variables? if I'm defining a variable, it's added to my program, it uses memory, etc - it's not a goal but a means regardless of programming style). You're changing objects that by definition exist outside the immediate scope of the code you're calling.

--

--