[TYPO3-dev] Using Hooks in own classes
dan frost
dan at danfrost.co.uk
Sun Feb 12 17:53:20 CET 2006
How big is your class.
For a really "hook-able" architecture, the nicest
way is:
1. very small classes,
2. use ::makeInstance (or similar wrapper) to look
up over-ridden classes
Can you post the structue of your class (methods +
properties)?
dan
Ingo Schmitt wrote:
> Hi list,
>
> when implementiong hooks in own classes, there are some ways to define
> these hooks:
>
> 1) Define one hook array per Method in each class
> 2) Define one hook array per whole class and use different hook-methods
> in each Method
>
> 1 only initialises a hook object if realy used, so if a method is not
> called, the hookObject isn't initialised. If you use more than one hook,
> more Hook Objects are created.
>
> 2 initiallises all hook objects for the class at creation of the class
> object
>
> (I think in general the internal costs of creation of the hook objects
> are in both cases almost the same)
>
> The Core uses Method 2, method 1 could be more elegant in the way of
> coding it.
>
>
> Which way should I use?
>
>
> Mit freundlichen Gruessen
More information about the TYPO3-dev
mailing list