Skip to main content

Rewriting and/or Refactoring Software - Recommended Reading

As time goes on, the world is becoming more-and-more automated by software. This essentially also means that there is an exponentially growing surface-area of legacy application code. This matter is especially pertinent to older software product companies, which may have deep bases of legacy of code to grapple with.

Here are a few recommended readings for those who deal with legacy code...

Refactor vs. rewrite


Joel Spolsky wrote the following article way back in 2000, entitled "things you should never do, part 1":

http://www.joelonsoftware.com/articles/fog0000000069.html

Spolsky is a very good writer,  and expresses simple ideas very well. This article says that it can easily become a strategically disastrous move to rewrite an application from the ground-up. Spolsky recommends against doing that, if at all possible.

On the other hand, there Dan Milstein prodives a counter-argument to Spolsky's, in the following recent response (only 13 years later!):

http://onstartups.com/tabid/3339/bid/97052/Screw-You-Joel-Spolsky-We-re-Rewriting-It-From-Scratch.aspx

The "strangler application"


Martin Fowler also gives us some options around how we can better manage the replacement of legacy software with new software, by applying the "Strangler Application" pattern:

http://www.martinfowler.com/bliki/StranglerApplication.html

Coined by Martin Fowler, this pattern enables the gradual phase-out of a pre-existing codebase into a new one. Fowler of course makes it sound far, far easier than it actually is (or would be). Like Spolsky though, his thinking is clear and he makes a good point.

A recent article (July 2013) written by Paul Hammant discusses a few "strangler application" initiatives that he has been involved with at ThoughtWorks:

http://paulhammant.com/2013/07/14/legacy-application-strangulation-case-studies/

If you read nothing else in Paul Hammant's article, go to the the "best practices" section at the end and just read that.


Technical and innovation debt


Ward Cunningham introduced us to the concept of technical debt as early as 1992 - really this is just a version of the old economics mantra of "no free lunch", translated to software engineering:

http://www.c2.com/cgi/wiki?TechnicalDebt

Then Peter Bell reminds us of the perils of not taking the opportunity to aspire to the cutting edge and resting on our laurels (that is, current/former market success), with his article on "Innovation Debt":

http://blog.pbell.com/2013/03/19/innovation-debt/

Innovation debt is essentially technical debt, but applies to people, processes and businesses - instead of nuts, bolts and code.

Refactoring legacy code


Michael Feathers provides us with some highly recommended reading on refactoring and working with legacy code in his book of the same name (I've bogged/reviewed on this book here previously):

http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052

Feathers defines "legacy" code as essentially being any code that is untested or currently untestable.

The book is written in the style of the "Gang of Four" Design Patterns book - there are three sections; the first sets the stage, introducing Feathers' reasoning, definitions, and some tools. The second section is scenarios (essentially suggestions as to how to apply patterns to deal with problems, like "My Application Is All API Calls") and the third is a reference for a stack of dependency breaking patterns.

Of course, there is also Martin Fowler's original book on refactoring:

http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/

To me, Feather's book however seems to be a much easier read.


Comments

Popular posts from this blog

HOW-TO: Add/edit a field in Team Foundation Server 2012 using Visual Studio 2012

It's been a while since I made a purely technical post...

So, today I wanted to make a change to a Microsoft Team Foundation Server 2012 (TFS2012) instance that I am working with to reflect "Actual" time spent on a task - mainly for reporting purposes, and because I have found in the past that making this minor process adjustment yields a relatively useful metric over the long-term.

I am using the Microsoft Scrum 2.1 Process Template (http://msdn.microsoft.com/en-us/library/vstudio/ff731587.aspx) for a project that I am working with. So that I don't forget how to do this (again!) I will blog-post the procedure I've used to add this field to the template as a screen-shot-based tutorial, as follows...
Before Assuming you are familiar with the Scrum Process Template (2.1-ish) - open a task and take a look at the "Details" section, as follows:


 This is where I want my "Actual" field to show up.
Get the Power Tools Download and install the latest v…

HOW-TO: Apply a “baseless merge” in Team Foundation Server 2010 (and 2012)

Another purely technical post on TFS...
The scenario We wish to migrate code between branches that do not have a branch/merge relationship, in order to expedite urgent changes being made by a project team, without disrupting on-going BAU development work. Sample branch hierachy/strategy Imagine the following branching strategy in TFS (visible by connecting to TFS via Visual Studio 2010 or 2012):

Essentially you have a "DEV" branch, which has a "QA" branch, which in turn has a "PROD" branch. DEV is the branch that you would be using for BAU development. As a piece of development matures, you move it into QA, where it is tested by your internal QA team. There may be further changes made in DEV that are moved into the QA branch as the QA team pick up issues. Once the QA team are happy with a packaged of changes, they will move them into PROD, which is essentially the hand-over to the customer. The PROD branch represents the software that the customer has.

Mo…

Eclipse/Android error: "Multiple dex files define [...]"

Wow, I am really going nuts blogging this-evening - 2nd post in less than an hour. 


Anyway this is a particularly nasty error that I keep running into with Eclipse/Android when starting the emulator after I have not run it for a little while. Since I run the risk of permanently forgetting the solution to the problem every time I walk away from my Android project (and thus having to spend a painful hour-or-so digging up the procedure again), I will blog it here, for my benefit, and for the benefit of anyone who may also suffer the same problem.


The gist is that when you start the emulator in debug mode (that is, you hit the button in the following image), you get the following error message come out on the console and a nasty popup telling you nothing more than there is an error with your program and you need to fix it:








[2012-04-06 23:20:57 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/gson/ExclusionStrategy;
[2012-04-06 23:20:57 - SimpleList] Conversion to Dal…