Legacy code

Let's start with the definition of legacy code. While there are many authors with different definitions, such as lack of trust in your application or your tests, code that is no longer supported, and so on. We like the one created by Michael Feathers the most:

"Legacy code is code without tests. The reason for this definition is that it is objective: either there are or there aren't tests."
– Michael Feathers

How do we detect legacy code? Although legacy code usually equates to bad code, Michael Feathers exposes some smells in his book, Working Effectively with Legacy Code, by Dorling Kindersley (India) Pvt. Ltd. (1993).

Code smell. Smells are certain structures in the code that indicate violation of fundamental design principles ...

Get Test-Driven Java Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.