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.


Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store