Issues

ZF-6331: Zend_Application classes violates against coding standards

Description

||current||must be|| |Zend_Application_Bootstrap_BootstrapAbstract|Zend_Application_Bootstrap_Bootstrap_Abstract| |Zend_Application_Bootstrap_Bootstrapper|something like Zend_Application_Bootstrap_Interface| |Zend_Application_Bootstrap_ResourceBootstrapper|something like Zend_Application_Bootstrap_ResourceBootstrapper_Interface| |Zend_Application_Module_Bootstrap|something like Zend_Application_Module_Bootstrap_Abstract| |Zend_Application_Resource_ResourceAbstract|Zend_Application_Resource_Abstract|

And why are there such stupid (!?) class names like following?

||current||why not ...?|| |Zend_Application_Bootstrap_Bootstrap|Zend_Application_Bootstrap| |Zend_Application_Bootstrap_BootstrapAbstract|Zend_Application_Bootstrap_Abstract|

Comments

We are revising the coding standards, and the new standards will be published in the manual for 1.8. There are several concerns:

  • When we move to using namespaces: ** having a final segment of just "Interface" or "Abstract" will not work, as they are reserved keywords ** the interface and the framework's concrete implementations should be in the same namespace
  • A desire to stay away from Hungarian Notation
  • A desire to comply with forthcoming PEAR2 standards: ** http://wiki.php.net/pear/rfc/pear2_class_naming
    ** http://wiki.php.net/pear/rfc/…

A summary of the new rules is as follows: * Interfaces must be named descriptively, and fall under the same namespace as implementations * Abstract classes should be named descriptively, but may include the suffix "Abstract" as part of the classname * Abstract classes must fall under the same namespace as implementations

The reason we want the interfaces/abstracts to fall under the same namespace as implementations is to make it easy to package individual components, as well as to import and alias a single namespace .

To give an example, consider the following PHP 5.3 namespace-aware implementations:


namespace zend\application\bootstrap;

interface Bootstrapper
{
}

abstract class BootstrapAbstract implements Bootstrapper
{
}

class Bootstrap extends BootstrapAbstract
{
}

In a userland implementation, you might have the following:


namespace website;
use zend\application\bootstrap as App;

class Bootstrap extends App\Bootstrap
{
}

These changes to the standards have been discussed on the zf-contributors mailing list.

Why then is Zend_Application not Zend_Application_Application?