mercredi 30 décembre 2015

Observer Pattern with events instead of parameters (Push-Model)

Right now I am trying to fully understand the concept of the Observer Pattern.

To my understanding (correct me if I am wrong): It is recommended to use events instead of parameters if you have different Observers who needs a different set of parameters and you dont want your updateFuntion to contain all the variables

=> unnecessary data transfer in the updateFunction

=> problems when updateFunction needs one more parameter (you have to change all the Observers)

Can you explain to me how using events will solve this problem and how this is implemented? (perhaps in Java?)

Aucun commentaire:

Enregistrer un commentaire