-- Chris Morrell <[email protected]> wrote
(on Saturday, 27 March 2010, 12:00 AM -0400):
> I always thought that Default_ was the recommended namespace for everything
> under the application/ tree that's part of the default module, and that
> Application_ was becoming the standard for library/application/.  Have I 
> always
> been mistaken or has this changed recently?

In 1.10, we put in infrastructure for naming the default module and
thus prefixing resources from that module. We'd originally recommended
"Default_", but felt this led to some confusion and potential issues:

 * Modules are prefixed using the module name, which is the name of
   their parent directory. But the "default" module is named after...
   what? its parent directory is "application"...

 * Typically, the resources in your default module are meant to be used
   "application"-wide, not just by that module. "Application" is thus a
   better name.

The change we made is completely backwards compatible, as all that
really changed is that Zend_Tool now creates a configuration entry that
sets the prefix for you.

As for having a "library/Application" directory, I'm not familiar with
this practice, believe it or not.

> This always made sense to me:
> 
> application/
>   controllers/  →  *Controller

This stays the same.

>   forms/  →  Default_Form_*
>   models/  →  Default_Model_*

These now would be prefixed "Application_<component>_"

>   modules/
>     admin/  →  Admin_*
>     blog/  →  Blog_*

These stay the same.

> library/
>   Zend/  →  Zend_* (if ZF is not in global include_path)
>   MyCompany/  →  MyCompany_* (shared components within company, etc)
>   Application/  →  Application_* (components specific to application that 
> don't
> fall under modules, such as a custom Action Helper)

I'd typically put action helpers under application/controllers/helpers
(which is noted in our recommended directory structure as well). I
usually use library/ only for code I want to re-use between _projects_.

> Now that application/ maps to Application_ (which makes sense from a directory
> naming perspective, but not so much from a modular perspective), is the
> recommendation that you give your application-wide library an
> application-specific namespace?
> 
> CM : http://cmorrell.com/ — @inxilpro
> 
> 
> 
> On Fri, Mar 26, 2010 at 1:29 PM, Matthew Weier O'Phinney <[email protected]>
> wrote:
>  
> 
>     "Application" is what we specify as the default for resources under the
>     "application" tree -- but even this is fully configurable, and I'd
>     recommend using one that's project specific.
> 

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Reply via email to