Chapter 10. Stop writing legacy code!
This chapter covers
- Applying the techniques you’ve learned to new code as well as legacy code
- Writing disposable code
By now you should have a good idea of how to start tackling any neglected legacy code that you inherit and nurse it back to health. We’ve looked at rewriting, refactoring, continuous inspection, toolchain updates, automation, and a whole lot more. But you probably spend at least some of your time writing new code as well. You may be wondering whether all code is doomed to become legacy, or if there’s anything you can do to prevent the code you’re writing right now from becoming somebody else’s nightmare in a few years’ time.
We’ve covered an enormous range of material over the last nine chapters, but a few key themes kept appearing throughout the book, either explicitly mentioned or implicitly assumed. We’ve been discussing these ideas in the context of legacy code until now, but a lot of them are equally applicable to greenfield projects. These themes, which I’ll recap in this final chapter, are as follows:
- The source code is not the whole story.
- Information doesn’t want to be free.
- Our work is never done.
- Automate everything.
- Small is beautiful.
Let’s look at them each in turn.