Skip to main content

Command Palette

Search for a command to run...

Day 1: Advent of Code, Elixir, and Aider

Historian Hysteria

Updated
4 min read
Day 1: Advent of Code, Elixir, and Aider
R

I help companies bridge the gap between business vision and scalable technical execution. With a Physics Ph.D. and a background in building systems for millions of users (exmox, Newstore), I apply first-principles thinking to software architecture and team leadership

It’s official – I’m diving into Advent of Code 2024 with Elixir, one of my all-time favorite programming languages. Elixir has this elegant simplicity and scalability that I adore. While it’s not as mainstream as JavaScript or Python, its growing popularity makes it perfect for this kind of challenge. Plus, it’s a great excuse to brush up on my skills. You can follow along or grab the code here: GitHub Repository. Feel free to submit pull requests for your favorite language!

For this journey, I’m using Aider as my AI assistant, powered by Claude Sonnet 20241022 from Anthropic. The setup includes the aider.nvim plugin integrated with Neovim. So far, Aider + Claude has been surprisingly reliable – it feels like working with a junior dev with a large memory who’s super confident but occasionally clueless. Dangerous? Yes. Manageable? Absolutely, with strict testing practices.

In the rest of the article I will mention Aider but keep in mind that the results vary greatly based on the model used.

Part 1: Getting Started with the First Challenge

First up, let’s fetch the Day 1 challenge. Aider makes this easy with its /web command, which uses Playwright to scrape web pages.

One cool feature of Aider is its ability to commit changes directly to Git and run CLI commands. It’s a little like having an overachieving intern who documents everything meticulously.

Here’s my process:

  1. Write Tests First

I began by asking Aider to create tests based on the examples provided in the challenge. It generated:

  1. Generate Production Code

Next, I asked Aider to write the production code to pass those tests. It required explicitly adding files for context, which I found useful for keeping the AI focused.

3. Run the Tests

Running the tests confirmed that the example passed. A solid start.

Solving the Challenge

Advent of Code provides unique inputs for each participant. I asked Aider to fetch my input and store it in a file.

The result?

Great success!

My thoughts so far

I’m impressed by how effective Aider is with minimal and sometimes vague prompts. While I didn’t love every stylistic choice it made, the experience reminded me of reviewing code from junior developers at work: functional, decent style, but room for improvement. It’s oddly nostalgic.

Part 2: The Harder Variant

Advent of Code challenges always include a second part—a more difficult twist on the original problem. Here’s how it went:

  1. Fetch the Challenge

For the first time, Aider struggled to retrieve the content automatically. Perhaps the site’s structure was to blame. No worries; I added it manually.

  1. Repeat the Process

Just like Part 1, I wrote tests based on the example and asked Aider to implement the solution. It delivered:

  1. Great Success Again!

Refactoring

To wrap things up, I spent some time refactoring the code. While Aider’s solutions worked, there’s always room to clean up and improve readability. Refactoring is a satisfying part of the process, turning a rough draft into something polished.

Conclusion

Day 1 is in the books, and it’s been a blast so far. Using Aider feels like a hybrid experience between mentoring and pair programming.

It has been an eye-opener. Collaborating with Aider has shown me just how far AI tools have come – not just as coding assistants but as reliable collaborators for problem-solving. For senior engineers and engineering managers, I believe this kind of tool is invaluable for keeping in touch with the code by building prototypes. It allows you to focus on higher levels of abstraction, like architecture and overall design, while letting the AI handle implementation details.

That said, this experience has reinforced an important lesson: testing discipline is crucial when working with AI. Reliable software isn’t just about getting things to work – it’s about ensuring they keep working as expected. With proper testing practices, tools like Aider can become powerful allies in any developer’s toolkit.

Stay tuned for Day 2. Here’s to more challenges, more learning, and a productive Advent of Code 2024!

Advent of Code 2024

Part 2 of 3

I'll use AI to solve Advent of Code for the first time. I’m curious to see how it changes the experience. Will it speed me up? Will it change how I think about problems? Will it completely break my brain by solving everything before I get a coffee?

Up next

AI-Driven Advent of Code 2024

Day 0: The Start of Something Different This year marks a new chapter for me in Advent of Code – one that involves ChatGPT and Large Language Models (LLMs). It’s the first time I’ll be integrating AI into my problem-solving process, and I’m curious (...