Digitalia Alasdair’s workblog and linkdump

Posted
8 November 2007 @ 4pm

Tagged
Daily Grind, PHP

Talking To The Cat

More of my occasional tales from the day job, and while this one is most useful for resolving technical problems, I’ve had some success with it in other areas of my life, so I thought I’d share it with you.

They don’t call it code, because it’s easy to understand, you know. Internet Ninjas like myself spend a long time in the Dojo Of Strange Punctation and The Monastery Of Bizarre Logical Constructs before we’re truly ready to grapple with these strange, alien, languages.

After 8 years of doing this PHP shit, truly, I am practically some kind of Ascended Master, but even I sometimes trip myself up. But, thanks to my hard won Code Zen skills, I know what to do.

(Yes, OK, I’ll lay off the crappy pseudo-macho metaphor. Look, the job’s about as exciting as a train-spotter convention, and I want you lot to keep reading. I have to do something to make it sound entertaining.)

But I digress. When I am baffled by why my code won’t do what I want, despite the fact that I’m sure I’ve got it right, and I’ve been staring this heap of digital crap that just won’t cooperate, no matter what I threaten it with, for half an hour to no avail, I know what do to.

Talk to the cat.

No, I don’t have a cat. I hate cats slightly more than I hate small children, and could probably drown every last one of the furry bastards with a smile on my face, but still - I talk to the cat. Or co-worker. Or any passing tradesman. Or imaginary friend, if really pushed, although they’re less useful. Another genuinely living creature is generally required.

The important thing is to talk out loud, and explain what it is you intend your code to do to someone else, step by step. Start with what you intend to achieve, and then go through how your code does it, line by line, pointing to each in turn, and explaining what it does to whatever living being was unfortunate to be nearest. In the process of doing so, you will say something so mind-buggeringly stupid that it will leave you wanting to kill yourself by the fastest route possible. (It is only because the floor-to-ceiling glass window behind my desk is made of reinforced glass that I am alive to write this now.) But, having thus humiliated yourself in a public manner, you will be in no doubt about exactly where in your code the problem lies, and will be able to fix it in about two seconds.

And so whenever anyone tells me that they can’t see where they’re going wrong, my response is always “Have you talked to the cat yet?”. I would prefer to ask about another animal, but I understand that “talking to the badger” is an euphemism in some parts of the world.


Links For Wednesday 7th November 2007 Links For Friday 9th November 2007