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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:00:59+00:00 2026-05-31T12:00:59+00:00

This application was written without any knowledge of design principles (SOLID) by the previous

  • 0

This application was written without any knowledge of design principles (SOLID) by the previous developer. The most critical issue of the app is that it has god class with lots and lots of switch statements. This ill-advised structure makes it hard to maintain the app. Of course, there is no unit testing at all.

First on switch statements, I found there are two main potential classes that varies over the application. So I will try to first construct those two classes and move the corresponding code to the classes from the god class. Is this a right way? What is a good process to attack this issue?

BYW, I have the book “Working Effectively with Legacy Code”. So you can suggest which part of the book I have to read for this too 🙂

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

    Switches are an obvious refactor target. But there could be others. You give uslittle to go on.

    I often spend a great deal of time massaging the code, rewriting it such that I can change the type used by commenting/uncommenting a few lines.

    For a swich on an enum, it can be useful to define a struct that contains one member: the enum value, and has an implicit conversion to the enum value. Using typedefs or macro, you can make sure that your new type is passed around in stead of the enum. If that has undesired side effecs, revert, fix the implementation, and try to use yournew type.

    Next, move the switch code to a member function of the new type, one switch at a time.

    If unit tests are required in the process is up to you.

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

Sidebar

Related Questions

I have this application written in java to calculate pageranks. And the application takes
I have an application written in a language called magic. This application uses MSSQL
Assume i have a custom Windows application written in C#. This application has only
We've got this large application written in Delphi 5, and development is ongoing to
I have an existing application that is written in C++ for Windows. This application
I have this code in my ASP.NET application written in C# that is trying
I need a little help on this subject. I have a Web application written
I've written an application that runs flawlessly in windows, and throws this error on
This is my first major application using multiple classes. It is written in vb
In our application, I have seen code written like this: User.java (User entity) public

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.