Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

phpPatterns:
The Singleton Registry
Sep 12, 2003 @ 12:42:15

For all of you "patterns" nuts out there that have been wondering when phpPatterns.com was going to update with a new pattern, your wish has been granted.

The Singleton Registry, posted late yesterday, provides a mechanism for storing data globally in a well managed fashion, helping to prevent global meltdown. This article discusses building a registry as well as an insight into the mind of a test infected developer (Test Driven Development). This registry provides a "repository" of sorts for the data, and uses get and set functionality to move the data around between your classes, never accessing the data directly. Not only does this allow more flexibility by using abstraction to access your data, but it also allows you to keep your data out of the global scope - reducing errors and possible unforseen conflicts.

It's always interesting for me to read over patterns articles like this and see that something I've been using (at least in part) has a name to it. And usually, I notice one or two additional features that I never thought of, and store them in my mind to use later...

tagged:

Link:


Trending Topics: