From Design Pattern by Gang of Four
Why are field observers
, and methods Attach
, Detach
and Notify
are in the interface Subject
, while methods GetState
and SetState
and field SubjectState
are in the concrete subclass ConcreteSubject
? Why are the members distributed in the subject interface and concrete subclass as they are?
Why is method Update
in the interface Observer
, while fields subject
and observerState
in the concrete subclass ConcreteObserver
? Why are the members distributed in the observer interface and concrete subclass as they are?
There doesn't seem to be symmetry between subject and observer. For example, why does field observers
belong to interface Subject
, while field subject
belong to ConcreteObserver
?
Thanks.
Aucun commentaire:
Enregistrer un commentaire