The Fun Will Never End, It’s Spaghetti Time!

After completing my first year of university at UWE studying BSc Computing, I started my summer break. I came to the sudden realisation that I had 4 months ahead of me before I started my second year. After previously spending 10 years working full-time, having this vast amount of free time suddenly thrown at me seemed like a dream; but after spending a week lazing about in my underpants, the novelty soon wore off. I became bored. Very bored.

The year before I had been gifted a Raspberry Pi. At the time I thought to myself “That’s cool, but what on earth am I going to use this for?”. Now given my sudden freedom, I figured I can finally put this thing to good use; maybe even learn a new programming language, and this crazy thing called “Object Orientated Programming” that lecturers on my course kept waffling on about – which having only experienced procedural background at that point seemed like a strange and magical thing.

But what contraption could I invent with this tiny credit card sized computer? Perhaps a sentient A.I. that would put Skynet to shame? Or how about a doomsday device so threatening that it would place humanity at my fingertips?

Adventure Time's BMO

Maybe I was asking too much from this 400MHz processor and my programming abilities at the time. My plans for world domination would have to wait.

I settled instead to bring to life a character from a TV show that I had been binge watching. His name is BMO and he exists in an animated show called Adventure Time.

Blank Space

I figured that the fact he was already an anthropomorphised mish-mash of an old GameBoy and an Apple II computer that he’d translate perfectly into physical form and give me plenty of scope to build parts of his character into an actual product.

The 'Components' of BMO

Creation

Given its almost symbiotic relationship with the Raspberry Pi community, I figured Python would be the best choice to realise my vision. So I spent the next couple of weeks learning the language and playing around with a library known as Pygame that would allow me to create the visual aspects of BMO.

A UML package diagram of my implementation

It all started out simply enough. I threw together a method of creating BMO’s facial expressions procedurally from a library of facial components that I created. This would allow BMO to sit there and look around while pulling faces, and occasionally shouting out random sound bites from the TV show. “Great”, I thought. Now what? What else could he do?

Here’s where I went wrong. Eager to expand on features that I could add to BMO, ideas began to snowball and I dived straight into writing code without giving a second thought about how it was all going to fit together. Well it did all fit together – in the same sense that if you jam a square peg into a round hole with enough force, it will eventually go through.

By the time I added extra features such as a video and music player with NAS streaming, various gaming emulators, image viewer etc., tied together with an 8-bit inspired UI, my code; with its many functions that go on far too long, that is prone to throwing exceptions, and with enough cross dependencies that it began to resemble (a bit like this run-on sentence) a plate of spaghetti.

Lessons Learned

After spending a year at Zircon as a placement student whilst gathering knowledge from my own mistakes and learning from colleagues, that are far wiser than I, I have evolved from a naive programmer into a functioning software engineer.

I now understand that to build functional, reliable and robust systems requires establishing requirements, architecting, designing, creating test cases and reviews – all before writing a single line of code. These collectively are best practises in our Industry!

Had I applied these concepts before I began creating BMO, I would not be concerned about the potential for a nervous breakdown every time I consider making a few changes or maybe even adding some new features. But at least I didn’t attempt to create that doomsday device after all.

BMO

‘Not Quite Skynet, but Close Enough’