In the GoF definition of the observer pattern there is a single subject and multiple observers. This works well because the observers know what kind of data to expect from the subject.
If you had multiple subjects interacting with a fixed set of observers and each subject returned different types of entities/data types, how would you communicate that data to the observers without having to resort to writing very general interfaces that you then have to correctly cast in the observers?
Aucun commentaire:
Enregistrer un commentaire