I don't have a good track record with predicting the popularity of end user technologies. I thought Google Wave would take over all other methods of communication. I later expected Google Glass to become popular and push the development of augmented reality products to a new level. Neither of those worked out, as we now know.
All of these languages/frameworks turned out to have enduring popularity and have served me well. However, I'm always looking for the next level of productivity and expressiveness, and I have become somewhat dissatisfied with what I can get now.
I noticed that functional programming is becoming more popular across different languages and domains. So this is what I decided to explore next. I hope that my intuition is correct again, and that FP will become truly mainstream rather than being just another fad.
Here are some interesting discussions about functional programming:
Why functional programming?
So why functional programming and not something else? Here are my main reasons:
- It offers a different perspective on programming; as I started writing my first programs in Haskell, I was often stumped, which hasn't happened for a while; I take it as an encouraging sign that I'm learning something truly new to me rather than just another variation of the familiar themes.
- It's easier to parallelise functional programs, and I believe that parallel execution is really an inevitable requirement (see http://www.gotw.ca/publications/concurrency-ddj.htm for a decade old discussion of this).
- Performance of the same order of magnitude as C++ - typically a lot faster than dynamically typed languages, but hopefully with the same level of terseness and expressiveness.
- Built on a small set of composable concepts (functions and data types).
- An almost implicit focus on higher order abstractions (FP seems to invite the creation of higher order functions).
- Rising popularity of FP - there's got to be a reason why all kinds of languages are acquiring FP features (C++, C#, Java), new languages have them baked in from the start (Swift, Rust), and languages like Scala, F#, Clojure and Haskell are becoming more visible.
I've been keeping an eye on different FP languages (mainly Haskell, Scala, OCaml, F#, Clojure and Erlang) and Haskell seems to be the most intriguing so far.
These are the main reasons why Haskell seems to have the edge over other languages in my estimation:
- It has been around for 25 years
- Compact core language
- Takes purity very seriously
- Advanced type system with sophisticated type inference
- Lazy evaluation
- Very concise syntax
- Currying is a core concept in the language
- The ecosystem is maturing, e.g. package management now looks to be on par with Ruby and Python
- Tantalising connections to mathematics (e.g. category theory).
As of now, I don't know if it's worth learning Haskell as a practical language though. There are some products implemented in Haskell, but I think there is a danger that people are attracted to it as a way of solving very difficult puzzles rather than because it provides significant productivity or quality gains. I've seen it happen a lot in the C++ world (particularly with C++ template metaprogramming).
I primarily develop web applications, but at this point, Haskell doesn't seem particularly viable for client side code in web applications.
I'm interested to see to what extent functional programming can be applied in these languages.