In a recent column in ACM Queue, Kode Vicious (aka George V. Neville-Neil) answered a reader’s question about removing code from a system.
“Code removal,” Kode Vicious says, “is like cleaning house, only sometimes you clean house with a flamethrower, which, honestly, is very satisfying. Since you're using a version-control system (you had better be using a VCS!), it's very easy to remove code without worry. If you ever need the code you removed, you can retrieve it from the VCS at will.”
Kode Vicious advises that “if you have truly dead code that can no longer be reached from anywhere in the system and that is not simply conditionally compiled-out test code ... then that code should be removed immediately. A good compiler or other tool will tell you when you have dead code, which should make the job fairly straightforward.”
He notes the difference between dead features and dead functions and addresses potential complications.
If you enjoy Kode Vicious, check out The Kollected Kode Vicious book, recently published by Addison-Wesley Professional, in which Neville-Neil “offers practical takeaways for newcomers and veterans alike.” Topics include:
- The Kode at Hand: What to do (or not to do) with a specific piece of code
- Koding Konundrums: Issues that surround code, such as testing and documentation
- Systems Design: Overall systems design topics, from abstraction and threads to security
- Machine to Machine: Distributed systems and computer networking
- Human to Human: Dealing with developers, managers, and other people