Why Functional Programming ?

If you think you will be writing Functional Code by the time you reach the end of this document, well, my friend you need a much longer document and be banished to dungeons with it from where the only way back is if you climb back on one leg. Purpose of this article is to babble on benefits of Functional Programming and motivate you in going through the steep learning process.

Getting to the business right away, here is a list of superpowers your code gets once you practice Functional Programming:

  1. Readable
  2. Declarative
  3. Multiple abstract layers(Dig only if you want)
  4. Can be reasoned about
  5. Testable

Arguably, 2,3,4 can be declared as part of code readability on an abstract level. So to me, the most important gain of FP(Functional Programming) is code readability. So, part of our answer lies in “Why Code Readability”?

If you are a Programmer, chances are you have already worked in a team. If you hooked on to an existing project, you should remember your struggle to get productive in the project? That struggle is inversely proportional to code readability of that project. I would say, it is a big win for any project and team if new programmers can easily adjust and get productive in the code base.

I like to endorse the view that primary audience of code written today is fellow team members or people who read your code not machines. Code written today usually costs a lot more in terms of Programmer Salaries(People reading and working with your code) than the machines running it. Machines are cheap today.



functional programming in .Net