samedi 30 juillet 2016

Why interface is used in observer pattern?

I have read in the book that the application layer is supposed to be independent of the presentation layer. Design pattern are solution to problem like that. Observer pattern is applicable when an object should be able to notify other objects without making assumptions about who those objects are.But a method such as addObserver adds the observers to the list of observers. After that, observerable know which objects are to be notified. And how those list are used? In the book I read, it said that the observerable only access observer through the interface defined in the application layer so that the layer architecture of the system is preserved. Then the interface use that list? lf so, what is the difference?

Aucun commentaire:

Enregistrer un commentaire