#### Christopher Hoult

Software engineer, actor, speaker, print designer

# Blog

## Code Reviewing a Mug

Image credit: Cal Harding

So, in the past couple of days, a well-meaning friend posted the following image into a chat channel populated 50% by software engineers:

What they assumed was a nice nod to the coders soon became something of a nightmare as we all just... code reviewed the mug.

I'm sure if you've worked in software development for a while, you've seen this kind of effect before - someone publishes code or pseudo-code on a promotional item or in marketing material as a way to establish geek cred, or perhaps to attract talent for a hiring campaign. If you've worked with teams actively hiring, you might even have seen your own employers attempting this - and are probably aware that the exact same reaction to my friend's mug shot is bound to happen both internally and externally around such efforts.

Well, in the pursuit of purity - and perhaps as a way for me to explore my own thinking about how code should be reasoned about - here is a brief attempt at code reviewing the mug; in future posts I hope to refactor it...

## On Loneliness

I started this blog hoping to be a lot more profilic than I actually have been. I have quite a few topics to cover. But my lack of motivation has stymied that, although I take some slight comfort in this blog fulfilling the fate of numerous others. My piece of writing On Hills has been quite important to me, so here's another very personal piece.

I have had, for me, a rough couple of years. I've been through redundancy, death, breakup and more. All have taken their toll on me enough that, at the beginning of last year, I started counselling.

This was not easy for me. I am quite a closed person, emotionally; I rarely share and I always concentrate on how the listener will receive my words rather than on the expressing of them. As such, I hold things in. And they eat away at me.

## On Hills

Image credit: Ross Vernal

I've recently been having a bit of a tough time with things in my life in general, and part of my efforts to become happier have led to talking about it a bit more. I was trying to talk about how I've always coped (poorly) with responsibilities and events in my future, and I came up with the following analogy.

From the valley, I look up at the hill that rises above me. I've agreed to meet someone - a friend; a colleague; a customer - on the other side at a set time. I've got my walking boots, my jacket, a tent - all the gear that I know, through experience, I need. From here, the hill doesn't look very high, and it wouldn't take me too long to climb over the top. I could, of course, just go over the side of it, but the perfectionist in me only sees the summit.

I walk to the foot of the hill, but take my time about it - it won't take me long to climb, and I've never failed to meet someone before, so why rush? Just behind it, I can see another hill I need to climb after to meet someone else; no big deal.

I finally get to a time when I could really just start the climb, and I look at the hill and... it's a bit taller than I thought; from here, at the bottom, it looks like a tougher climb. I've made them before, but something stops me; I've still got time, I'll camp out and tackle it tomorrow. I'll make the meet, no problem.

Tomorrow comes, and the hill is still there. As are the two hills behind that. All of them need summitting, but I've not even started the first one. Still time, but I'm conscious of all the time I've wasted so far. I could have climbed all three already and relaxed on the other side!

Why the hell couldn't I do that? Why didn't I? Now I've got less time to climb than I could have done if I'd started yesterday. I can envisage me failing to make the climb, and disappointing the person I'm supposed to meet. Yet that fear of failure snowballs, rather than spurs me on, and I sit in my tent, beating myself up over it. Instead of taking action to get in front, I start playing this horrible game of brinksmanship with my responsibility. A cycle of angst.

It takes me incredible effort, but with just about enough time to do it, I pack up my tent and start climbing, hating myself on the way up. And yet suddenly, without breaking a sweat, I'm at the top of the hill, looking down - of course I made it! Of course I could do this! Why did I ever doubt myself? Why didn't I do this sooner? It was so easy!

I look back behind me and I see all of the hills I've climbed before. Thousands of times before. All of them just like this one; some a little harder, some a little easier. Why did I beat myself up at the bottom? Why didn't I just take it on?

I look forward and I see all of the hills in front of me, and I know they're all easy too. Lets be more proactive next time, yeah?

I descend the hill, off to make my rendezvous, feeling so much better than I did on the other side, in my tent. Feel this Chris! This could have been yours, none of that negative stuff - if only you'd done it when you got there!

I get to the bottom, and meet my friend. They have no idea what I've gone through to get there, but they're nice enough. They have no idea how close I came to disappointing them; to failing them. I've gotten away with it yet again. Lets not do things so close to the wire next time Chris.

I get a call - "Can you meet me on the other side of a hill in three days' time?" I've just crested a hill, I can do this! "Sure thing!" I say - and another hill is added to the horizon. But it's alright, I can do it.

Just not now. There's plenty of time left. No need to rush.

One of the other pieces of this analogy makes me sad too - when something great is on the horizon, I know it's there, but all I can see are the hills in the way, that I need to climb. And so excitement and anticipation are things that I find hard to come by.

## Bayes' Theorem and Machine Learning

Image credit: Joe deSousa

The application of Bayes' Theorem to Naive Bayes Classifiers is laid out pretty well on Wikipedia but I thought I'd put forward my understanding of how it's used.

First off, we have the theorem itself:

$$P(C|F) = \frac{P(C){\cdotp}P(F|C)}{P(F)}$$

Or, "the probability of event C occurring given event F occurring is the probability of C multiplied by the probability of F given C, all divided by the probability of F" (or, in the case of classification, we might view C as the class, and F as the feature).

## On Meeting Etiquette

Image credit: Cristiano Betta

As my first post on a new blog - and hopefully not also the last post, like so many other blogs - I've had some thoughts on meetings and their associated etiquette brewing for quite a while. In fact, the following was outlined at least four years prior to this post, so it seems rather fitting that it finally arrives.

Meetings are the bane of almost every professional's life - and as soon as you're past a magic number of employees or team members, they become simultaneously endemic and necessary. We often find ourselves mired in meetings where we're merely stakeholders, or perhaps are required for just a small portion of the alotted time. Rather than the fulfilling and informative affairs they are supposed to be, meetings become things to be dreaded and avoided.

Or, worse still, they become a drain on your time and energy and achieve absolutely nothing: I frequently find I have designated the first day of the week as "Meeting Monday" - the time I have available for coding or other directly productive work is reduced to four of the eight hours I'm contracted for.

Yet with a few simple rules or considerations, we can refashion our meetings and reduce the amount of wasted time and the boredom - oh, the boredom! - and recover a bit of our day and productivity.