analogy – Andy Palmer https://andypalmer.com Views on software, technology, consulting and business process Fri, 22 May 2009 13:07:24 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.3 Do you have enough oil? https://andypalmer.com/2009/03/do-you-have-enough-oil/ https://andypalmer.com/2009/03/do-you-have-enough-oil/#comments Thu, 19 Mar 2009 22:58:30 +0000 http://andypalmer.com/?p=58 I was talking to someone who had had a project manager mention in a retrospective that he felt that the testing was slowing down the delivery. They wanted to stop “wasting time” on testing and refactoring.
When I heard this, I said “That’s a bit like going on a car journey and your passenger telling you to ignore the oil pressure light because they don’t want you wasting time topping up the engine oil”

Admittedly, you will get underway faster, but that’s going to be very little comfort when you come to a grinding halt a few miles down the road.

]]>
https://andypalmer.com/2009/03/do-you-have-enough-oil/feed/ 3
Code should start out messy https://andypalmer.com/2009/03/code-should-start-out-messy/ https://andypalmer.com/2009/03/code-should-start-out-messy/#comments Thu, 19 Mar 2009 22:34:45 +0000 http://andypalmer.com/?p=53 Earlier today Antony said on Twitter:
“stop apologising if your code starts out messy… it’s how it ends up that counts…. you can’t make an omelette without breaking some eggs”

I replied:
“Code _should_ start out messy. Finding the right places for things is harder when they’re already neatly in the wrong place”

If you have a preconceived idea of where your code should go, you will put it there by default. Antony told me an experience he had with this when he was untangling dependencies in jnarrate. By moving everything into a single package, then repackaging based on affinity, a much better package structure revealed itself.

At home, I would really like to re-organise my kitchen so that the pans are closer to the cooker. It makes sense from an ergonomics point of view. However, they already have a home. In order to rearrange the pans, I would have to empty the existing cupboard and the destination cupboard. It’s less work for me to put the pans back in their existing space, but it bothers me whenever I think of it. I really should fix that

]]>
https://andypalmer.com/2009/03/code-should-start-out-messy/feed/ 2
Forming good habits requires discipline https://andypalmer.com/2008/11/forming-good-habits-requires-discipline/ https://andypalmer.com/2008/11/forming-good-habits-requires-discipline/#respond Tue, 25 Nov 2008 14:54:00 +0000 http://andypalmer.com/?p=20 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?”.

]]>
https://andypalmer.com/2008/11/forming-good-habits-requires-discipline/feed/ 0