Advent of Rust

Posted on

Last Updated: 2022-12-07

Rust always sounded pretty cool, but then I always heard you had to read this book to actually learn it.

I like reading, but I don't learn that way. I'm an experiential learner and I really like to just get hands on with something when I'm first trying to understand it.

So, I decided to just dive in and tackle 2022's Advent of Code using Rust.

After I grasp the basics of something and I can decide if I'm interested in pursuing it further, I circle back to research and reading to get a better understanding.

This series of posts will document my trials, tribulations, successes, failures, and "Eureka!" moments in hopes that you may gain some insight into this journey if you decide to follow a similar path.

The goal here is to stay in the Zone of Proximal Development long enough to grok the language well enough to start digging into slightly more advanced topics and reinforce all of the learning with spaced repetition (daily coding challenges) and increasing complexity.

Disclaimer: There is a chance that I will not make it to Day 25 Part 2 - I have never completed a full Advent of Code calendar in the past.

Table of Contents

Due to the ongoing nature of this post's updates, here are some quick links to relevant top-level sections in case you want to skip straight to a specific day.

In This Post

Series

This post serves as a hub with links to the rest of the posts in the series, some general information about the journey, my first impressions with Rust, and links to some resources I've found super helpful as a wannabe rustacean.

Posts:

Background

For some context about me to help you understand how I'm approaching this and if this approach might work for you, too:

  • I'm a developer (currently working as a Developer Advocate) with just over a decade of professional experience and I've been programming as a hobby for a little over 20 years.
  • In the past I've played around with all sorts of languages (roughly in order: HTML, CSS, Visual Basic, Java, ActionScript, PHP, Ruby, Objective-C, Swift, JavaScript, Bash, TypeScript, Solidity, and Python), but my primary focus has been JavaScript/Typescript.
  • I've liked a few things about a lot of languages, but haven't found one that resonates with me like TypeScript has.
  • I don't remember much about most of the languages I've explored in the past because I always ended up returning to something more comfortable.

Much like suddenly switching from QWERTY to Colemark or VS Code to Vim, I've rarely felt that the investment in learning an entirely new language, toolchain, and ecosystem is worth the time and effort.

So, why am I interested in learning Rust then? It seems to be the next thing for Web Assembly and has an interesting programming model that I think will really challenge my understanding of programming and programming ability.

So, why should you care? You probably shouldn't, but if you're interested in how to use coding challenges as a springboard for learning, getting some insight into how an experienced developer tackles learning a new language, or just want to see that a senior developer also searches for a lot of the same things that a junior developer does then you might find this post interesting.

GitHub Repository

Learning in the open only counts if you actually share it, right?

Repo: https://github.com/ericrallen/advent-of-code/tree/main/2022

Getting Started

Anyone who has dealt with Python, Node, or Ruby versions knows that you probably shouldn't just install whatever language you wnat to work with without first researching the ecosystem and figuring out how people really manage versions, packages, etc. You can just install the default toolchain and go for it, but you'll eventually regret it.

As I was searching for the right package to install from Homebrew for this, I learned the first thing that I love about Rust.

Rust's default, recommended installation method, rustup handles this for you so that you don't need to figure out whether you should be using nvm or volta or pyenv or poetry.

This instantly made the languages I have been using for years feel very outdated.

Resources

Here are some resources that I've found particularly enlightening throughout this journey (in roughly the order that I found them in):

Documentation

Blog Posts

Videos

Conclusions

Below are some conclusions I've come to during this journey (along with the date that I came to that conclusion just in case my thoughts change over time).

  • 2022-12-02: Rust is pretty neat. I might actually like it.
  • 2022-12-04: Fighting to get the right types (like &str, String, char, &&str, etc.) more than I am actually programming. Hoping this is just like the initial hurdles I encountered switching from JavaScript to TypeScript.
  • 2022-12-05: Like any language, it seems like it is not hard to write mediocre, naive implementations in Rust.
  • 2022-12-06: Feeling a bit more comfortable. Adding in the overhead of keeping track of all the searches, righting down notes, and cirlcing back to the blog has definitely made this more of an undertaking than I thought it would be.
  • 2022-12-07: What a roller coaster of emotion after messing up Day 5 and having to step back and come back to it later and then flying through Day 6. Rust is still pretty neat. I definitely might actually like it.