[TYPO3-core] RFC: Interface classes/files

Ingo Renner ingo at typo3.org
Sun Nov 18 19:43:05 CET 2007


Martin Kutschker wrote:
> Ingo Renner schrieb:
>> Bernhard Kraft wrote:
>>
>> Hi Bernhard,
>>
>>> t3lib/interfaces/interface.t3lib_localrecordlistgettablehook.php
>>>
>>>
>>> there are 2 concerns:
>>>
>>> ** 1 **  Why the filename 
>>> "interface.t3lib_localrecordgetlistgettablehook.php" the
>>> class in which this interface is used "typo3/class.db_list_extra.php" 
>>> has nothing
>>> to do with "t3lib" - shouldn't it be 
>>> "interface.typo3_localrecordlist..." ???
>>> Or is t3lib added there cause the interface classes reside in t3lib 
>>> directory ???
>>
>> the reason is that it was the first time we added an interface. Thus 
>> my first proposal was just putting it into t3lib/. Ingmar then came up 
>> with t3lib/interfaces/. t3lib/interfaces/ just seemd to fit well and 
>> thus there's the t3lib in the name.
>>
>> Of course as we have typo3/classes/ we could also introduce 
>> typo3/interfaces/ for interfaces like that one, good point!
> 
> Agreed. Interfaces of t3lib-classes should be in t3lib/interfaces, other 
> typo3-class should be in typo3/interfaces (matching typo3/classes).
> 
> If tslib ever gets interfaces it'd be PATH_tslib.'interfaces'.
> 
>>
>>> ** 2 ** Should we rename the interface-file from 
>>> "interface.t3lib_localrecordlistgettablehook.php"
>>> to "interface.t3lib_localrecordlist.php" ... meaning that this 
>>> interface-file contains all interfaces
>>> used in "class.db_list_extra.php" - which defines the class 
>>> "localRecordList" ????
>>
>> no, leave it as it is as it's an interface for a hook, not for the 
>> whole class.
>>
>>> --> else we would end up with one single file for each hook ...
>>
>> this is ok, as you do not always want to implement methods for all 
>> hooks in a class and hooks mostly address different tasks. Of course 
>> it makes sense to pack multiple methods into one interfaces for some 
>> cases like the hook request by Stefan Geith from 25.10.2007, I've 
>> added a patch which uses an interface as a reply to his request 
>> (t3lib_stdWrapHook). There the methods are all about stdWrap so hat 
>> they are combined in one interface.
> 
> This will get messy, but I see the point.

Don't think so as it also educates extension developers to spread their 
functions into separate classes if it concerns different tasks. 
Alternatively it would result in

myExtensionClass implements someHook, someOtherHook, aDifferentHook

which still looks good IMO.


all the best
Ingo

-- 
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2


More information about the TYPO3-team-core mailing list