Re: first php 5 class

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

 



On Jan 30, 2008 9:57 AM, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
> 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
>

The only gripe I have about the registry pattern is the lack of code
completion in PDT. ;)

I love php patterns, but it seems to sort of be dead for years now.

I just keep downloading copies of various frameworks and poke through
their implementations.  At the end of the day though it is my job to
write code, so I'm going to always balance the code purity vs getting
it done.  I am okay with a registry that uses static methods because
it works in my projects.  Some people would insist on being able to
create an instance and pass that around, but I don't need that level
of complexity.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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