Downsides to immutable objects in Java?
Posted
by parkr
on Stack Overflow
See other posts from Stack Overflow
or by parkr
Published on 2009-04-15T15:37:03Z
Indexed on
2010/05/15
7:44 UTC
Read the original article
Hit count: 169
The advantages of immutable objects in Java seem clear:
- consistent state
- automatic thread safety
- simplicity
You can favour immutability by using private final fields and constructor injection.
But, what are the downsides to favouring immutable objects in Java?
i.e.
- incompatibility with ORM or web presentation tools?
- Inflexible design?
- Implementation complexities?
Is it possible to design a large-scale system (deep object graph) that predominately uses immutable objects?
© Stack Overflow or respective owner