Build Refactoring into Your PracticeKnowing how to refactor isn't worth much unless it's applied. Resolve to make your code lean and clean. On an XP team, this is part of everyday life. But even approaches that are heavily design driven expect programmers to implement the design well. Build Testing into Your PracticeThere's an old adage (as so many are), "If it ain't broke, don't fix it." (How many times has that last simple change caused an unexpected bug?) In programming, the downside of applying this adage is that the code just gets uglier and uglier. Refactoring is willing to go against this rule through two mechanisms: safe refactorings and a supply of tests to verify that the transformations have been done correctly. Don't neglect your tests. Get Help from OthersGet other people's opinions about your code, whether through pair programming, design/code reviews, or simply bugging your neighbor. One of the things that really got hammered home to me in writing this book is that almost any code can be improved (and sometimes we get to take advantage of the whole Internet's worth of help!). |