[Typo3-dev] OT: Hooks, was: Pledge fo 3.8.1
Michael Scharkow
mscharkow at gmx.net
Thu Jun 2 20:35:32 CEST 2005
Dimitri Tarassenko wrote:
> Am I the only one thinking that "hooks" are a sign of bad decoupling
> in software? The more I look at how and where the hooks are used, the
> more I think that whenever a hook is required and implemented what
> really needs to be done is the method containing the hook needs to be
> split in several and one of these submethods should be iplemented in a
> subclass.
Can you elaborate on this? I don't see how putting a method in a
subclass (btw. we're subclassing exactly what?) works for hooks. Hooks
are only only "announcing" that there is some data available for
processing, but they know nothing about who "answers". The difficulty
for the core code would then be to know when to use subclass Y instead
of Z, right?
> These "hooks" are going to be nightmare to manage and debug once their
> number (and number of extensions that may use them) grow.
I'm not sure how much effort it really is to maintain some two-line hook
which is embedded in some method. And while there might me scalability
issues with the number of hooks in the code, the number of extensions
using them should not matter to the author of the hook code itself
(given API stability).
Anyway, I'd be interested in a better concept that is flexible but not
quite as hackish as XClassing...
Greetings,
Michael
More information about the TYPO3-dev
mailing list