Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • I don't see how observer pattern could help me. If I could connect one object to another (and have one be observer and other be subject), then wouldn't I also be in position to just simple pass the data from one to the other? I guess you could say that the data isn't ready at that point, but if I passed a reference to the object where the data would be stored, then it would be there. So I don't see how observer pattern could help. Commented Nov 1, 2017 at 20:17
  • The other example you gave of passing data via files, databases, or in memory database, seems just as bad, or worse as setting the object to be a singleton in the injector/container. Both ways have the singleton problem, but using external ways of storing the data just causes more places for failure, more latency, and more things to manage. Commented Nov 1, 2017 at 20:18
  • 1
    @JacobBrown These are the two ways to solve your problem: a) establish communication directly via sharing a reference somehow or b) establish communication indirectly via an "external" component. This may be a form of persistence or in form of a mediator. Commented Nov 2, 2017 at 8:38