Monday, 9 September 2013

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.


No comments:

Post a Comment