Keeping code healthy

According to Kent Beck, the following are essential to keep code healthy.

  1. Tests should pass
  2. Code should reveal intent
  3. No duplicate code (aka: isolate knowledge, SRP, SPOT, etc)
  4. Fewest elements – less no of classes & methods

With 4 – the temptation to cram and break SRP should be avoided. The 10/100 principle can help keep an eye on if something is growing bigger than it should be. The 10/100 principle is about keeping methods to 10-ish lines or less and classes to 100-ish lines or less.

Leave a Reply

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

You are commenting using your 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