The Warning Signs

Switch on your code radar, and constantly look out for rotten code. Beware of the telltale signs: Rot sets in with any change that leads to a lack of clarity or that makes the system more complex. Unnecessary complexity comes in many guises.

Here are some, the flashing red lights and Klaxon calls:

  • The code is littered with many large classes and convoluted functions.

  • Function names are cryptic or misleading. Functions have surprising side effects not implied by their names.

  • There is no structure: It’s not clear where to look for a certain bit of functionality.

  • There is duplication: Many separate bits of code crop up to do the same thing.

  • There is high coupling: Complex module interconnections and dependencies mean that a small change ...

Get Code Craft 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.