[TYPO3-core] RFC: Interface classes/files

Ingo Renner ingo at typo3.org
Sat Nov 17 20:48:30 CET 2007


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!

> ** 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.

> ** 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.


all the best
Ingo

P.S. this should really be documented in either core team guide or 
coding guidelines (probably the later)

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


More information about the TYPO3-team-core mailing list