On Thu, Jan 6, 2011 at 15:46, Greg Beaver <[email protected]> wrote:

> For a real-life example, a program I wrote in PHP uses a configuration
> object that is a singleton per-directory, so that if one requests a
> configuration object that is for an existing configuration, it retrieves the
> in-memory configuration if it has already been loaded, and otherwise creates
> a new object and loads the configuration from disk.  To differentiate from a
> singleton, I used a different method name, however, because it would be
> confusing to those who would read "singleton" and assume it operates as a
> normal singleton.
>

Cool! A multiton! :-)

Actually I've done something very similar. There are occasional uses for a
series of singletons, identified by *something*. Coming up with how that
identification works, in a generic fashion, is likely prone to error. Is *
something* a single parameter? Two? Three? An array? An object? You could
treat the series of parameters as an array and require that all values have
to match (the OP's scenario, using integers, I think) but what if some of
those parameters are themselves objects or arrays? Does it require that a
deep comparison return true, or more strictly that the reference be the
same?

I think this pattern is probably best devised uniquely for each application
that requires it.

Derrell
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to