I'm a bit confused about this method:
void update(Observable o, Object arg) in java.util.Observer class.
Why should it take an Observable as an argument? For more flexible unsubscription?
I don't really like this idea and consider this to be a bad design. From my point of view the only responsability of Observer is to get updates from it's Observable. When we pass it's observable as an argument, we can controll it from our observer, and I really don't like this idea: when a more low-level component has a control on high-level component.
So, is the only reason for this design is providing more flexible unsubscription, or am I missing something? If so, don't you think, that we pay too much for such a flexibility?
Aucun commentaire:
Enregistrer un commentaire