Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 617105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:23:55+00:00 2026-05-13T18:23:55+00:00

A Subject-Observer relationship isn’t a dependency relationship: Observers don’t need Subjects in order to

  • 0

A Subject-Observer relationship isn’t a dependency relationship: Observers don’t need Subjects in order to exist, and vice versa. Yet the “wiring together” of publishers and subscribers is strongly reminiscent of Dependency Injection.

My shoot-’em-up game makes extensive use of the Observer Pattern. For example:

A controller object spawns a player ship object at the beginning of each round. The controller calls upon a factory to provide the ship. The ship depends, among other things, on a reactor object that can overheat and destroy the ship. The factory injects these dependencies. So far, so good.

Now, the HUD needs to know about the status of the ship, particularly the reactor temperature, but the HUD does not depend on the ship in the DI sense: the HUD persists after the ship is destroyed.

The question is, assuming the controller does not possess a reference to the HUD, how can I get the HUD in touch with the ship? And this is just one teeny, tiny example. I have lots and lots of objects that will need to pass events to one another.

I feel like I could do some of the wiring in the factory, but that feels “wrong”, and doesn’t help in situations where existing subscriptions need to change.

Anyway, everything I’ve read about the Observer Pattern ignores this broader issue. Is there an established solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:23:55+00:00Added an answer on May 13, 2026 at 6:23 pm

    You may want to explore using something more general purpose like an “event aggregator” or a central messaging/event disaptching mechanism to do this. That way your HUD can simply subscribe the the event types it cares about, your ships can raise/send those events as necessary, and neither really needs to know about the other. This is one way to decouple things nicely.

    Couldn’t find a good all-in-on link for you, but here’s a discussion of the idea as it relates to a winforms application: http://www.lostechies.com/blogs/derickbailey/archive/2009/12/22/understanding-the-application-controller-through-object-messaging-patterns.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Observer pattern: There are 2 variants of it. Where Subjects informs all the observers
In the Observer Design Pattern , the subject notifies all observers by calling the
In a GC enabled language, when observer subscribes to events of subject, actually subject
We all know the observer pattern : You have a subject which is able
Observer *o = New Observer(); Subject *s = new Subject() ; s->register(o); //Is it
I have observer.h , client.h and field.h files. In observer.h there is Subject class
I have a order beverage type program. I am tryig to implement observer pattern
I'm trying to write an object relationship that follows an observer pattern where the
I have used Observer Pattern for my application. I have a subject which has
I am trying to implement an observer pattern with a template subject class. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.