Kent Beck’s Rules of Simple Design #3

The code must contain no duplicate code.


Keep the codebase DRY: Don’t Repeat Yourself. Refactor out common code to its own subroutine.

Keep an eye on SPOT: Single Point of Truth. There should only be one place where any algorithm or equation exists. If you need to modify it later, you only need to change it in one place. Otherwise, you’re prone to have bugs where only some instances are updated.

Smaller methods and classes with repeated ideas should be extracted out to their own entities. Future changes only need to happen in one place.

Like what you read? Give Sean Coates a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.