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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:04:22+00:00 2026-06-15T18:04:22+00:00

Something I’m running into working on a very simple application that’s part of a

  • 0

Something I’m running into working on a very simple application that’s part of a school project.

It’s a very basic console based employee management system where you can add 4 types of employees (full time, part time, contract, seasonal, all with a couple different attributes.)

The problem I’m having is when displaying a menu for modifying a specific employee type.

Doing a switch statement on the employee type is obviously quite bad design, but adding “DisplayModificationMenu” to each employee class so that it can display its own menu also seems terrible, because displaying a menu doesn’t seem like an appropriate responsibility for an employee object itself.

What’s the best approach to solving this design issue? I have considered creating a Menu class and subtype every menu so each one can display itself, but even then I feel like a switch on the type would still occur somewhere to decide which menu to instantiate.

The workflow to modify an employee is select an employee by their ID, and then the correct menu for that employee type should display. So even with the subtyped menus, it seems you’d have to check the employee type before you knew which menu to instantiate.

Thanks in advance for any advice.

  • 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-06-15T18:04:23+00:00Added an answer on June 15, 2026 at 6:04 pm

    I think doing switch on type of an object is not a problem, as long as it is encapsulated, documented and understood properly.

    In your case, you could make DisplayMenuFactory, that would accept abstract employee object and return abstract Menu class. And inside, it would switch based on employee type and return concrete Menu class for each type. And, if you end up having different factories, that have same switching mechanism, you can merge them together and this switching will happen always in single class. So responsibility for creating different UIs for different employees will be in this single class.

    The second option is to have Employee class that has GetMenu method, that would return concrete Menu type for each employee type. But this is mixing model and UI, which is not something I think is acceptable in this case.

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

Sidebar

Related Questions

Something seems to happen with my Xcode. When running the project for the first
Something basic that i don't understand: I have header.php with navigation bar for my
Something that seems to be absent from the otherwise great new features for Windows
Something that I think is really strange is happening when I use die() .
Something like my_model.data_dict['my_field'] Which would give you the current value for that field? Need
Something happens in my system on a worker thread. Let's say that the state
Something that I see people doing all the time is: class Man(object): def say_hi(self):
Something really weird has happened to my source code. The application always built successfully,
something here ; and there, oh,that's all! I want to split it by ;
Something I've noticed from looking at multiple .NET starter kits is that business object

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.