Posts Projects /posts/why-code-for-fun$_

Why Code for Fun?

It's pretty common during interviews for software development roles for the interviewee to be asked about any side projects or hobby code, and rightfully so this is often seen as unfair. Coding in your spare time should not be a requirement, many people don't have the time for it, others may just want to spend their spare time doing something else, and they shouldn't be punished for that. Ever. Some developers have a seemingly endless list of hobby projects, that churns and changes constantly with little ever being completed. I've always been one of those developers but it only recenlty dawned on me why.

I code professionally for about 30 hours of the week on average. Other aspects of my job take up the rest of the time and some weeks are far, far longer than others. So why do I code for fun, on the same machine in my limited downtime? Because suddenly I don't have to give a shit.

In my professional code I strive to be better. I read articles, books, and always aim to improve the code base. The code is defensive, it tries hard to be user friendly, and all of that consumes a lot of time and mental effort. When it comes to hobby code I can choose the language, the platform, the code style, the project. It's all under my control, and the end product is typically for me, which means I can just write the bits I want to write and throw the rest out of the window. Check an array index before using it? Nah. I'll assume it's right, and when it's inevitably not, I'll debug and work out why. If bad input blows things up, so be it - I'm the one giving it input so I should just get my input right. Clearly this is not an approach for any end user audience beyond myself.

Arguably you should always strive to write your best, most robust code, and often that takes defensiveness. But for older computers and lower level languages it's correct and fast code that count. Yes I probably should always try and stick with best practices and focusing on improving my architecture skills, but when I'm coding for fun it's because I want to have fun: the way to do that is to write the bits I want to write and not let the rest bog me down. If I spent all of my coding time (work and otherwise) trying to do it 'right' I probably wouldn't code as a hobby, because the fun would have been sucked out of it.

Don't ever rank a job applicant lower than another because they don't code in their spare time. Maybe they don't have spare time, maybe they just don't want to spend their time that way. I used to (incorrectly) think it was an important thing to watch out for, but many of the best developers I know don't code in their spare time and some of them then wonder why I do.

For me it's pretty much a way to blow off steam. I can have a whisky and crash an Atari over and over while I work on a project that'll likely be of benefit to nobody but me, and even for me it's not the end product that'll provide any benefit: it's the process.