Lazy initialization Pattern is responsible to create an instance when only it is required by the Client. This is useful when the object is under creation complex and takes a lot of memory and time. Good example is a parent object that consists of lots of child objects. When the parent object is loaded, we may not want to load all the child objects at the same time. The opposite of Lazy initialization is Eager initialization.
Intention
- Delays the creation of an instance, the calculation of a value or some other time, memory consuming expensive process until the first time it is required.
Lazy Initialization
Client
No comments:
Post a Comment