mercredi 26 juin 2019

Alternative to Observer Pattern where both Subject and Observer represent the same entity?

I basically have a node class in my project, to which other nodes can subscribe. As such, if I were to implement the observer pattern here, that would entail that this node class would end up being the subject as well as the observer. I looked at similar design patterns but I was unable to find something that suits my needs. Does the observer pattern work here, even though the node class will have to implement both subject and observer interfaces or is there a more adequate alternative that can be used? Thanks.

Aucun commentaire:

Enregistrer un commentaire