11

FP > OOP
I wish the enterprise world starts learning this!

Comments
  • 4
    ding ding ding ! just hit 100 ++ ... thanks boys. I'm in the big leagues now :)
  • 3
    Can you concisely explain the benefits?
  • 1
    Or get a lang that will do both like Scala.
  • 0
  • 4
    @chrizzle absolutely :
    1. no state => simple code
    2. no mutation => less bugs
    3. code easy to reason about
    4. easy to test
    5. very powerful but simple patterns
    6. composition

    The list goes on. Not saying that OOP is bad though a lot of it is made redundant and improved by functional programming. I think OOP should be used minimally to model your domain, but your business rules should follow functional paradigm.
  • 1
    @mostlyharmless also the referential transparency property of fp makes it more suitable for parallel programming
  • 1
    meh. Function with 3 arguments is actually "a function that takes one argument and returns another function that takes one argument that then returns a function that takes an argument that then..."
    And then you realize that you can actually use functions (that take 3 arguments) as arguments for other functions (that also take 3 arguments) and I've already left for the day. Nah.
  • 0
    @mostlyharmless I feel the opposite about #3. I feel like I can reason through OOP code easier.
  • 0
    FP is OOP with SOLID taken to the extreme.

    OOP decision making is not clear enough and has many pitfalls. With FP, it may be tough to get started but once you do grasp it you're doing it right most of the time. FP is really the necessity for parallel computing.
  • 0
    @Lisanna agreed. they aren't. but that doesn't mean they can't be compared!
Add Comment