[TYPO3-50-general] Package Key Guidelines

Jochen Rau j.rau at web.de
Wed May 7 00:28:54 CEST 2008


Hi Tim,

[...]
>> IMO the package key is only the second part of a class/component name, 
>> e.g.
>>
>> F3_MyPackageKey_MyComponentName_MySubComponentName
>>
>> and must be in UpperCamelCase. To test a package key I suggest
>>
>> ^[A-Z][A-Za-z0-9]+$
>>
>> as RegEx.
>>
>> To match the entire class/component name i suggest
>>
>> ^F3(?:_[A-Z][A-Za-z0-9]+)+$
[...]
> to this whole part:
> here you notice what i wrote above. F3_ shouldnt and cant be used, 
> because it contains underscores. but also F3 shouldn't be used.
> also "keywords" shouldn't be used. i don't know what robert included in 
> his code, but i am just thinking about special OO keywords like 
> "Interface", "Abstract", "Class" and so on. also already taken packages 
> should be forbidden: "FLOW3", "Testing" and so on.

I don't think we should be so restrictive as 
"F3_ClassRoomManager_Repository" is a great name for a domain model ;-)

It seems that we are at cross-purposes. Take

^[A-Z][A-Za-z0-9]+$ as RegEx for package keys

^F3(?:_[A-Z][A-Za-z0-9]+)+$ as RegEx for class and component names.

> i think one char package names should be forbidden.

I agree.

> one last thing:
> in FLOW3CGL at the moment we only check the whole class name. we only 
> check if it exceeds the allowed characters a-z A-Z 0-9 and _
> at this moment i see that we dont check for uppercase word beginnings, 
> we have to implement it :(

Take the second RegEx from up above.

> check the checks in 
> http://forge.typo3.org/repositories/browse/packages-flow3cgl/trunk/Classes/Checks/NamingConventions 
>  for that. i have to talk to malte about that a bit.

I checked it and I think there is a bug in class 
"T3_FLOW3CGL_Checks_NamingConventions_ValidClassNameSniff". Line 102

if (preg_match('|(Abstract[a-zA-Z0-9])$|', $declarationName, $match)) {

should be

if (preg_match('|(Abstract[a-zA-Z0-9]+)$|', $declarationName, $match)) {

Do you attend T3DD08? Hope to meet you there.

Greetings
Jochen


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