Why should you favor immutability?
For many good reasons.
Question
Why should you favor immutability?
Less Short Answer
When your objects are non-modifiable, you don't need to bother about the state they carry — it is the state you created them with. So debugging is much simpler, because you do not need to track when this state was modified.
Simpler in a Concurrent Environment
It is simpler also in a concurrent environment. Non-modifiability comes with built-in thread safety: race conditions can only occur when you have a write operation, and here the only write operation you have is the creation of your object. So if you are using records, or classes with final instance fields, then the creation of your objects is protected against race conditions.
javapublic record Point(int x, int y) {} // fields are implicitly finalNon-modifiability makes your job much easier when it comes to bug hunting in your applications.
One Last Word
Immutability will even bring better performance when Valhalla delivers value classes. And stop making fun of Valhalla not coming anytime soon — because it is coming sooner than you expect.