in reply to Re: Event based programming: Callbacks or "Interfaces"?
in thread Event based programming: Callbacks or "Interfaces"?

I think that the flexibility afforded by the interface style is by far a more effective technique.

IMHO (using several C++ GUI libraries), it really depends on what you have to provide to your users:

Interface based framework implies exposing the whole framework to the end user application which is tied to it. This also could be problematic with portability requirements.

Callback driven framework enables you to have a centralized event handling and to use finite-state machine if required (i.e. the same sub handles all the events of a form and its widgets).

The object definition features of the choosen implementation language is also a constraint. Very often, using hierarchy of objects implies needing runtime type information, introspection, persistence,... Things and behaviours which are not always available natively nor easy to implement (I'm thinking of C++ and more generally of all compiled languages).

Anyway, the two systems can co-exist... :-)

HTH, Dominique
  • Comment on Re: Re: Event based programming: Callbacks or "Interfaces"?