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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:50:45+00:00 2026-05-13T05:50:45+00:00

Let’s say you got a project that is really poorly written, contains lots of

  • 0

Let’s say you got a project that is really poorly written, contains lots of code smells, wtfs, etc. Moreover, its code structure is so complicated that it is extremely hard to add any new functionality to it. On the other hand, the project works as it is supposed to.

You want to refactor the project, perhaps move it to a new framework, how would you approach this problem? Will you try to build a new one from scratch or use some techniques (specify) to convert the working project into a new one?


I would like to clarify the question a little bit as there is a confusion what do I mean when saying “refactoring”.

I’ll give an example about a car, think of it as a software project. Let’s say you have built your own car. Its construction is pretty weird: engine is upside down, thus all the pipes are laid differently, electricity wires are tangled together and nobody has an idea where do they start or end, etc.

However, everything is working fine: you can easily ride it to shop, work, etc. However, its fuel consumption is a bit too high. Also, if you ever wanted to install new headlights to it, it would be a disaster with all the mess in the wires.

You cant afford buying a new one, so you have to refactor the car somehow: change engines position to normal, make the wires tidy, etc. You need to do this, because sooner or later you will need to change engine, headlights, install new stereo etc.. On the other hand, you still need something to drive you to work every morning, so you must make sure that you don’t screw everything up.

Now let’s go back to the project. How would you refactor the project as complicated as the car above, while not disturbing its primary function and purpose.


I would also like to make this a community wiki. Please edit.

So far the main tendencies are:

  • Don’t write a new one from scratch
  • Unit test the hell out of it, then start refactoring small pieces
  • Read Working Effectively with Legacy Code (Robert C Martin)

Links:

  • Working Effectively with Legacy Code (Robert C Martin)
  • http://www.joelonsoftware.com/articles/fog0000000069.html
  • Refactor the low-hanging fruit.
  • 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-13T05:50:45+00:00Added an answer on May 13, 2026 at 5:50 am

    Working is the only kind of project you should be refactoring. If you’re fixing bugs, you’re changing the behavior, and refactoring is explicitly about not changing behavior. But working has different definitions. The good one – the useful one for refactoring – is well-unit-tested. If you’ve got good test coverage (automated tests!), you’re ready to refactor. If you don’t…

    Read Michael Feathers’ Working Effectively with Legacy Code. Nibble away at the code. Pick a WTF that particularly offends you, and test the hell out of it, with automated unit tests. Then replace the WTF with something reasonable, ensuring that the tests continue to pass. Lather, rinse, repeat.

    Refactor the low-hanging fruit.

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

Sidebar

Related Questions

Let's say i have this block of code, <div id=id1> This is some text
Let's say I have window.open (without name parameter), scattered in my project and I
Let's say I have this code: <p dataname=description> Hello this is a description. <a
Let's say I have multiple requirements for a password. The first is that the
Let's say that I have a date in R and it's formatted as follows.
Let's say that I have a model that handles recipes, and I want to
Let say I have some code HTML code: <ul> <li> <h1>Title 1</h1> <p>Text 1</p>
Let's say that I have a set of relations that looks like this: relations
Let's say you have a class called Customer, which contains the following fields: UserName
Let's say I'm writing a PHP (>= 5.0) class that's meant to be a

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.