Tis’ the season for good cheer for those who celebrate Christmas, but even more so if you’re a software developer. December heralds Advent of Code (AoC), the global challenge created by Eric Wastl in 2015.
The Engineering Team at OutSystems is not one to shy away from a good dare and is a huge fan of fun and games, so it’s no surprise that a group of its software engineers got together, created their own Slack channel for the event, and even established a private leaderboard along the way.
Whether you’ve been naughty or nice, we’re sharing the team’s lessons and experiences with AoC. Join us along for this jolly coding ride.
So, What Is Advent of Code?
In Eric Wastl’s own words, “Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other.” In keeping with its name, the event takes place in the first 25 days of December, and every day, the AoC founder launches a different problem on the event’s website.
“In 2019, though, competitiveness picked up. We started waking up early so that we could get to the problems as soon as they were released — which in Portugal is at 5 a.m.”
Hélder Marques, Lead Software Engineer
At OutSystems, Lead Software Engineer Hélder Marques, one of the great promoters of AoC within the company, recalls that it all began with Miguel Ventura, Principal AI Engineer: “I have to thank Miguel Ventura for showing me the world of AoC. If my memory does not trick me, he challenged me to take a look at the event around 2016, when he noticed that I really enjoyed programming and solving problems.”
Hélder entered the challenge on his own in 2017 before creating a private leaderboard with some of his fellow engineers at OutSystems the following year. “In 2019, though, competitiveness picked up. We started waking up early so that we could get to the problems as soon as they were released — which in Portugal is at 5 a.m. — to get more points on the leaderboard,” says the Lead Software Engineer.
Solving puzzles on the morning commute to work, even on their smartphones, was definitely a thing for OutSystemers. Hélder assures us that developing a Python script on a six-inch touch screen can be challenging, and we have every reason to believe him.
And while the pandemic may have affected the way we socialize, it didn’t deter the team from entering the Christmas challenge. The remote work situation only increased the number of AoC participants: in 2020, at least 12 people stuck around for a whole 15 days of the challenge. That same year, the Full-Stack BI Developer/Architect Pedro Morais shared a series of posts on how he solved each problem using Microsoft’s Power BI, while Miguel Ventura wrote an article on his 2020 lessons.
Why You Should Participate
So, if you’re a software developer, what exactly is it in for you at AoC?
Hélder Marques answers: “I’m a big advocate of participating in AoC, even if people work at their own pace instead of competing with others. For me, it’s like the time runners spend at the gym building muscle and endurance. The exercises in AoC may not be the ones we solve on our day-to-day, but they help us keep a sharp mind and improve our problem-solving skills.”
“In this pandemic context, chatting with colleagues also working on AoC is awesome and a great way to connect with people that you don't get to see as often as you once did”
Cláudia Frutuoso, Senior Software Engineer
He adds that it’s also a great way to learn new programming languages, algorithms, and theorems — in fact, that’s how he got his foot in on Python. “I now know there’s a Chinese remainder theorem thanks to 2020’s day 13.”
Lead Software Engineer Luísa Lourenço agrees: “So far on each edition, I end up learning new stuff, mostly mathematical theorems that help solve problems efficiently, as well as refreshing my knowledge on some topics.”
While AoC’s puzzles aren’t necessarily those you’d encounter on your daily software development job, Luísa believes it’s the event’s problem-solving mindset that matters the most, whether you’re a dev or in any other role. “This is also why I recommend anyone that loves to solve problems to join AoC! Give it a go, you might get positively surprised."
For Cláudia Frutuoso, Senior Software Engineer, the best part of AoC is getting to flex your programming skills and learn new languages, but there is also a more human side to it. “Learning a programming language is not just about learning syntax, you need to put it into practice to really learn it. And with many people doing the same exercise, you can also see others' examples and learn from them. I definitely recommend it. In this pandemic context, chatting with colleagues also working on AoC is awesome and a great way to connect with people that you don't get to see as often as you once did,” she said.
Much like Hélder and Cláudia, AoC was also an opportunity for Paulo Ferreira, Lead Software Engineer, to hone his Python skills. In his role at OutSystems, Paulo programs mainly with C# and TypeScript, but he also deals with a few Python automations.
AoC was, in his own words, the perfect opportunity to deepen his knowledge. “Every day, I’d tackle the challenges, trying to use more Python features in my code while also comparing my final solutions with the ones from my colleagues on Slack or looking at their GitHub repos. The challenges were interesting — I spent way too much time on some — and very diverse, but the most interesting aspect was seeing different ways of solving the same problem using the same programming language or different ones. We had someone using F# and others using OutSystems.”
Diogo Paulo, also a Lead Software Engineer, is one of the people using OutSystems to solve Advent’s problems. “I decided to challenge myself to solve these problems using a language that basically only has Ifs, Loops, and Lists. Theoretically, this would be enough for you to solve all the problems, but computer memory and time were a hard reality check that has been preventing me from solving some of the harder, larger problems.”
Now that our team has shared their main lessons from AoC, we asked them a couple of fireside questions about their experience with this holiday challenge.
How did you get into Advent of Code?
Cláudia Frutuoso: I first took part in AoC in 2017. I was on maternity leave and completed the exercises when my twin babies were sleeping. As a problem-solver, I was curious about the challenge, and it was an opportunity to put those Python muscles to practice.
Before joining OutSystems, I used to work at a consulting company. Unfortunately, at that time, I was stuck using older technologies in a project that was in maintenance mode, and there was not a lot to do. I felt I was lagging on all the cool tech stuff around me. A friend suggested that I learn Python. Learning something new, especially a popular programming language, kind of helped me reconnect with the tech world. Python has become the language that I use to learn new stuff. I used it for an algorithm course online and also AoC.
“My goal was to validate whether I could still code something as my work wasn't about developing new features but more about analyzing and troubleshooting code”
Luísa Lourenço, Lead Software Engineer
Luísa Lourenço: Back in my college days, I found a website with programming contest problems. I started solving some of them for fun (using C) and soon got hooked into problem-solving programming (i.e. short programs to solve a problem rather than full-fledged programs to implement some specification). I also found out I sucked at it; my statistics on that website are appalling. When I joined OutSystems in 2017, I noticed one of my teammates was discussing a programming problem with another colleague, and that's how I found out about the AoC event. I only joined next year, in the 2018 edition, but I didn't commit much to it and only got 18 stars in total. My goal was to validate whether I could still code something as my work wasn't about developing new features but more analyzing and troubleshooting code. In the following year, things got serious. I started solving the problems at 5 a.m. (right when they unlocked them) because it coincided with the time I was getting up (yes, I know!). That somehow triggered other people, who also began waking up at 5 a.m. to solve these problems.
Paulo Ferreira: I first heard of AoC in 2019, when a bunch of colleagues spent the month of December in a really motivated and competitive mood, starting the day (and lunchtimes!) tackling problems, discussing approaches, and keeping their scores up-to-date in one of our whiteboards. At the time, I found it curious, but I didn't join in the craziness.
Fast forward to 2020; I heard that same group talking about it again in preparation, inviting others to join their newly created Slack channel (Covid times, Covid measures!). At the time, I was trying to get back into programming as a hobby instead of only for work, so it sparked my interest.
“This year, I’m using a niche language that caught my interest in the meantime, Mercury. It will be interesting to see how it compares to last year."
Paulo Ferreira, Lead Software Engineer
Diogo Paulo: I believe it all started in the morning of 2018 (or probably 2017) when I arrived at OutSystems. I am part of the early birds’ group, the folks that like to start working early. I arrived at my desk, and two colleagues discussed how to solve a problem from Santa’s Little Helper. I know that people at OutSystems can get creative naming stuff (that’s one of the hardest things in computer science), but I never came across Santa’s Little Helper class or property in our code. I was curious and asked them what that was all about. They told me they were discussing the solution for that day’s AoC problem. I decided to check out what it was. Looking at the problems, a thought came to mind, “Would it be possible to solve this using the OutSystems visual language?”
Which language do you use to solve the problems?
Cláudia Frutuoso: Python. I like the language and usually don't have a lot of opportunities to practice it at work, nor a lot of time to use it outside of work. Advent of Code is that time of the year I get to use Python.
Luísa Lourenço: I chose Python from the beginning because I had already used it for simple tasks and enjoyed how easy it was to use. It also has some powerful mathematical or even computer science-specific libraries that ease any approach you might have for a problem. Each year, I find a new library and try to use it in at least one problem. If possible, I try to learn something new in Python.
Paulo Ferreira: This year, I’m using a niche language that caught my interest in the meantime, Mercury. It will be interesting to see how it compares to last year.
“I was never able to solve all 25 problems using OutSystems and I like to think that’s because of physical constraints, like space and time. I know it’s a poor excuse, but let me live with it, okay?"
Diogo Paulo, Lead Software Engineer
Did you ever complete the challenge?
Hélder Marques: I solved all the puzzles back in 2019 and 2020. I was really close in 2018, too, but day 15 was a tough one to crack.
Cláudia Frutuoso: I never finished the entire 25-day challenge. The closest I got was last year, with 18,5 days done :P
Luísa Lourenço: So far, I only got 50 stars once — that was in 2020 during the pandemic. It was tough but I guess being confined at home helped a bit (curiously, I started at 5.30 a.m. that year due to an activity I had at 5 a.m.). Also, some of the tougher problems were launched on weekends, when I had more time to think them through.
Diogo Paulo: I was never able to solve all 25 problems using OutSystems and I like to think that’s because of physical constraints, like space and time. I know it’s a poor excuse, but let me live with it, okay?
Cheats, secrets, tips?
Hélder Marques: In addition to a Slack channel we have at OutSystems where we discuss solutions and poke at each other to boost competitiveness, I also check the dedicated Reddit page. It’s a great way to learn new approaches to solving problems and find out other people with very ingenious ideas.
Cláudia Frutuoso: I don't look at code solutions unless I already got to the solution. I prefer to leave it unsolved, maybe I can get back to it later. But if I get stuck or don't fully understand the problem, I'll go check Reddit or the Slack channel, and see if I can get a clue to unblock me. I don't think that's cheating.
Luísa Lourenço: I usually check Reddit's AoC threads for alternative approaches once I'm done or ask for help when I'm stuck in my solution or can’t interpret the problem (sometimes the descriptions can be very cryptic). I avoid spoilers like the plague, but the subReddit is careful about using spoiler tags so people can navigate safely there.
Any solution you’re particularly proud of?
Cláudia Frutuoso: There was this one problem in 2017; it involved navigating a hex grid and I was particularly happy with my solution because it took a fair amount of work to get to it. I've used similar strategies in more recent years, but for regular square grids. Figuring it out, programming it, and getting it to work was very satisfying.
Luísa Lourenço: One approach I was very happy to use last year was leveraging a context-free grammar parser to generate an abstract syntax tree, and then having an interpreter to obtain the needed result. Probably not the fastest way, because generating the grammar took some work, but a really simple approach.
What do you enjoy the most about it?
Luísa Lourenço: When people started waking up at 5 a.m. to solve problems, we became more competitive at AoC, but it always felt, and still feels, very friendly and casual! We always push and try to unblock each other without spoiling the fun by rubber ducking our code or discussing ideas. This is cool because you end up finding alternative approaches to a problem and learn more than you would on your own! When we created a Slack channel for the event, things got even better: those who were more casually into AoC could also participate in these discussions and join the fun without any pressure to compete. You can compete if you want, or you can do it at your own pace if that fits you. The only rule is to have fun and enjoy the event!