Tuesday, March 13, 2007

The Parametric Singleton Design Pattern

By Douglas Lyon and Francisco Castellanos

The parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached in a table. When a user asks for an instance with these parameters, the table is checked and instances are created conditionally.
Lazy instantiation is not new, nor, for that matter, is the singleton design pattern. However, parametric lazy instantiation is new and so is the parametric singleton.
http://www.jot.fm/issues/issue_2007_03/column2