[TYPO3-core] RFC: Interface classes/files

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Sun Nov 18 13:24:16 CET 2007


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.

> 
>> ** 3 ** If we decide to not move all interfaces into one file (**2**) 
>> we should at least
>> rename "interface.t3lib_localrecordlistgettablehook.php" into 
>> "interface.t3lib_localrecordlist_gettablehook.php"
>> i.e: separating the class-name from the hook-method-name by a "_"
> 
> this is absolutely fine with my.

Yes, makes it more readable.

Masi


More information about the TYPO3-team-core mailing list