Refactoring Legacy Code

Recently, I have been working on finding an optimized way to refactoring legacy applications code. The incentive to this work was the so many failures in refactoring legacy applications. Such attempts usually ended up with re-writing the whole application from scratch.

In this recent work, I have came to a model which is partly built around the 3Q's method described in this blog [update, the method is updated several time after this blog, and is published at this link]:
3Q's Method: Measuring the Progress of Code Refactoring
Then, I have gone through two experiments with two legacy applications. Through this work, the model have matured more and more. Now, it is time to give you some hints about refactoring legacy code:

First, this is an idea of how we should view technical debt:
Technical debt is not bad!
This is an old blog, in which I was speculating on how managers should respond to requests to refactor code by development teams:
Take your time to pay for this technical debt, but let me know how you would prevent it in the future!

Blogs Related to Quick-wins Stage

Setup and detect code duplicates using ConQAT. This blog is a guided tutorial about setting up eclipse:
Detect Code Duplicates Using ConQat
The next one focus on how to detect exact and similar clones. This will assist the team prioritize code clones for refactoring:
This next one is about continuous review, which is a continuous activity which should take place in all stages. At this blog, I give example of how to use continuous integration tools like Jenkins to enable continuous review:
Integrating Jenkins and ConQAT to Enable Continuous Clone Detection

Blogs Related to Divide & Conquer Stage

The following blog explains how to discover and split code into components using a simple and logical method:
Also, this is a blog which explains a step-by-step method to detect architectural violations using ConQat:
Detect Architectural Violations Using ConQAT
 Keep alert, I will keep blogging on this topic!

1 comment:

Jordan L. said...

Mock framework like Mockito and PowerMock can do the same thing with an easy way. But do not use too much. In the test environment, the error possibilities caused by thread safe are very very low. But we have to know that SimpleDateFormat should not be a member variable in the most of time.