Re: first php 5 class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 30, 2008 8:40 AM, Eric Butera <eric.butera@xxxxxxxxx> wrote:

> On Jan 29, 2008 3:29 PM, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
> Still pimping singleton, huh? :)
>

hell yeah :)

i looked at the registry classes you pointed out.
you know what funny about the one in solar?
they refer to the same article i mentioned, namely,
the article at the phppatterns site.  good to know
somebody else out there thinks highly of that site :)

also, i took a look (briefly though), in patterns of
enterprise architecture by martin fowler, which is
(perhaps) where the pattern was originally formalized.
he says that he prefers to have the data in the registry
stored in instance variables, but obviously there are ways
to vary the implementation of a pattern.  ergo, in his
design the registry class itself would be a singleton.

it looks like the 3 examples you showed previously, are
all of essentially the same design.  a class uses static
class members to store the data, and it is essentially
global, because well, any bit of code can reference the class.
id say the technique only works as a consequence of phps
dynamic nature, that is, in other languages like java and c++
i dont think you can create static class members on the fly.
the technique is certainly interesting.

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux