Completed the 2015 Advent of Code challenge in GO

And I completed the 2015 challenge! (see my previous post). You can read my notes on it on my GitHub.

This was quite interesting, and I thing a great way to learn a language just after completing its tutorial, as this challenge as a feel of "real life" situations, and allow for a variety of solutions, so that you can put different approaches to the test.

I forced myself to not look at the solutions available on the net, except for two cases:

  • Using working code to generate more data to test against (random inputs + expected result number). I just ran the code of other solutions, without reading their source. I often used solutions by devjobe and schwern.
  • Once I had a working solution, browsing the source code of other solutions to compare with mine and see where I could improve, and discover cool tricks. I mostly used the reddit megathread.

I also tried to use only the standard Go packages, and not the ones available on the web. I am sure I will end up using 3rd party packages to replace the standard ones (the flag package to parse options for instance is really too primitive). And I also didn't create a separate module or package for my library of common useful functions. I will surely do it in the future, but I feel I should have more experience first.

Anyways, it has confirmed that Go was the language I have been waiting for all these years. On the one hand, I have a bit of regret not having jumped on it sooner, but on the other hand it was easier to just wait for my retirement (one year ago) to free myself from any work politics and constraints to be able to fully explore the programming language landscape with no strings attached.

I can see myself using 4 languages in the future:

  • bash for any "glue" tooling and scripts.
  • go for my main do-it-all language, and web backend.
  • javascript (and/or WebAssembly) for my web frontend, with pure modern HTML and CSS, but no framework, à la Vanilla JS.
  • and maybe a higher performance, specialized language, if I encounter such needs: E.g: zig as a replacement of C for tasks where Go could be unsuited (if I encounter any), or julia for math-specific things, etc...

Edit: I see that Neil Henning also enjoyed discovering a new language via AoC: A Review of the Zig Programming Language (using Advent of Code 2021)