## Pages

### Hotel room to train carriage

Appeared in the ACCU magazine CVu, Vol 22, January 2011

Paul has asked me to write something for CVu. I don't have a clear idea of what to write about so I thought instead I would just write about stuff I'm doing. Tonight I'm currently sat in a hotel room in Langley (Berks) after a thoroughly excellent day at a client's site. I've been teaching day one of my C Foundation course. John and Ed suggested some ways the slides, and the words I use to describe the slides, could be improved. So the first thing I've been doing is making some mods to the slides. The first was a simple int to pointer conversion where I initialised an int pointer with the hex integer 0xBEEF. I chose 0xBEEF because it spells a word but didn't think about alignment. 0xBEEF is an odd integer number and the address of an integer is likely to be, at the very least, even. The second was something I said. In the chapter about pointers I said that an invalid pointer doesn't have to be dereferenced for bad things to happen. That's too strong. You only need to think about the free() function to realise that. After you've called free(ptr) then ptr no longer points to an object but as long as you don't dereference ptr you'll be ok. What I should have said is that when you do pointer arithmetic any sub-expressions must always be valid.

Something I try to do regularly is to examine what happened during my day and to learn from it. A sort of retrospective. So I'm looking at the C course mods and wondering what I can learn from them. I'm wondering, in the first example, why I chose 0xBEEF in the first place. Choosing a hex number that spells an english word is overly clever. Overly cute. So now I'm thinking I'd be better off choosing a hex number that doesn't remotely even look like a word. One that would align correctly. I'm struck but how hard it is to avoid being overly clever. By how hard it is to recognise and take into account context. From the second example, I'm reminded how hard it is to say clearly what I'm thinking. Or rather, how difficult it is to have sufficient clarity in my thinking that the words are naturally clear.

As well as learning from the day's mistakes it's also important to think about what went well. I recently did a "60 minutes in the brain of" presentation for SkillsMatter London on deliberate practice (the topic of one of my entries in Kevin's 97 Things Every Programmer Should Know). SkillsMatter videod the talk and I've watched it a couple of times. Watching yourself on video is a tremendously valuable thing. It allows you to see yourself how others see you. Not how you see yourself. For example, something I noticed was a tendency I have to say "ok?" rhetorically at the end of a sentence. Ok? Doing that once or twice is fine but I did it perhaps a dozen times. It was almost becoming a tick. So one of my tasks today was to try not to say "ok?" at the end of my sentences. It's hard to know if I achieved that but I at least feel I didn't say it so often it became a noticeable tick. And I recall a couple of times where I was conscious I had not ended the sentence with "ok?" when previously I might have. But, interestingly, as I write this, I'm thinking how can I know? Perhaps I'm still doing it but don't realise because I can't see myself. So I'm wondering if, tomorrow, I will explicitly ask the guys on the course to tell me if I do it. I think I will. I'm reminded of the line from Robert Burns's Poem To a Louse, "To see oursels as others see is!". I remember Jerry Weinberg mentioning the connection in one of his books. And I notice bagpipe music is playing on my iTunes as I write now. I wonder if my subconscious made the scottish connection? It's the Skye Boat Song (Speed Bonny Boat). My mother used to sing that to me as a bedtime lullaby when I was a small boy.

• A trigger is a small amount of input energy that sets off a large amount of output energy.
That caught my interest. I recall Jerry discussing triggers in some of his other books. So I've made a note to reread what he said about triggers there in the light of that quote. An actual note that is - I also always carry a pen and paper.
• Raise your typing speed by ten words per minute. This will give you an extra six hundred words for every hour you work. If you work an hour a day, two hundred days a year, you'll type an extra 120,000 words - a couple of books' worth.
That's quite illuminating.
• You know, there would be no problem raising kids if only you could throw away the first one.