Robert "Uncle Bob" Martin discussed three programming paradigms in his book, Clean Architecture.
SP (Sturectured Programming)
OOP (Object-oriented Programming)
FP (Functional Programming)
Each one provided programmers "constraints".
SP - A direct/explicit transfer of control (goto is discouraged)
OOP - An indirect transfer of control (function pointers are eliminated)
FP - A variable assignment (cannot assign a new value one initialized)
To understand why immutable data is being popular,
let's see how aforementioned "constraints" help us.
SP - with removal of goto in our code, we can see flow of our code better
OOP- We have a complete control over code dependencies and flows
FP - All race/deadlock conditions, concurrent update problems go away
Front-end world has evolved very quickly and requires many code to run in parallel or asynchronously.
Websites aren't just about onClick-do-this simple any more.
IMHO, immutable data became popular to keep our state in consistent state & also provide other benefits such as memoization, time travel, etc
Robert "Uncle Bob" Martin discussed three programming paradigms in his book, Clean Architecture.
Each one provided programmers "constraints".
goto
is discouraged)To understand why immutable data is being popular,
let's see how aforementioned "constraints" help us.
goto
in our code, we can see flow of our code betterFront-end world has evolved very quickly and requires many code to run in parallel or asynchronously.
Websites aren't just about onClick-do-this simple any more.
IMHO, immutable data became popular to keep our state in consistent state & also provide other benefits such as memoization, time travel, etc
Thanks for the awesome comment. I really enjoyed it as a whole but I will highlight a few parts for further discussion if you don't mind.
This is a bit vague for me. How is mutable state inconsistent?
This is true for multi-threaded languages but I don't think this is an issue in case of (the mostly single-threaded) JavaScript.
I totally agree with this one, immutable updates really shine here.
PS: Thanks for the link to the book.
Thanks for the feedback, Miklos.
What I meant was variables don't change thus wherever you access that variable, it's always the same (consistent).
Maybe it came out wrong 😅