Fear of Public Speaking

As I mentioned earlier I’m looking for a new gig, so I’ve been interviewing with folks. I’ve had a couple of interviews where they’ve asked me to look at code or write code. I’m absolutely horrible at this. When I’m put on the spot I break out in a sweat, really I do. I don’t know why, but I get super embarrassed, and I cannot think, at all.

Last Wednesday I was asked to solve the FizzBuzz problem. I fizzed out, why? I just cannot perform in an environment with people staring at me, on the spot. It’s just the way I am, and it means if I have to do whiteboard coding exercise, I’m most likely screwed because I can’t think logically.

Anyway, back to FizzBuzz. After leaving the interview my wife and I drove around the city, had lunch, and generally tried to make a day of it. On the way home I decided to pop out my MacBook and do the FizzBuzz exercise from memory. It took me less than five minutes to make the logic work as expected, then I “fancied” it up for my own sake.

Here’s the answer in a few lines of C code.

static void FizzBuzz()
{
static int kBufferMax = 256;

char outputBuffer[kBufferMax];

for (int x = 1; x <= 100; x++)
{
memset(&outputBuffer, 0, kBufferMax);
if (0 == (x % 3))
{
strcpy(outputBuffer, "Fizz");
}
if (0 == (x % 5))
{
strcat(outputBuffer, "Buzz");
}

if (outputBuffer[0])
{
printf("%s - value %d\n", outputBuffer, x);
}
}
}

Pretty simple, isn’t it? Here’s a Gist if you’d like.

I also have a fear of public speaking. I’ve managed to get over some of this by making sure I know my material cold when I’m speaking. It makes a huge difference, but in an interview you never know what you’re going to be asked to do. That alone sets me up to fail at the whiteboard. I’m nervous before I start.