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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:13:10+00:00 2026-05-13T12:13:10+00:00

UPDATED: I have a desktop application, with the following components interacting: Winforms UI. Service

  • 0

UPDATED:

I have a desktop application, with the following components interacting:

  • Winforms UI.
  • Service (in-process C# class that contains business logic to actually do stuff).
  • Controller (C# class that coordinates events raised by the UI and calls service methods).

If a controller asks a service to do something, but that service needs something more from the controller first (i.e. data that the controller must use a UI to obtain from the user), how should the service get the controller to do so?


I’m comfy with the concept that

  • User communicates with
  • UI which communicates with
  • Controller which communicates with
  • Service component (not to be confused with a web service or out-of-process service) which communicates with
  • Data/Repositories which comm…

and so on.

However, with regard to the Controller communicating with the Service, what method is best for this? Should:

  1. Service methods be fairly fine-grained, and throw exceptions if something’s not right so the controller knows whether to move on or tell the user something went wrong? Or…
  2. Service methods return objects that the controller can inspect to decide what to do next?

I like the first option, because the second could mean class-explosion, where you need a ServiceResult-style class for each Service method.

I ask because of course the Service component cannot tell the UI what to do, only the controller can, but the controller doesn’t know what to tell the UI without getting some feedback from the Service.

What do you think?

  • 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-13T12:13:10+00:00Added an answer on May 13, 2026 at 12:13 pm

    Your best option is probably to use an event or delegate model – eg the controller subscribes to a ‘needs more information’ event and displays the appropriate form. Returning the additional data to the service could be done a few different ways, but would largely depend on the specifics of your design (eg are your services stateless etc)

    Have you written unit tests for your service? If not, this process will probably help you clarify what you want out of your design.

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

Sidebar

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.