Possible Duplicate:
At what point do immutable classes become a burden?
This is something I never understood. When learning C++, for instance, I had lots of headaches with const issues, as it added lots of complexity to programming. Why is…
I have seen examples where even though the object is immutable there are situations in which we need to update some fields and as I understand it, the object is passed to a constructor which makes a copy with updated values but the original is not…
The example I'm about to give is for the PHP language, but I think this scenario applies to most languages.
Let's say I have an object called Response and I want it to be immutable. Every method should return a new instance rather than modifying…
I'm learning about immutability (specifically in C#) and I can't understand the examples out there stating that making an object immutable brings real benefits (besides a shared object in a multi threaded environment, which the benefits are pretty…
Immutable objects
In object-oriented and functional programming, an immutable object (unchangeable[1] object) is an object whose state cannot be modified after it is created
Wikipedia (https://en.wikipedia.org/wiki/Immutable_object)
Code example…