[TYPO3-50-general] File name conventions for classes and interfaces
Christian Welzel
gawain at camlann.de
Tue Dec 12 11:04:30 CET 2006
Robert Lemke wrote:
> Much Java code I have seen uses a noun for the interface and the
> suffix "Impl"
> for the class implementing the interface. I think that's a bad idea.
This is mostly used, when automaticly generated classes and interfaces
are used. You define your API in IDL (e.g.) and the compiler generates
the neccessary interfaces. But normally you want to have some stub
classes...
So how to name them? Appending Impl is the easiest way.
The way *I* would name my classes and interfaces is not so much
oriented at this mere technical aspect. I would name them after the
pattern they implement.
Example:
FooIteratorInterface
-> FooSimpleIterator
-> FooAdvancedIterator
FactoryInterface
-> BlaFactoryInterface
--> BlaSimpleFactory
--> BlaExtraFactory
---> MyBlaExtraFactory
In *MY* opinion it is much more important to see what function a
class/interface has in the whole project, rather than if its a class
or an interface or what class/interfaces it inherits from.
So i would like to see the convention that interfaces are marked with
the string "Interface" in their name and the rest of the names of
classes/interfaces should reflect the pattern the class implements or
is part of.
--
MfG, Christian Welzel
GPG-Key: http://www.camlann.de/key.asc
Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15
More information about the TYPO3-project-5_0-general
mailing list