4 ms·
You do not need to start with functional programming, because if you're good, the probability is high you already do it (at least the Java devs I know do it).
by Uchikoma 15y ago
You do not need to start with functional programming, because if you're good, the probability is high you already do it (at least the Java devs I know do it).
This means immutable data structures, writing for composability, side effect free methods, list processing with "closures" instead of for loops etc.
- olliesaunders 15y agoThe majority of the population of the world doesn’t know how to do functional programming, so there’s a pretty big audience for whom this article is applicable.
- eru 15y agoSpreadsheets are a limited form of functional programming.
- nandemo 15y agoI'm very skeptical that "good Java devs" tend to use FP techniques. Idiomatic Java is object-oriented, and OO is inherently stateful: side-effects are everywhere and are totally acceptable. Also, it tends to use iteration rather than recursion, doesn't use higher-order functions, classes and methods are designed for "inheritability" rather than composability. However, I'd love to be proved wrong. Care to show any open-source Java code that uses FP techniques?
- Uchikoma 15y agoI think you mix things. FP has nothing to do with stateless. Languages all have nothing to do with statelessness or statefulness, this is an application architecture term. Objects have state, as have immutable data structures. "doesn't use higher-order functions," But they use higher-order objects. "classes and methods are designed for "inheritability" No, at least for 10 years it has been debunked in Java that inheritance is a good thing. Inheritance outside of some small domains like GUI libraries is a bad thing as inheritance is too rigid. Most bad Java developers use inheritance because they've been teached OO in a completly wrong way with dogs and cats or cars and trucks. I think the common understanding for years in Java/C# etc. is that composition is much better than inheritance. This article from 1998 describes the problem of inheritance vs. composition in java http://www.artima.com/designtechniques/compoinhP.html http://www.artima.com/designtechniques/compoinhP.html "Care to show any open-source Java code that uses FP techniques?" No, because to be frank, I have not much knowledge about Java open source. And the projects I've looked into (Apache comes to mind) have sub-industry quality or are outright awful. Not sure why this is the case though.