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:

    Take us generally as a people, we are neither lazy nor idle; and considering how little we have to excite or stimulate us, I am almost astonished that there are so many industrious and ambitious ones to be found; although I acknowledge, with extreme sorrow, that there are some who never were and never will be serviceable to society. And have you not a similar class among yourselves?
    Maria Stewart (1803–1879)

    Baltimore lay very near the immense protein factory of Chesapeake Bay, and out of the bay it ate divinely. I well recall the time when prime hard crabs of the channel species, blue in color, at least eight inches in length along the shell, and with snow-white meat almost as firm as soap, were hawked in Hollins Street of Summer mornings at ten cents a dozen.
    —H.L. (Henry Lewis)