Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm rewriting a vehicle tracking application, a google maps based thing..

The users are able to search for a vehicle by typing a few characters of the vehicles "callsign".

My application is based around a sort of "event bus" within Backbone.. when a search occurs I send a message on the bus saying something like "does anyone match this?".. If a marker matches the search term it responds with a sort of "yes, I match!"..

My challenge arises when no-one matches, I get no response.. it feels a little hacky to "wait a little while" and check if a response has been recieved..

The application is based around Backbone.js and using the Event Aggregator pattern described in the answer to this question on Stack Overflow:

Is there a well defined design pattern that might assist me here? Sending a request for a response and not getting any responses?

share|improve this question
not a pattern, but design principle (that worked great for me in cases like that): expiration by timeout should be first class citizen in your application. Designed and carefully thought out from the scratch, easy to use by developers, easy to maintain by supporters (configuration, logging, audit trail...) and easy to understand by end users: "no response from vehicle in 5 minutes, timeout expired. Retry, cancel?" – gnat Nov 1 '12 at 7:54

Could they not all reply with a NoResultFound message?

You know how many domains you have, so if they all reply with NoResultFound, then you'll know what to do.

I guess this depends on the UI that you have. Assuming your UI has a list of search domains, then once the result comes back from each domain, you can display it to the user:

  • DomainA - Searching...
  • DomainB - No Results Found
  • DomainC - Searching...
  • DomainD - No Results Found
  • etc
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.