The Blog

Strangling legacy code

published November 30, 2009

How do you refactor a legacy module which is used by many clients? Well, you strangle it. In a picture below we have two clients using some legacy code that we want to get rid of.

legacy-code-1

You start by creating a new interface and switching part of the usage to that interface.

legacy-code-1

Gradually, you refactor parts of your legacy code and move more clients using the new implementation.

legacy-code-1

In some point, you have managed to move all usage from the legacy interfaces to the new implementation, but you still might be using the legacy implementation under the hood.

legacy-code-1

The final step is to completely remove legacy code once you got all your necessary features refactored.

legacy-code-1

And actually delete all your legacy code, I do not want to see huge code blocks commented out “just in case we need this in the future”. You don’t. And if you do, you still find it in your SVN, right?

Samuli @ 22:46 (No Comments)

tags: ,

Trackback URL

No Comments to Strangling legacy code
top











b

Subscribe to RSS feed

The Tag Cloud
The Blog Archive

January 2013 (1)

February 2012 (1)

January 2012 (1)

November 2011 (1)

June 2011 (2)

May 2011 (1)

April 2011 (2)

March 2011 (2)

February 2011 (1)

January 2011 (1)

December 2010 (1)

November 2010 (1)

October 2010 (3)

September 2010 (3)

August 2010 (5)

July 2010 (2)

June 2010 (3)

May 2010 (4)

April 2010 (2)

March 2010 (6)

February 2010 (7)

January 2010 (3)

December 2009 (7)

November 2009 (6)