Recently, the Digital team updated an older application which was written in Java. It's a language that I didn't have much prior experience working with. This post is an account of my journey from Java novice to being able to build a (small and sparsely-populated) world!
You awaken in a clearing with no memory of how you got here…
One aspect of my job is to review code changes made by my colleagues in order to ensure the objective of the work has been met, to suggest ways to make the code more efficient, and to perform a good old-fashioned bug hunt. One of the most recent reviews was for the aforementioned Java project.
The good thing about a lot of programming languages is that they often share similar structure or syntax, so quite often you can still get a basic grasp of what a particular piece of code is doing without having a perfect understanding of the language. Such was the case here, but I felt that a bit more knowledge of Java would come in handy in the future.
It's dangerous to go alone! Take this (knowledge)
The team has a two-hour session every week set aside for personal development. We leave the office and head to a quiet room to reduce distractions and get ourselves in "the zone". These Developer Development (DevDev) sessions can be used for trying out a new piece of software that could prove useful, watching tutorials and presentations, or improving knowledge of a language. With the recent encounter with the Java project, I decided that I should work through some basic courses to get a feel for the language and cementing that knowledge by creating a small project.
I began by tackling the tutorials on Codecademy, which is a good place to start for a range of programming languages. While I was working through the exercises, I started thinking about how I could apply what I was learning to a small project and decided that a text adventure would be a fine idea. I found a basic template which allowed for some simple commands (movement, picking up items) and started sketching out some ideas for new components and, of course, the obligatory world map!
You prepare to enter the Tower of Adventure
Over the next four DevDev sessions, I added extra functionality to the game. I included things that we often take for granted like walls, doors and multiphasic access codes. Each ‘room’ in the game has a north, east, south and west attribute. If any of those are set to false, the player is unable to move that way, if set to true, they can travel freely. Updating a direction attribute from ‘false’ to ‘true’ is how doors are unlocked, allowing the player to progress.
Other updates were applied to items, allowing them to be used in certain rooms to trigger events (such as unlocking a door or revealing another item) along with displaying a short piece of narrative to the user.
Some ending conditions were also added so that the player could win (or lose) the game and I got to flex my creative writing muscles by putting together a slightly surreal narrative involving sci-fi fan conventions, baking competitions and a goose with an insatiable thirst for rebellion, all wrapped in a classic fantasy setting with occasional episodes of existential dread. Pretty standard, really.
Developer levelling up!
As a result of these recent DevDev sessions, I now have more confidence in being able to navigate around a Java project. Therefore, if another opportunity arises in the future where changes to a Java project need to be reviewed, I can be more confident when delving into the code.
Peace reigns over the Kingdom
In summary, the experience of DevDev is a very positive one. Having a set amount of time each week to leave the normal working environment and really get stuck in to developing some new skills is hugely beneficial. Even if those skills can’t be put to use immediately, they can be applied in other ways to existing and future projects.
I’ve also come to realise that even a renegade goose can be a hero if you give it a chance.
If anyone would like to experience this unique adventure for themselves (and has a bit of knowledge of Git and Java), you can download the compiled Java file.