lundi 2 février 2015

Does the Observer pattern violate single responsibiliy principle?

If an application utilising the Observer design pattern has a subject class with the following responsibilities:


1) Managing and notifying observers (i.e. providing register and unregister functions and calling all observers notify functions) and


2) Its original responsibility (i.e. what ever the class was doing before it was a subject).


Does this class violate the Single Responsibility Pattern? It clearly has more than one responsibility but reading up on the SRP I am confused wrt 'reason for change' is this change at design time or run time?


Aucun commentaire:

Enregistrer un commentaire