This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I could not understand some parts(i.e Bold Text) of the Effective Javaof item 71 it says,
Lazy initialization is the act of delaying the initialization of a field until its
value is needed. If the value is never needed, the field is never initialized. This
technique is applicable to both static and instance fields. While lazy initialization
is primarily an optimization, it can also be used to break harmful circularities in
class and instance initialization
if user enter the value for usdf ,then only you plan to create a object for UserDefinedField[using Factory method getUserDefinedField()] and want to set the value. otherwise(if user ignore the UserDefinedField ) there is no need for creating an Object for usdf.
I am not sure, but I think circularity in class initialization would occur if initialization of one class(say A) depends on initialization of other(say B) and at the same time initialization of the other class(B) depends on initialization of the first class(A). The dependency graph will have a loop. Typically, class initialization is the process of loading the class in memory and then initializing the static variables of the class to their values.