My Advent of Code 2019 Approach
Tags: adventofcode, javascript, node, challenge
Published: 2019-12-06 03:02:39

---
title: My Advent of Code 2019 Approach
published: true
date: 2019-12-05 05:00:00 UTC
tags: AdventofCode, JavaScript, NodeJS, Challenge
canonical_url: https://davefollett.io/2019/12/05/my-advent-of-code-2019-approach/
cover_image: https://davefollett.io/2019/12/05/my-advent-of-code-2019-approach/cover-my-advent-of-code-2019-approach.jpg
---

2018 was my first experience with [Advent of Code](https://adventofcode.com/). It sounded like [Codewars](https://www.codewars.com/), so I jumped right in. Wow, I was really impressed. Not only were the puzzles fun, but I really like these aspects as well:

- **Most of the data sets are large, your algorithms and data structures matter.** With modern computing, it can be easy to skip or not be worth the time to optimize code. But this doesn’t mean we shouldn’t practice it and the Advent of Code puzzles tend to put you into situations where it’s necessary to do so.
- **The puzzle descriptions can be long and contain lots of details not necessary to solve the puzzle.** Some folks don’t like this but I do. Raise your hand ✋ if you have been given a vaguely worded specification that you have to comb through to find the real requirements. Like it or not, some degree of detective 🕵️ work is part of a software developer’s job.
- **Each day’s part 2 puzzle provides a twist on the part 1 puzzle.** Sometimes its a small adjustment to solve part 2, but sometimes it’s a near rewrite. Though making a major change can be frustrating, this frequently happens for software applications whether it be the customer changing their mind or through the addition of new features.

## 🎄 2018 Approach 🎄

I didn’t have much of an approach last year, but I did decide to do the following:

- Use JavaScript as my language.
- Do all development directly on [CodeSandbox](https://codesandbox.io/) using the [NodeJS](https://nodejs.org/) template. The idea here was to avoid setting up a local development environment, but still have an easy way to share my solutions.

## 🎅 2019 Approach 🎅

- **Be more organized.** Last year, I was careless by not using version control, sometimes I broke part 1 to solve part 2, and it was hard to make my code run different solutions. This year I’m not doing those things and my code can be found in the following [GitHub](https://github.com/) repository:

  - [https://github.com/davefollett/advent-of-code](https://github.com/davefollett/advent-of-code)

- **Setup a local development environment but still upload it to CodeSandbox.** I decided to build on last year’s NodeJS web application by adding [ExpressJS](https://expressjs.com/) and making it more visually appealing (thanks to [NES.css](https://nostalgic-css.github.io/NES.css/)). Check it running live on CodeSandbox below. It’s also easy to run locally.

{% codesandbox 019-advent-of-code-9l90x %}

<iframe src="https://codesandbox.io/embed/2019-advent-of-code-9l90x?fontsize=14&amp;hidenavigation=1&amp;theme=dark" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" title="2019 Advent of Code" allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
- **Don’t stress out about it.** Last year, I put too much pressure on myself to solve each day’s puzzles as quickly as possible. This year I want to focus on creating good working solutions. If I get them done the same day they release, great. But if not, that’s okay, too. The creator of Advent of Code, [Eric Wastl](https://twitter.com/ericwastl), recently gave good advice regarding this on Twitter:

> #AdventOfCode tips:
> 
> - Focus on learning; don’t worry about the leaderboard.
> 
> - It’s okay to skip puzzles!
> 
> - It’s okay to ask for help!
> 
> - If you don’t know how to solve something, try breaking it into smaller parts. Repeat as necessary.
> 
> You’ve got this! 🌟
> 
> <footer><strong>@ericwastl</strong><cite><a href="https://twitter.com/ericwastl/status/1202297198236573697" target="_blank" rel="noopener">twitter.com/ericwastl/status/1202297198236573697</a></cite></footer>

## 🤔 Parting Thoughts 🤔

That pretty much wraps up how I’m approaching Advent of Code this year. Last year, I earned ⭐⭐ on 10 of the first 11 days (I completely skipped day 9). I hoping 🤞 to do about that well this year, but I’m not going to sweat it if I don’t.

Good luck and feel free to contact me if you need any hints or help.