A long time ago, I went on an advanced driving session. One of the things that my instructor taught me was a mnemonic for checks that you should do before every journey. The mnemonic was POWER[1][2], which stands for:
Petrol – (or Phuel for diesel cars) check that you have enough
Oil – Check the dipstick level
Water – Check the level in the header tank if you have one
Electrics – Headlights, Tail lights, Brake lights, Indicators, Windscreen wipers and washers
Rubber – Tyres are inflated to the correct pressure, and the tread is within limits
These checks require very little in the way of skill or time. We should do them at least once per day, and preferably before every journey.
I don’t do these checks as often as I should, mainly because they are not habit and forming habits (good or bad) takes time and discipline.
If we were taught these checks as the first part of our driving instruction, it would seem unnatural to not do these checks before every journey. This is called Primacy and states that what is learnt first (good or bad) is hard to unlearn.
When learning to fly gliders, one of the first things I learned was the pre-flight check. This has the mnemonic CB SIFT CBE. To ignore this check would require a significant effort on my part. Even if I have already been through another, more comprehensive checklist, I will still run through this basic test before starting a flight, no matter what the aircraft. This significantly increases my chance of discovering a problem while I am still safe on the ground. Better to be on the ground, wishing you were flying, than to be in the air, wishing you were on the ground.
I know that writing software test-first leads to a better design and gives me a safety net within which to refactor. I know this in the same way that I know that I should check my oil regularly, but this is not the way that I learned to program. I still sometimes start writing code before I write the tests and find myself wishing I was down there, writing the tests first. It’s a hard habit to break.
Like the POWER checks, writing code test first is not difficult, it doesn’t take much extra time, and it pays benefits when we uncover problems before they get too serious. Until we unlearn the habit of jumping straight into the driving seat, we need the discipline to do our checks before hand.
Right now, I’m going to write two sticky notes. One for my car steering wheel that reads “POWER” and one for my computer monitor that reads “Have you got a test for that?”.