2009年5月3日星期日

Re: [fw-core] bootstrap classnames and include paths in config

-- jkarczm <jacek@karczmarczyk.pl> wrote
(on Saturday, 02 May 2009, 11:22 AM -0700):
> Thanks for releasing 1.8.0 (and all previous versions), a quick look at the
> latest version made me to send two questions:
>
> 1. why bootstrap class are Zend_Application_Bootstrap_Bootstrap and
> Zend_Application_Bootstrap_BootstrapAbstract and not just
> Zend_Application_Bootstrap and Zend_Application_Bootstrap_Abstract (like
> other cases like i.e. Zend_View and Zend_View_Abstract)? It's not
> intuitive...

We're revising our naming conventions in preparation for using
namespaces with PHP 5.3. Since "Abstract" and "Interface" are reserved
keywords, we cannot use these as the final, standalone, segment of class
names. Additionally, there is some concern with using Hungarian
notation, so we are no longer accepting the term "Interface" within
interface names.

Now, as for the 'Zend_Application_Bootstrap_' prefix... This makes much
more sense when you consider it a namespace, as then each item under
that namespace has a discrete name:

namespace zend\application\bootstrap;

interface Bootstrapper {}
interface ResourceBootstrapper {}
abstract class BootstrapAbstract implements Bootstrapper, ResourceBootstrapper{}
class Bootstrap extends BootstrapAbstract {}

The point was to keep the various classes within the same component
namespace.

We may create a 'Zend_Application_Bootstrap' in the future that extends
Zend_Application_Bootstrap_Bootstrap in order to simplify the name --
but that's still up for debate.

In the future, we will start renaming existing classes (while keeping
the originals, for BC) to follow the new conventions -- in order to ease
the transition to namespaces.

> 2. Why in config file you are using PATH_SEPARATOR for includePaths? This
> can be a problem if the application has to be installed on 2 different
> systems which uses different PATH_SEPARATOR - in such case you should use
> different config files for these systems, and of course it's better to have
> one. IMHO in Zend_Application::setIncludePaths you should use for example
> ";" for implode and then PATH_SEPARATOR for set_include_path as it is now

Can you point out where we are doing that?

Within a configuration file, you should be providing an individual path
at a time to an array:

includePaths[] = APPLICATION_PATH "/../vendor"
includePaths[] = APPLICATION_PATH "/../library"

This will work cross-platform, as internally we then implode() these
paths using the PATH_SEPARATOR constant. (And this is also what
Zend_Tool generates for the public/index.php file...)

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: