The most obvious benefit of this is that it is easier to reason about code when you don’t have to worry about the “current” state of any internal data.
My own phrasing about this subject: With mutable data, the state is no longer encoded in programming code itself, rather a temporary state you have to calculate in your head. That’s why people need debuggers, to help pausing at a time and see the current state and analyze each step in between all immutable states; which can be endless, depending on the input.
About Immutable Data:
My own phrasing about this subject: With mutable data, the state is no longer encoded in programming code itself, rather a temporary state you have to calculate in your head. That’s why people need debuggers, to help pausing at a time and see the current state and analyze each step in between all immutable states; which can be endless, depending on the input.