Immutability
Building any program is often an exercise in modeling and managing complex state. While object-oriented programming can make it easier to model this state, it can often give rise to problems of data synchronization and consistency. If the models representing state can be changed at any given time, then it becomes more difficult to reason about the current state of a given application. It becomes difficult to understand when and where state is being manipulated, or even how best to modify state.
This is why the immutable nature of variables and state within functional code is so appealing. If the models representing our state are immutable, then the contract with which to create or modify state becomes much more explicit. To represent ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access