Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
This is the time of year when many people in my world are gearing up for Advent of Code, an annual communal celebration of daily programming challenges that begins on December 1 and ends on Christmas. Many folks use the event as an opportunity to learn or practice a new language. If you are truly impressive, you solve each day's puzzle in a different language, as Matt Might did in 2022.
Advent of Code looks like a lot of fun, but I have never fully participated. Some years, I drop in for the first day or two, solving the problems in a familiar language, like Racket or Python. Those early problems sometimes make useful examples when teaching functional programming in my spring course. I mentioned one such case back in 2016, when I turned Matthew Butterick's solution to one of the 2015 problems into an extended homework assignment.
However, early December constitutes the last two weeks of semester of our fall semester, which is followed by finals week, undergrad research presentations, and grading. I don't want to have to carve out an hour or more each day for three and a half weeks to work on these problems, no matter how much fun they might be. That feels like too much pressure, and just another kind of work.
Maybe that's why I was so pleased to read about December Adventure, a lower-key community programming event with a simple goal: to write a little code every day of the month. Now, I write code most every day for class or for work, so for me December Adventure is about taking at least a few free minutes each day to program for my own purposes.
Last week, before I read about December Adventure, I took an
unintentional test drive of the idea. I recently discovered
Alex Chan's blog
and read about
their adventure writing emptydir
.
This is a script that deletes all directories that are essentially
empty: they contain only files we don't care about, such as stray
__pycache__
and .venv
files or, on Macs,
the ubiquitous .DS_Store
.
emptydir
solves a problem I have all the time. Git
tracks files, not directories, and when I sync repos across my two
main machines, files sometimes get moved or deleted. The directory
that once contained them is now empty... except for
.DS_Store
. So macOS keeps the directory, even though
for my purposes it is now empty.
This is the complement of a problem I mentioned
in September,
in which directories I create on one machine do not get synced by a
a git push or pull because they are empty. To solve that problem,
I wrote a script called touch-empty
that leaves a
0-byte file git will track for me, keeping the folder alive.
Anyway, Chan's Rust program was the prompt I needed to write
rm-empty
, my own version of emptydir
. I
skimmed their Rust code and then put my own twist on the idea in
Python. It came together quickly, in programming bursts of a few
minutes each over three nights. The code itself wasn't too bad,
though I had to learn a bit more about the os.walk
function to make it work the way I wanted. However, as you might
imagine, testing a program that deletes folders and files calls for
extra attention!
I had fun writing rm-empty
, and December Adventure
gives me a chance to extend of the mood. I'll cobble together a
few minutes each day to write code that I want to write, only
because I want to write it.
Rather than noodle around with no higher focus, I'm going to write a little app I've been obsessed with since I read about it earlier in the month on Mastodon:
Recently I've started listening to my music library using an app I call "an html file in the root directory of my music library, which is regenerated using a shell script, consists of a js searchable/sortable table of all the tracks, and switches the content of an audio embed at the top". Honestly, it's better than quite a few of the so-called apps out there.
Of course, I've been writing JavaScript this semester in my client-side web development course, so this piques my interest in two directions: learning a little more JS, and polishing my HTML and CSS skills in an app where I myself care about the look and feel. Who says the world doesn't need an in-browser replacement for iTunes? And even if it doesn't, I might be happy to run my own app in its stead.
The goal of my December Adventure is to keep expectations low and have fun. I'm not going to place any demands on the exercise, other than to spend at least a few minutes each day working on the project. If all I can manage is a new test case one day, or a quick bug fix, that's fine. If I can set aside more time for design or implementation, that too will be fine.
If I end up creating an app that pleases me enough to use on a daily basis, great. If instead I get to the end of the month and don't have a functional page yet, that will be okay, too. I will have had thirty-one days of fun working on it. I can decide then whether I want to keep working on it. With any luck, the fun is habit-forming and I stick with the daily recreational coding, whatever the target.
I'm also using December Adventure as a blogging prompt. I've been wanting to write a post or three all month... but instead I always find myself writing code for class or working with students. This was a break week, with extra free time, but I ended up using my freest day doing some work on the next issue of Transactions on Pattern Languages of Programming (TPLoP), of which I am an editor. Maybe this blog post and the programming challenge of December Adventure will keep me moving, on both code and blogging.
According to the countdown on the Advent of Code home page, my December Adventure begins in 2 hours, 15 minutes, and 9 seconds — and counting. Tomorrow, I create the repo and make my first commit.