[TYPO3-core] Signals vs. Hooks

Bernhard Kraft kraftb at kraftb.at
Sun Aug 24 15:20:02 CEST 2014


Hi,

Just wanted to know what the current status of using/creating new hooks 
is. I know there are signals and I like the concept and how they got 
implemented. If one can simply inject a SignalSlotDispatcher they are 
really easy to use.

But sadly there purpose is mainly to inform about some event occured and 
let other pieces of code handle those events. But they are marely not 
designed to return results. Altough the current implementation allows 
this it is not very comfortable.

Indeed, the GoF rather propose the "Template method" pattern for this 
purpose instead of the observer (signal) pattern:
http://en.wikipedia.org/wiki/Template_method_pattern
http://de.wikipedia.org/wiki/Schablonenmethode

There are currently some hooks which require the hook-class to implement 
some interface which tends to already move into this direction. I think 
what is now missing are some API methods for extension developers to 
register a hook/template method and API methods for the core (or other 
locations where hooks/template methods get called) to ease the call of a 
hook: It is cumbersome to always implement a loop iterating over all 
hook-instances.


Additional ideas, proposals, suggestions?


greetings,
Bernhard


More information about the TYPO3-team-core mailing list