5 ms·
I have to say that I have yet to see significance practical problems that functional programming solves better than procedural or OOP. I've had debates over thi
by tabtab 8y ago
I have to say that I have yet to see significance practical problems that functional programming solves better than procedural or OOP. I've had debates over this many times, and almost every example is a case of a bad framework and/or a bad language (such as Java's "stiff" OOP model). FP is a language band-aid, not a solution. There may be a few edge cases, but why complicate the 99% for the 1%? I'd be happy to debate more scenarios. Bring it on!
- erpellan 8y agoFP is not new. OO is not new. They are tools in the toolkit. Take an object with a bunch of instance methods. They are all equivalent to functions with a hidden first parameter. If you make 'this' explicit you've got pure functions. It's not magic. Intellij even has an automated refactoring for it in kotlin. You can take a function and convert it to an extension method and back again: fun String.foo(a: Int) vs fun foo(self: String, a: Int) The real fun of FP is building simple functions that operate on a single value and then stringing them together, generalising to lists of values, filtering etc. MapReduce is functional programming. At epic scale. It's name is literally a portmanteau of two of the most fundamental higher order functions. FP rocks.
- dragonwriter 8y ago> Take an object with a bunch of instance methods. They are all equivalent to functions with a hidden first parameter. If you make 'this' explicit you've got pure functions. Well, you’ve got normal imperative procedures that maybe return a value. Pure functions mean something else.
- tabtab 8y agoThe domain and use-case is not clear to me here. I want to know what real-world task is to be performed, not how to convert one language to another language.