Let's say I have the same instance of a List injected at multiple different classes across my code. Is it bad practice to manipulate the list (e.g. add/remove items) from within one class so that the other classes can work with that new state of the List? It feels like this practice can lead too many unexpected behaviours? Or should I not "communicate" via injected member fields? What would be an alternative solution?
Aucun commentaire:
Enregistrer un commentaire