Home

Advent of Code

My solutions to AoC since 2021, used to learn a new language each year.

Motivation

Advent of code is a series of algorithmic problems available each day from the 1st to the 25th of December. The problems are easy at first and get harder and harder, forcing you to use use the language you’re using in more advanced ways. Many use it to learn a language from scratch, including me.

Before my first year, I had been using mostly Dart and Javascript/Typescript. I felt like I had to shift my perspective a bit to keep improving.

2021: Go

For my first year of AoC, I wanted a language that I could see myself using for Neopolis of side-projects. Both the stability of the language, its syntactical simplicity, and its ever-increasing popularity at the time made it an obvious choice. I considered using Rust, but I didn’t see much use of it in my work at the time, especially considering the steep learning curve.

For learning Go, the excellent Go by Example was a good start, followed by the official language tour and later posts on the docs. Go has a lot of uniqueness to it. It’s a strongly opinionated language, with many conventions. Learning both the language and the idiomatic way of solving problems is not as straightforward as it seems.

For many reasons, Go is my go-to language for servers, replacing Node.js. The main reason is that I’m confident that a project written in Go will work just as well years later, and coming back to it won’t be a problem at all.

2022: Python

Python is one of (if not the) most used languages worldwide. Being fluent in Python might be like being fluent in English: a must-have. The messy nature of Python in the version of the interpreter, in the language itself, and in the libs (the standard lib is not anywhere as strong as the one in Go) made me a bit reluctant at first.

Turns out Python is so popular for good reasons. It’s compact and expressive, and coming from Go for AoC, Python feels like cheating. Do you want to do this or that complex operation? No problem, there is a function that does exactly that. Or a list comprehension. Or a list comprehension within another list comprehension.

Debugging performance issues is, as expected, much much harder. It’s difficult to know precisely what’s happening below the code, in terms of operations and memory. However, a good understanding of the data structure in Python goes a long way and the official language reference is very well made.

2023: TBD

Still considering a few options for 2023. Kotlin, and Zig are the main candidates for now, but a Lisp language would be interesting too.