Functional programming

I stumbled across a really good book Functional Programming in Javascript by Dan Mantyla on functional programming based on javascript. This goes hand in hand with my study and analysis of angularJS. And in general, functional programming can only be done in certain languages. Ruby happens to be one of them as well as javascript which doubles the relevance for me.

Concepts of interest

  • What makes a language functional?

"Functional programming languages are languages that facilitate the functional programming paradigm. At the risk of oversimplifying, we could say that, if a language includes the features required for functional programming, then it is a functional language.." ( Dan Mantyla Functional Programming in Javascript.)

The following definition overview is taken from the book Functional Programming in Javascript by Dan Mantyla. Follow the link to purchase.

Characteristic Imperative
Programming Style Perform step-by-step tasks and manage changes in state Define what the problem is and what data transformations are needed to achieve the solution
State Changes Important Non-existent
Order of Execution Important Not as important
Primary Flow Control Loops, conditionals, and function calls Function calls and recursion
Primary Manipulation Unit Structures and class objects Functions as first-class objects and data sets

  • What are some advantages of functional programming
    • Cleaner code (this pretty much covers the next three right?)
    • Modularity
    • Reuse(of the modules)
    • Reduced coupling (modifying one function will not affect another)