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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: