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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:06:16+00:00 2026-05-30T04:06:16+00:00

This is a general design question that I’m currently hung up on. It is

  • 0

This is a general design question that I’m currently hung up on. It is causing a bit of a mental code block… I don’t want to continue with it like this if it is simply a common pitfall, but I’d like to continue if it’s accepted usage as the code is quite clean and decoupled (barring the cross-cutting messages).

I have a list-based publisher / subscriber pattern in code that I use to allow arbitrary sections of code to send messages that unknown subscribers can listen to. Fairly straightforward.

One of my current use cases for this pattern is to spin up a UI status indicator showing the user the application is busy. There is a message before work starts, a repeating message for progress, and a message for completion. It seems clean, the lower levels of code only publish messages and care not for listeners.

The starting message drives the UI initially; it shows a marquee progress bar in the status bar of the main form. The completion message hides this progress bar. Update messages are represented as text in a label.

Without realising at the time, I made the UI dependent on the order of these messages. The UI relies on the start and completion messages in order to reflect the UI correctly. The “statefulness” I refer to is on the subscriber side (the messages themselves do not retain any state).

Is this usage going against the pub / sub pattern? If so, is the issue the reliance on message order? If not, then good, I can carry on 🙂

  • 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-30T04:06:17+00:00Added an answer on May 30, 2026 at 4:06 am

    In your example, the sequential coupling code smell may be coming from your subscriber knowing too much about the inner workings of the publisher (i.e. When one starts, the other starts).

    You can reduce the coupling by reducing the information in the message or by having the subscriber not take advantage of the temporal sequences of the messages.

    For example, have the subscriber execute the same routine for the begin and in progress messages, reducing the resolution of the message to “WORKING.” The UI subscriber can spawn the dialog if needed or update it if it already exists. It’s the UI subscriber’s job to manage the lifetime of the dialog box, not the application’s.

    However, this small smell is probably not enough to start convoluting the messages between the application and the UI subscriber.

    Alternatively, you could make your subscriber robust enough to Do The Right Thing regardless of the sequence of messages that are called. Start, start, process, end, process, start, etc. The subscriber’s responsibility should be managing the progress dialog box…to do the best it can no matter what crazy messages are coming from the application.

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

Sidebar

Related Questions

This is a general design question about how to make a web application that
This is a general question of sorts, but do you think that it's important
This is more of a general design question, but it will be implemented in
just a general design question that I'd like to hear some of your opinions
This is more of a design question that others may have had similar experience
Just a general database design question - no programming, but a bit of problem
This is a general software design question. Is it a good idea to use
This is a general DB design question. Assume the following table: ====================================================================== | product_translation_id
Although I'm programming in C++, this is more of a general question about design.
This is a general question about design. What's the best way to communicate between

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.