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 162083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:19:41+00:00 2026-05-11T11:19:41+00:00

I have an agent that monitors for certain conditions. For each condition, I would

  • 0

I have an agent that monitors for certain conditions. For each condition, I would like to notify a different observer, because the responsibility for that condition lies with the observer.

The way to do it for a single observer/subject in C++, according to wikipedia, is to create a virtual class (similar to a Java interface), which defines the update method for the Observer, and defines the register method for the Subject. Each concrete class then inherits its respective interface.

However, I can envision this occurring for an arbitrary number of conditions, each of which would require another interface and concrete observer class for each new condition. Does kind of design make sense? Anddoes it sound reasonable to be adding an observer interface for each new condition?

  • 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. 2026-05-11T11:19:41+00:00Added an answer on May 11, 2026 at 11:19 am

    If you compare this to hoe Java deals with events on a GUI component (not exactly the same, but the same general idea), you wind up with something like:

    public void addActionListener(ActionListener listener) { } public void addWindowListener(WindowListener listener) { } public void addComponentListener(ComponentListener listener) {} public void addMouseListener(MouseListner listener) {} 

    all of the *Listener things are interfaces. You then provide one or more classes that implement the interfaces (I prefer one class per listener type, others prefer to make a ingle class that implements all of the listeners).

    This proves to be very flexible because things can register only for the events that they are interested in.

    An alternative is a single ‘addListener(Listener listener)’ method where the Listener interface has every single possible event in it, that would be a bad idea unless you are ok with things being notified about events that they do not care about.

    So, do you anticipate wanting fine grained control over what you can listen for? If so the Java model works well (works ok if you don’t care about it either, it is very flexible). If you think that everything will want to be notified of all events then the single ‘master’ way works too.

    It sounds like you want fine grained control, so I’d be fine with doing it the Java event way of an interface for each general category of events.

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

Sidebar

Related Questions

I have a background agent that i would like to be executed in Mango
I have a Build Agent that was only dealing in .Net 4.0 RC stuff,
We have a team that built an agent in Mono using MonoDevelop on Mac
I have an application that is JMX enabled. It has its own JMX Agent
I'm programming an agent-based simulation and have decided that Boost's MultiIndex is probably the
I have an agent that employs a saga to track incoming messages of a
I have a TFS 2008 Build Agent that has been used to build .Net
I am trying to create an agent-like object, that, given an two indices (agent
here is code that I have: agent = Mechanize.new page = agent.get 'http://google.com' page.save
I have an agent and a server in different domains. The server acts as

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.