14. Why is immutability useful?
MediumProgramming fundamentals
Technical
Show model answer
Immutable data cannot change after creation, so it is safe to share across threads, easy to reason about, and simple to cache or compare.
The trade-off is extra allocation when "changing" values; persistent data structures and structural sharing reduce that cost.