Advent of code {‘year’:2020}

Alper Köse
4 min readDec 27, 2020

--

This year I decided to participate in the advent of code. It is a time of the year where the author of the website releases a small programming puzzle every day of the Advent Calendar. It has a leaderboard and also a feature where you can create your private leaderboards to challenge your friends or colleagues.

The global leaderboard is practically a speed contest where people solve problems in less time that takes me to read the description. Private leaderboards along with a dedicated chat room, create a cosy environment where people can exchange their approaches or share how they use everyday tools. As expected there were attempts of using excel, but I saw an interesting choice of jq as well.

The challenging part of these puzzles is that they have a second part, where the requirement changes while the input remains (with one exception) the same. This change in requirements is sometimes quite radical that pushes you to redesign part of your code

Motivation

Lately, I realised that all I do was my day time coding (rest endpoints, sql queries, events, k8s, docker, monitoring, etc…). Even though it has it’s own challenges, they are a sort of routine. The architecture was designed long time ago, you just have to add another brick on the wall. So I was looking for something different. Advent-of-code just gave me that opportunity.

My motivations were mainly centered around design challenges of these small problems such as:

  • checking how my designs are holding up with the changing requirements
  • using TDD to shape up the design
  • providing turn-key solutions

Also I wanted to polish my golang skills since I did not have a chance to work with it for more than a year.

Challenges

My biggest challenge was time. My work and family responsibilities are taking a lot of my time. I only had time to work on these after 21:00 where I was tired (but still motivated). And there were days where I couldn’t concentrate and sometimes it went on till 1 or 2 am.

Second challenge was the schedule. There are new puzzles coming up every day, and I am not that disciplined in my personal time. Keeping up with the schedule proved to be a challenge for me on a couple of days

There are other challenges as well like the mindset change from my daily work. There is no rest endpoint, no database, no infrastructure. There is only your code. But these were the reasons of participating in advent-of-code, so I would count them as positive challenges

What went well

Well, I managed to finish 24 out of 25 puzzles in the same day they were released. Looking at the statistics, the missing one was the toughest one because the average first submission is about 5 minutes and this particular one took 25 minutes for the fastest coder of the wild west.

Another thing went well for me was, I had to google a solution (or take a look at discussions in reddit) for only 4 times. First one was the day 10, where I found about Chinese Remainder Theorem, second one was day 17 where I did not understand (like many other apparently) how the sample provided in the description worked. I also had to get some hint for day 19 part 2 and day 23 part 2. Considering my rusty algorithmic skills 4 out of 24 is not a bad score

Regarding my main motivations, most of the time I had to go back and do some changes. But I don’t remember a time where I had to go back and redesign. In some cases, adding a new implementation of an interface solved the problem, so not being rusty with designing a solution made me feel good

What could be improved

Well, I spent too much time working on the problems. And seeing people just finish it in 5–10 minutes was not helping. Still I tried to stick with the TDD and refactoring even when I was very tired. Just the one time, I tried to just solve the problem because it was late. But at the first failed attempt, I realised I needed my tests and started writing them. (Still some of my code requires cleaning up) There is this saying: “Practice makes perfect”. I will work on my skills with some code kata exercises

There were a lot of similarities when it comes to parsing the input. An extra challenge I brought onto myself is I did not set up a project layout where I can share some common functionality. This caused a lot of copy pasting.

I missed one puzzle (day 20), I was very busy that day, and I did not have a chance to take a long look at it again. I will try to finish that in the upcoming days

Wrapping up

I put all my solutions in a repository on github, if you have any I’d be happy to get feedback.

Advent of code 2020 gave me a lot of joy. This is the first time I participated in such a thing and I am sad that I missed it in previous years. I am already excited for the next year. Eric deserves a big thank you.

--

--

Alper Köse
Alper Köse

No responses yet