Friday, March 13, 2009

Your code works - but could it be better?

This is a must read for every Object Oriented programmer.

Refactoring: Improving the Design of Existing Code
by Martin Fowler; Kent Beck; John Brant; William Opdyke; Don Roberts


Amazon.com Review

Your class library works, but could it be better? Refactoring: Improving the Design of Existing Code shows how refactoring can make object-oriented code simpler and easier to maintain. Today refactoring requires considerable design know-how, but once tools become available, all programmers should be able to improve their code using refactoring techniques.

Besides an introduction to refactoring, this handbook provides a catalog of dozens of tips for improving code. The best thing about Refactoring is its remarkably clear presentation, along with excellent nuts-and-bolts advice, from object expert Martin Fowler. The author is also an authority on software patterns and UML, and this experience helps make this a better book, one that should be immediately accessible to any intermediate or advanced object-oriented developer. (Just like patterns, each refactoring tip is presented with a simple name, a "motivation," and examples using Java and UML.)

...

.”

A catalog of summaries of refactorings mentioned in the book, Refactoring:
http://www.refactoring.com/catalog/index.html


Review by Matt Stephens at:
http://www.softwarereality.com/reviews/refactoring.jsp

If you're a programmer, it's almost a dead-cert that at some point you have had to make a change to someone else's code. It's also likely that your reaction when trawling through the code was one of abject horror: "What was he thinking when he wrote this 700-line function?"

Whatever the cowboy coder was thinking about, it would have had little to do with maintainability. Attempting to change the code in that state will almost certainly introduce new bugs. It's likely that the cowboy coder was thinking about getting his code working - hacking it to the point where it works - so that he could move on to his next grand masterpiece.

It's this kind of scenario where refactoring can prove to be very useful. It's a fairly safe bet that if you spend a little time carefully tidying up the cowboy code before you start adding to it, you'll save a lot of time bug-fixing later on.

Refactoring is the practice of improving code without changing its meaning. It's the cornerstone (okay, one of the cornerstones) of Extreme Programming (XP). That's not to say that you have to be doing XP to do refactoring. The refactorings described in Martin Fowler's book are equally useful in a non-XP context.

Rest of the review at: http://www.softwarereality.com/reviews/refactoring.jsp