Forum Moderators: coopster

Message Too Old, No Replies

File System Structuring and Naming of Classes

How do you do it?

         

Sekka

12:41 pm on Apr 23, 2009 (gmt 0)

10+ Year Member



Through programming with various frameworks and websites I've come accross two ways of structuring and naming PHP classes within the file system.

The first is Zend's approach with their framework. Classes are seperated into packages/namespaces using folders. The class PHP file itself is named after the class. And the actual class name is the package/namespace and class combined.

The second is one I've come accross using Propel in Symfony. Classes are seperated into packages/namespaces using folders as with Zend, but the class PHP file and class name are simply a unique name, without underscores or such.

My question is which do you prefer/use?

I'm tempted to lean towards the Zend approach as it seems to better define the structure. However, the Propel approach gives cleaner class names.

[edited by: Sekka at 12:41 pm (utc) on April 23, 2009]

coopster

12:50 pm on Apr 23, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The former approach. It's a bit more "self-documenting" in the regard that one quick glance at the name and you know where to locate the document in case you aren't using or have access to an IDE.