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:

    “Along with the lazy man ... the dying man is the immoral man: the former, a subject that does not work; the latter, an object that no longer even makes itself available to be worked on by others.”
    —Michel de Certeau (1925–1986)

    “I reverently believe that the Maker who made us all makes everything in New England but the weather. I don’t know who makes that, but I think it must be raw apprentices in the weather-clerk’s factory who experiment and learn how.... In the spring I have counted one hundred and thirty-six different kinds of weather inside of four-and-twenty hours.”
    —Mark Twain [Samuel Langhorne Clemens] (1835–1910)