06-05-2008, 02:31 PM
|
#6 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
That's how I wound up with the registry. I started with the idea of the singleton, but I didn't implement it properly (didn't make each class with a private constructor and it's own getInstance method), I figured it made more sense to have one central method that called any module I wanted, so while I thought I was implementing a singleton I was actually building a registry. I just didn't know the name of it at first.
If you notice the registry does the same thing very nearly, it stores objects in the static var $_registry and calls them back from there when additional requests for the same object are made. I'm hardly a pattern expert, so I don't know what's truly best for a given situation, I just like this way, it hasn't given me any trouble performance wise whatsoever and it provided me with a clean way to build my organizational structure and load objects as I needed them.
-m
|
|
|
|