Keep It Simple!

One of the many important skills I learnt in The Real World is to keep things simple. I don’t always achieve that goal, but I try to keep it in my mind as much as possible, especially when the pressure is on and people are making hasty demands. It’s in that situation that standards slip and short cuts are taken.

Keeping code simple is not easy. It’s far too easy to add a little extra here, a little extra there, and maybe throw in something you saw from the Gang of Four patterns book for good measure. I used to try to be clever a lot more than was wise for me, leading to over-engineered and overly complex code. I still have my odd moment, but at least I feel guilty and make a note to go back and refactor… time permitting.

Laziness is a virtue. Do the minimum amount of work required to achieve the goal at hand. Build incrementally, make small changes, test each change.

Simple code is:

  • easier to write
  • easier to read
  • easier to understand
  • easier to test
  • easier to debug
  • easier to change

It’s also more likely to work first time.

For most production code, we spend more time maintaining it than we do writing it. We fix the odd bug, add new features, modify existing features, refactor the code, come back to it days, months, years later and try to figure out what it does. That’s when you appreciate simplicity.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s