Contents

Is the Advent of Code a good way to learn a new programming Language?

As a software developer, you should always be on the lookout for new things and new technologies. You shouldn’t use all of them or play with all of them (who has the time?), but at least be informed of what is out there. You should also try new things from time to time, just to keep the curiosity juices going. This article summarizes my foyer into a new programming language, Rust. I will give you a small background, why I was curious about it and if the advent of code is a good way to learn a new language (tldr: it is!).

Advent of Code.

Background

There have been very few programming languages that caught my interest. I have learned many languages by myself and others while studying at the university, but only a few have really caught my interest.

The first language that caught my interest was Java. Back in 1995, the year I started my university studies, I read about Java, played with it and it caught my attention. I liked its Garbage Collected nature and its promise of “Write Once, Run Anywhere”. I admit I was taken by all the hype when other languages were too confusing or not properly taught. Furthermore, I ended up using Java for side projects and when I had a choice. When I started my professional life, I was supposed to use C++, but things changed, and I ended up in the Java land. It has been like that since I remember, with few exceptions.

When I first heard about Rust, I was seduced by its claims. With time, I did some reading (a couple of books and many blog posts), watched some videos, and my curiosity grew, especially by how the language is designed around safety and speed. I have been postponing learning Rust for too long, so I decided that I will try to do the Advent of Code using Rust as a way to get a better opinion.

The Advent Of Code

The advent of code is an advent calendar that gives you programming puzzles for all difficulty levels. People compete to solve them as fast as possible, but you can simply use it to learn a new language, prepare for an interview, or just have some good old fun solving programming puzzles!

Using the advent of code to learn Rust gives me a win-win situation: I win by learning Rust to solve practical problems, and I also remember the good old fun of ACM Programming Contests (I participated in them when I was younger).

Solving Programming Puzzles When You Are a Parent

Finding the time to solve programming puzzles when you are a parent is hard. It is hard to be able to go to the computer, away from your family, and just code. When you love your family, and you love coding, it becomes hard to allocate time to your second love: coding 🙂 You see, I love coding, but when you have kids, you have to appreciate the time you have with them. They will not be you forever, so you end up moving coding to a lower stop on your priority list.

It also meant that I tried actually coding on my tablet using GitHub’s CodeSpaces. They work ok for what I needed, although the physical keyboard on the tablet is not supported fully. I always had issues with some curly braces, but nothing that prevented me from coding wherever I happen to be in. This is a freedom I couldn’t imagine years ago!

My Thoughts on Rust

I was surprised by Rust. With experience, I tend to avoid being taken by all the hype that surrounds some news. But I have to acknowledge that I was positively surprised. The language is concise for a statically typed language; it forces you to think about how you organize your data structures instead of adding pointers to everything and creating a nightmare for the garbage collector; its performance is impressive; I particularly liked its match operator; etc. It also has some drawbacks, like the time it takes to build, but with its LSP, I didn’t feel that so bad.

Rust is thought of as an ecosystem, that has all that you need, from dependency management, testing, documentation, etc. If felt nice to work in and easy to navigate. For me, it is definitely a language I would choose for a new project, if it fit the case.

Is The Advent Of Code a Good Way to Learn a New Language?

The short answer is yes: the Advent Of Code is a good way to learn a new language. Just keep in mind that the Advent Of Code has a point system for solving problems, and if you are learning a new language, you aren’t going to get into any “decent” position. But you can always join a private leaderboard with other people that are also learning the language to make it more fun.

I did not finish all the puzzles of all days (that is what being a parent is all about, not getting all the time you need for your hobbies). But what I have done you can find on GitHub. You can even open it in a CodeSpace (it has the development containers configuration in it).

Next Steps in Rust

For now, I am putting Rust on the back burner. I have this idea of making games, and I intend to start with one of the most known engines. Rust has Bevy, but I feel I need to understand some concepts, using a stable engine, before diving deep in Rust and Bevy. Another factor is platform reach: an existing engine with support for Web, Android, PC and consoles opens a wider range of potential players than what Bevy currently has.