> > What if "Zend_Registry::getRegistry()" was an alias of
> > "Zend_Registry::getInstance()"?

I'm not in favor of this; aliases that offer no difference in
functionality or usability are not consistent with the goal of
protecting users from excessive choices.

But now that we think of the get() method as static-only, as Stas points
out there is no need to call it on an object, then get() with no
arguments is actually equivalent to getInstance().  The getInstance()
method doesn't need to be public at all.

So the usage to get the default static registry is:
  $r = Zend_Registry::get();

These three are equivalent:
  Zend_Registry::get('foo')
  $r->offsetGet('foo');
  $r['foo'];

These three are equivalent:
  Zend_Registry::set('foo', 'bar')
  $r->offsetSet('foo', 'bar)
  $r['foo'] = 'bar';

The old Zend::initRegistry('classname') method is a bit more clearly
named:
  Zend_Registry::setClassName('classname')

This is needed only by people who want to use a subclass as the static
registry instance.

> From: Matthew Ratzloff [mailto:[EMAIL PROTECTED]
> Perhaps the manual can have a short section on design patterns, with
> overviews of those found in the framework.  Each component could then
link
> to the ones they use, to help facilitate this educational process.

I think educating users on design patterns is a fine idea.  It would be
great to see a series of articles on DevZone about implementing design
patterns in PHP.  In fact, it's such a good idea that there already is
such a series of articles on DevZone.  :-)
http://devzone.zend.com/search/results?q=pattern

But it's probably not something that needs to be in the Zend Framework
manual.  Stas is right that the principle of extreme simplicity in ZF
should make it unnecessary to know design patterns just to use ZF.
Education is always beneficial, but one doesn't need to be a mechanic to
drive a car.

Regards,
Bill Karwin

Reply via email to