3

I tried searching for the disparities between Event-Delegation Model and Event-Inheritance Model but did not find answers concrete enough to distinguish the two.

What is the real differences between these two models, and at what instances are they considered effective solutions?

mKorbel
  • 108,320
  • 17
  • 126
  • 296
Bitmap
  • 11,549
  • 13
  • 58
  • 87

2 Answers2

2

As best I understand, the event inheritance model has the initiator send all messages to all observers. The observer is responsible for deciding which messages apply. The advantage of this model is that multiple observers can process the same message. The disadvantage of this model is that it quickly gets complex when you have lots of initiators and observers.

The event delegation model requires observers to register with the initiator. If the initiator has only one registration method, than this is analogous to the event inheritance model. When the initiator has more than one registration method, then the initiator has the ability to send messages to just the observers that need the message. The event delegation model scales better when you have a lot of initiators and a lot of observers.

Gilbert Le Blanc
  • 45,374
  • 5
  • 61
  • 107
0

Event-delegation model has two advantages over event-inheritance model.

  • It enables event handling by handling the objects other than ones which were generated by the events or their containers. It clearly separates component design and its usage.

  • It performs much better in applications where more events are generated. It is because of the facts that, this model need not process unhandled events repeatedly, which is the case in event-inheritance model