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

Ingo Renner typo3 at ingo-renner.com
Tue Dec 12 18:17:24 CET 2006


Robert Lemke wrote:

Hi Robert,

> thank you for joining the discussion.

well, I just had to after hearing an OOA/D lecture all the semester long ;-)


>> Another advantage of the I-prefix would also be that you automatically
>> have all the interfaces together when ordering the files by alphabet...
> 
> But you also have that feature if you call the files "class.*" and 
> "interface.*"
> like we currently do.

agreed, but this is only for the file names, think of the PHPIDE 
extension for Eclipse, this should list the interface and classes in 
some view where you don't have the interface.* prefix from the file 
names but the I* is helping a lot in this view...


>> And again, it is a well established and common practice in f.e. Java and
>> C#, and Visual Basic
> 
> Okay, although I generally agree that sticking to standards can help, it's
> not the main objective - the most important point is that naming is 
> verbose,
> self explaining and easy to remember. But maybe your suggestion is just 
> that -
> intuitive.

agreed, too. It just needs to be easy, and what could be easier than an 
obvious single letter?

> Let's add some references when we say something like "it's common practice"
> or "a standard", because that helps leading a substantiated discussion.

sure, I just remembered having seen a lot of I prefixes in Java and 
googled how .NET is handling it.

 > The GNU Coding Standard (C++) [5] suggests to use
 > underscores_to_concatenate_words
 > instead of writingThemCamelCase. That's something I really don't like.

me neither

>    « C is a Spartan language, and so should your naming be.  Unlike 
> Modula-2
>      and Pascal programmers, C programmers do not use cute names like
>      ThisVariableIsATemporaryCounter.  A C programmer would call that
>      variable "tmp", which is much easier to write, and not the least more
>      difficult to understand. »

This is an obvious one, there's no reason to use such a long name just 
for a counter.

> The Zend Framework uses Underscores_For_Concatenating_Words and adds the 
> suffix
> "Interface" for interfaces [8]. 

can it get any uglier?

> I would say - there's not really THE standard but you're right, many 
> developers
> use the I-prefix and it does help distinguishing between classes and 
> interfaces
> on a glance. That's a good reason for using it, so let's add it to our 
> guidelines.


>> Anyway in general I would suggest to stick with (or copy from) naming
>> conventions that have been in place for years - usually for a reason.
> 
> But not always for a good reason ...

true.

> [1] http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367
> [2] http://jakarta.apache.org/site/faqs.html
> [3] 
> http://wiki.eclipse.org/index.php/Naming_Conventions#Classes_and_Interfaces
> [4] 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconinterfacenamingguidelines.asp 
> 
> [5] http://www.gnu.org/prep/standards/html_node/Names.html#Names
> [6] http://www.chris-lott.org/resources/cstyle/
> [7] http://www.chris-lott.org/resources/cstyle/LinuxKernelCodingStyle.txt
> [8] 
> http://framework.zend.com/manual/en/coding-standard.naming-conventions.html
> [9] 
> http://svn.ez.no/filedetails.php?repname=ezcomponents&path=%2Fguidelines%2Fnaming_conventions.txt&rev=162&sc=1 
> 
> [10] http://pear.php.net/manual/en/standards.naming.php
> [11] http://www.artima.com/lejava/articles/designprinciples.html

well, it seems you did some more thorough investigation, I just wrote 
from my experience/knowledge/what I remembered ;-)


Ingo



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