Lazy Initialization - The "lazy Factory"

The "lazy Factory"

In a software design pattern view, lazy initialization is often used together with a factory method pattern. This combines three ideas:

  • using a factory method to get instances of a class (factory method pattern)
  • storing the instances in a map, so you get the same instance the next time you ask for an instance with same parameter (Multiton pattern, similar to the singleton pattern)
  • using lazy initialization to instantiate the object the first time it is requested (lazy initialization pattern).

Read more about this topic:  Lazy Initialization

Famous quotes containing the words lazy and/or factory:

    I wish thee peace in all thy ways,
    Nor lazy nor contentious days;
    And when thy soul and body part,
    As innocent as now thou art.
    Richard Corbet (1582–1635)

    I cannot believe that our factory system is the best mode by which men may get clothing. The condition of the operatives is becoming every day more like that of the English; and it cannot be wondered at, since, as far as I have heard or observed, the principal object is, not that mankind may be well and honestly clad, but, unquestionably, that the corporations may be enriched.
    Henry David Thoreau (1817–1862)