An interface can change at runtime, whole new classes of behaviour can easily be brought to bear with just a few keystrokes, etc, technique much harder to achieve through static coderef's.
I don't think this is true myself. With a callback based model it's trivial to produce one-off callbacks without having to create a whole separate class that may be overkill. Closures and anonymous subroutines give you a heck of flexibility at runtime.
Personally I would use a class based approach if cutting up the domain into classes made sense (do you have common behaviour where inheritance would make sense, are you creating multiple instantiations of the same sort of objects, etc.) Otherwise callbacks would probably be best.
In reply to Re^2: Event based programming: Callbacks or "Interfaces"?
by adrianh
in thread Event based programming: Callbacks or "Interfaces"?
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |