Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>But, what are the downsides to favouring immutable objects in Java? incompatibility with ORM or web presentation tools?</p> </blockquote> <p>Reflection based frameworks are complicated by immutable objects since they <strong>requires</strong> constructor injection: </p> <ul> <li>there are no default arguments in Java, which forces us to ALWAYS provide all of the necessary dependencies </li> <li>constructor overriding can be messy</li> <li>constructor argument names are not usually available through reflection, which forces us to depend on argument order for dependency resolution</li> </ul> <blockquote> <p>Implementation complexities?</p> </blockquote> <p>Creating immutable objects is still a boring task; the compiler should take care of the implementation details, as in <a href="http://groovy.codehaus.org/Immutable+AST+Macro" rel="nofollow noreferrer">groovy</a></p> <blockquote> <p>Is it possible to design a large-scale system (deep object graph) that predominately uses immutable objects?</p> </blockquote> <p>definitely yes; immutable objects makes great building blocks for other objects (they favor composition) since it's much easier to maintain the invariant of a complex object when you can rely on its immutable components. The only true downside to me is about creating many temporary objects (e.g. <a href="https://web.archive.org/web/20080324114426/http://java.sun.com/developer/JDCTechTips/2002/tt0305.html" rel="nofollow noreferrer">String concat was a problem in the past</a>). </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload