5 ms·
Just staying in your language is a very bad idea. The problem is that if your language and your librarys don't support FP very well you will have a very hard ti
by nickik 15y ago
Just staying in your language is a very bad idea. The problem is that if your language and your librarys don't support FP very well you will have a very hard time. Even somebody that knows FP very well will have problems applying FP in a Java setting. Its surly possible but you will have a hard time.
Its better to start with a language that helps you do the right thing. Additionally if you do FP in Java or C++ you will not get all the benefits and after you tried it conclude that FP is not worth it.
Start with Haskell, ML, Clojure or something like that.
- Uchikoma 15y agoTo the contrary. From my experience adding FP to Java is something natural, good devs do this on their own without wanting to write FP code. Side effect free methods, immutable objects, immutable data structure etc. all add to better code in large code bases. That's why good devs use Google Guava or LambdaJ instead of for loops for example.
- stephth 15y agoDo you use any naming convention to differentiate between pure and non-pure functions?
- Uchikoma 15y agoNo. I wish there was an IO monad (an exception monad) in Java. Or at least a common understanding in compilers and IDEs about a @Pure annotation.
- nickik 15y agoThat could be right i don't know and I haven't heard of Google Guava or LambdaJ. I know that Uncle Bob for example say that methodes with no arguments are best and that the opposit of what FP is all about (there are other examples like this). So, are you arguing that good java devs don't follow the standart java comunity idioms? Sure there are some devs that to that but to say FP is natural to any good Java dev is a bit of a stratch.
- gaius 15y agoCan you link me to the Uncle Bob article?
- nickik 15y agoI think it was this video but im not 100% sure. http://www.viddler.com/explore/oredev/videos/15/ http://www.viddler.com/explore/oredev/videos/15/
- Uchikoma 15y agoNever heard of that "no arguments are best" java community idiom in the last 15 years, so can't comment on that.
- olliesaunders 15y ago> Start with Haskell, ML, Clojure or something like that. Just make it Haskell. If you want to learn FP, you cannot do better than Haskell. Of course if you want to write apps tomorrow Clojure is a pretty good choice.
- nickik 15y agoI agree that Clojure is not the best to start but if you take ML (OCaml) or Haskell does not really matter. Haskell has intressting typeclasses but that it is lazy is something that you might not want to learn (if you just want to learn the value of FP).
- eru 15y agoClean might also be worth a look. But it guess for a beginner the slight differences do not really matter that much. I recommend Haskell over OCaml for learning. Haskell has a cleaner syntax, a living community, and emphasises purity.