Lazy Instantiation Pattern

Intent: Used for Lazy instantiation of objects or for Lazy processing. Suppose you need to support 'resource-hungry' objects (eg. those that involve a large amount of I/O or a database transaction). One need not instantiate these objects until they are really required. The real object would get created only when the client actually requests some of its functionality.

A special case of HandleBodyPattern.

See also: ProxyPattern, HandleBodyPattern, DesignPatterns LazyEvaluation


FunctoidsInCpp provides an implementation in CeePlusPlus, using LazyPtrProxy (see ObserverPatternInCeePlusPlus).


CategoryCreationalPatterns CategoryLazyPattern CategoryFunctionalProgramming


EditText of this page (last edited December 17, 2009) or FindPage with title or text search