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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 251k
  • Answers 251k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Probably both a bug and a feature. XML 1.0 is… May 13, 2026 at 9:35 am
  • Editorial Team
    Editorial Team added an answer Here's how we implemented this for the DjangoDose live feed… May 13, 2026 at 9:35 am
  • Editorial Team
    Editorial Team added an answer Assuming you're getting no rows returned (you don't really say… May 13, 2026 at 9:35 am

Related Questions

I am trying to monitor genuine page hits. Here is what my site does.
I have two SQL Server 2005 instances that are geographically separated. Important databases are
I'm calling a .net webservice from Linux using Perl (5.8.7). I'm using the SOAP::Lite
Coming from an academic background in mutli-agent systems (developed in Java using JADE )

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.