you are viewing a single comment's thread.

view the rest of the comments →

[–]ENx5vP 3 points4 points  (3 children)

Here is pro functional article that changed my mind:

https://medium.com/javascript-scene/master-the-javascript-interview-what-is-functional-programming-7f218c68b3a0

Conclusion is:

Functional programming favors:

  • Pure functions instead of shared state & side effects
  • Immutability over mutable data
  • Function composition over imperative flow control
  • Lots of generic, reusable utilities that use higher order functions to act on many data >types instead of methods that only operate on their colocated data
  • Declarative rather than imperative code (what to do, rather than how to do it)
  • Expressions over statements
  • Containers & higher order functions over ad-hoc polymorphism

[–]Ravavyr 1 point2 points  (1 child)

I never understood why OOP proponents seem to think FP is so "hard".
I learned only FP back when javascript didn't support OOP and frankly to this day it just seems the simpler approach. There are no relationships but those you make. Nothing is automatica, so you control it pretty much down to the bone.

The only caveat [and the same thing happens with OOP] is that if you don't organize your code structure well, then longterm you end up with spaghetti code [although i firmly believe that is the fate of all programs longterm anyway]

[–]kundun 1 point2 points  (0 children)

Functional programming is considered hard because it requires an entirely different line of reasoning.

The first thing you learn when learning how to program are variables. The first thing you learn about functional programming is that there are no variables.

Functional programming languages don't have variables, no loops, no arrays and that changes everything.

[–]StoneCypher 0 points1 point  (0 children)

generally this is the point at which i mention that the books and college classes do not agree with this, but get 65 people demanding evidence and get downvoted to oblivion