Thread: Hook System
View Single Post
Old 11-05-2007, 04:44 PM   #6 (permalink)
Karl
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

There are many ways to do a "hook" system, one approach could be similar to this:



The whole process would work like this:
Client asks HookController to execute a hook (using getHook())
HookController asks the specified Hook (i.e. LoginHook) to execute.
After Hook execution any return value is returned to the HookController which is in turn returned to the Client.

The system could easily be extended to support plug ins and "families" of hooks - allowing you to group hooks into products.
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote