[TYPO3-50-general] File name conventions for classes and interfaces

Robert Lemke robert at typo3.org
Thu Nov 30 17:51:43 CET 2006


Hi folks,

during the last days I've been thinking again about our naming 
convention for .php files. Currently they are like this:

    class.T3C_PackageName_ComponentClassName.php
    interface.T3C_PackageName_ComponentInterfaceName.php
    exception.T3C_PackageName_ComponentExceptionName.php

There are two things I don't like about it:

   a) Why is an exception so special that it deserves its own name?
      In my eyes, it's just a class so I wouldn't make an exception
      here.

   b) After staring at it for a while I like it better if we use
      "class" and "interface" as a suffix rather than a prefix
      because the package- / component name is more important and
      sorting is nicer / more logic.

I therefore propose switching to the folloing pattern:

    T3C_PackageName_ComponentClassName.class.php
    T3C_PackageName_ComponentInterfaceName.interface.php

And furthermore, extend the naming convention for classes: If a class 
implements one interface, it should be named after it:

    T3C_Hola_HelloWorld.interface.php
    T3C_Hola_HelloWorldImplementation.interface.php

What do you think?

-- 
robert


More information about the TYPO3-project-5_0-general mailing list