Showing posts from August, 2018

Who is afraid of immutable data?

Anand Kumar Keshavan  Founder/Partner Swanspeed Consulting

Lately, my LinkedIn feed has been getting posts about events on functional programming with special emphasis on how to deal with immutable data .

True, many programmers are puzzled when told that from now onwards you shall not modify the value of a variable once it has been initialised. "But how can I work with  loops? Doesn't incrementing a counter need the value of a counter to be changed?"  This is just the result of doing something  over and over again and can be overcome by learning some programming techniques such as recursion  and map/reduce over collections.  The larger problem, however, lies with the questions of the following nature: "What about real world things like account balances ? How do I change  the account balance of I am not allowed to change the value?".  ( To be fair to programmers who are new to the functional world , such questions have been raised by some eminent thought leaders…