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

Joerg Schoppet joerg at schoppet.de
Mon Dec 11 10:31:16 CET 2006

Robert Lemke wrote:
> Hi Martin,
> Am 11.12.2006 um 09:39 schrieb Martin Kutschker:
>> Too verbose but not obvious. I think I'm too dumb to get the difference
>> between the definition and the implementation. And how does this differ
>> from a class file?
>> So, going back to the original suggestion I'd use a "Interface" suffix as
>> the "I" is really ugly:
>> HelloWorld.php
>> HelloWorldInterface.php
>> HelloWorldException.php
> That naming has the disadvantage that only one implementation of the 
> interface is named after the interface. What I meant was this:
> Let's say we have an interface which describes how a "Greeter" class 
> should look like, then we call the interface "Greeter". One 
> implementation of a greeter could be the "HelloWorldGreeter". An 
> alternative implementation would be the "HelloMartinGreeter". Both are 
> greeters and therefore implement the "Greeter" interface.
> Another example: An interface defines the API for a Template Engine, it 
> is therefore called "TemplateEngine". Now we have three implementations:
>   - SmartyTemplateEngine (implements TemplateEngine)
>   - TemplaVoilaTemplateEngine (implements TemplateEngine)
>   - ClassicTemplateEngine (implements TemplateEngine)
> Someone wants to enhance the ClassicTemplateEngine by adding the 
> automaketemplate functionality. He creates a new class which inherits 
> the ClassicTemplateEngine and adds or replaces some methods. It is 
> called "EnhancedClassicTemplateEngine".
> The question you should always be able to ask is: "Is [Class name] a 
> [Interface name]?" ("Is SmartyTemplateEngine a TemplateEngine?").
> Sometimes you might even want to use interfaces just because you want to 
> be able to ask the previous question - the interface doesn't 
> neccessarily add any new methods. These interfaces are then called 
> "marker interfaces" because the mark your implementation.
> You see what I mean?
> --robert
> http://typo3.org/gimmefive

I see what you mean, but I have to go with Martin. If you follow this 
syntax, you have in the near future potential names, which are very long.
Another problem with this syntax is, what will be the name if a class 
implements two or more interfaces?

I would not say, that it is necessary to get the complete inheritance 
and interface structure out of the class-/interface-/file-name.



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