+++
title = "The year of the Camel - Advent of Code 2024"
tags = ["software", "Advent of Code"]
date = "2024-11-28"
author = "John Costa"
toc = true
+++

## TLDR;
I will be doing the advent of code in Ocaml this year.

I've been doing the advent of code since I found out about it in 2019. It's been an exercise that has me reflecting on my growth and development as an engineer, and taken me through many stages in life.

# 2019. The first year.

In 2019, when I first started the challenge, I only completed 4 days. At the time I was in my second year of [Sixth form](https://en.wikipedia.org/wiki/Sixth_form), and had gathered some proficiency in Java, which was the language of choice for my school. However, I did these 4 days in JavaScript and Node.js, as during extra curricular programming clubs, we had been taught JavaScript for game development, where we used it to develop simple 2D games on an HTML canvas, and the more interesting part to me, creating servers using JavaScript, with the infamous Node.js.

Little did I know at the time how much JavaScript and Node.js would shape my career, and although I have strong opinions about both of these tools, I cannot deny that they drove my passion for building things.

# 2020. The tryhard year.

In 2020, I was at home, like most university students were. At this point I was a first year at Royal Holloway studying Computer Science, where the language of choice for learning was also Java.

I didn't find the first year very challenging and being at home I felt even worst, so I look back to December of this year quite fondly, as during a time where I was mostly alone, and with little to do other than work (I had begun my private tutoring career), I spend most of my time doing the advent of code. I managed to stay in the race until day 20.

This marked the start of something great. A love for programming I had previously kindled had now ignited. And from here on out I would spend most of my time behind a screen, typing away, at algorithm problems, and endless side projects.

I have gone back to this year and nearly finished it (I currently sit at 47 stars). This was a very special one for me.

# 2021. The VIM year.

During my second year, I had less time to go deeper into the advent of code. However I still managed to go on until around day 12.

The goal for this year was twofold. I had been loving Golang, having learnt it for a few side projects, and I would still pick this language most of the time. But the main goal wasn't to complete a few days with Golang, it was to only code in VIM - and not some emulator - no, I had to use the terminal VIM, with very little thrills (although I did setup the LSP).

I again look back on this time, because I knew little more than to go into insert mode and just use a keyboard normally. I started to pick up the more complicated keystrokes and some cool motions.

I know use Neovim to develop, and for me, it is the best development setup. I am the most productive, and the most comfortable, when inside a terminal.

# 2022.  The TypeScript year.

I had just started my internship at [Decipad](https://decipad.com), where we use TypeScript for every part of the tech stack. And I had enjoyed it.

I was quite a hold out on the TypeScript movement, I didn't see why we needed it. I was more than happy to just use JavaScript and did so for a very long time (even during this period, I used JavaScript for my second year project's frontend).

It wasn't a dislike for static typing, it was simply a matter of not enjoying bloat. To me, it felt weird that we would develop in a language, compile down to JavaScript, and then run said JavaScript. This I know see as a necessary evil, as JavaScript is so very difficult without types (at least on larger codebases).

So I decided to use TypeScript, it was the tool I used for work, so I extended that to my leisure. And it went great. I managed to until day 16, where I stopped as work was ramping up, and I had been put into difficult positions at work, to solve difficult challenges.

# 2023. The Zig and YouTube year.

This year I took it to another level. I had learnt some Zig and completed a simple implementation of [Huffman Encoding](https://johncosta.tech/projects/huffmanz/), but I wanted to learn more about this language. I also wanted to continue working on my [YouTube Channel](https://www.youtube.com/@johncosta27/featured), something I enjoyed whilst working as a tutor.

So, everyday I would sit behind the monitor and record myself walking through the problem in a language that is quite difficult. This took a lot of time and dedication. And I would slow down around day 12, but would periodically post a video. I believe I managed 34 stars during December, and throughout this year, I have gone back and finished off the ones I didn't manage to do at a time. With most of them being on YouTube as well.

After a year of on and off work on it, I finally finished an entire calendar of the advent of code. All 50 stars.

This grew my following a fair chunk to 160 subscribers, and I managed over 1k views on the day 1 video, which is pretty fun.

# 2024. The year of the Camel.

Throughout my time as an engineer, I have always written in imperative-like languages (Java, JavaScript/Typescript, Golang, Zig), and I lack functional experience.

During my last year of university, I had learnt Haskell. It wasn't an extensive course but it was enough to be familiar with the concepts of a functional language. I got enough of a taste to understand why functional languages are an important skill, even if you don't use them in your day to day life.

I have also enjoyed listening to Jane Street's Podcast - [Signals and Threads](https://signalsandthreads.com), where a variety of extremely impressive and interesting engineers talk about Ocaml, from using it in their day to day work, but also from their Compiler's team. These episodes still feel like action movies to me.

My best grade at university was in my Compilers module, taught by [Elizabeth Scott](https://pure.royalholloway.ac.uk/en/persons/elizabeth-scott), who's teaching style and expertise has made me so fascinated by compilers. I achieved an 88% in her class, with my best exam result at university of around 93%.

For this reason I want to explore different languages, understand their syntax choices and the different perspectives an engineer must deal with when faced with functional ML-style languages.

Another professor of mine, Dave Cohen, often said "If you learn another language, you will become better in both". He was refering to learning SVN alongside Git, but the quote still applied everywhere else, and I completely agree with him.

For these reasons, I will do the advent of code in Ocaml this year.

Ocaml is a functional language, similar to Haskell, but a little less hardcore (and actually used in the real world ;) ). It has an impressive community, incredible tooling and a syntax that is not so restrictive if you want to write simpler code. Making it a great stepping stone.

I will also be recording my attempts to YouTube, where you will be able to watch me stumble over myself many times. I hope to see you there.
