2 ms·
As someone who only does functional programming I do not think their power lies in their erm functionality. I have a hypothesis. I think the key lies in how ea
by Dn_Ab 15y ago
As someone who only does functional programming I do not think their power lies in their erm functionality. I have a hypothesis.
I think the key lies in how easy is it to look at your code and trigger the pathways in your brain associated with elegance. No offence to Java, it gets the job done but due to boilerplate, the likelihood of your code resulting in such triggers is much less than say clojure or scala. Consider the popularity of CofeeScript, node.js, python, ruby. These are not idiomatically functional languages but due to reduced boilerplate they too also make it easier for your code to be appreciated on an aesthetic level. What is the gain in this?
I have a belief that an appreciation for elegance is the natural outcome in a universe with a principle of least action. Prefer the explanation which takes less energy to unfold. So anways what happens is that your brain rewards you for writing code that tries to be elegant and turns aesthetic knobs. Pushing you for more and more of a hit. And you start to become more motivated to write code that rewards you thusly and a side-effect being programming is more enjoyable and you are more likely or encouraged to write code that is appreciable. Since code is meant for humans, as a start, optimizing in this way is ideal. Train yourself to appreciate algorithmic and mathematical elegance and you reap the rewards there too.
- Meai 15y agoI don't know functional programming but I agree with your sentiment. I even think this is the reason why languages like C++ and Java are abused so much. Over the years of use, people start learning little tricks and hacks, and they want to deploy those. They find them elegant, while everyone else who has to read them...actually thinks they are horribly overcomplicated. C++ template programming is awful, but some people love it because they love how elegant their code can become. They love that they can immerse themselves in the language features. Unfortunately this provides a net detriment to the code you are writing. No matter how good your code is, someone will have to read it again, even if it's just you. Code should be simple. I believe code should be difficult to write bad. In the common languages though it's very easy to write undecipherable code. In Javascript for example, it's hard to write code that needs more than a few moments to understand. It's even hard to write "class" hierarchies!