mercredi 18 mars 2015

How to design the dependency for a object being accessed by lots of classes, if not using Singleton?

I have a "member status" object needed by lots of classes, for the UI and behavior of my app. change a lot when the "member status" is different(online, offline, invisible).


I used Singleton to implement it, but now the coupling is high and harder to do unit tests properly.


Is there a good design pattern for this(mediator or facade maybe?), or I have to do Dependency Injection to more than 20 classes?


Aucun commentaire:

Enregistrer un commentaire