4 ms·
In order to observe an Observable object, you need to have a reference to it. Adding an Observer to something that you shouldn't isn't possible without introduc
by acbabis 11y ago
In order to observe an Observable object, you need to have a reference to it. Adding an Observer to something that you shouldn't isn't possible without introducing it as a dependency. If someone does inject something so they can observe it, it's easier to spot the coupling.
It sounds like the legacy code you got stuck maintaining put logic inside the observers, which isn't the Observer Pattern's fault. In my own experience, not using event patterns like the Observer Pattern is probably the biggest cause of difficult-to-maintain code.