Notes on what it’s like to write code.
I woke up this morning and pulled my open laptop onto the mountainous comforter piled over my knees. Eyes blinking against the sunlight, I squinted at the Terminal window on my screen. Before email, before Twitter, before breakfast, before anything: the most pressing, exciting thing in my world at 7-something this morning was the status of the script I’d set running overnight…
…Noooooooo. I’d forgotten to turn off Energy Saver. The script had stopped when the laptop went to sleep, which is to say, right about when I went to sleep, which is to say, it hadn’t run overnight at all.
The goal had been to grab a ton of data from SoundCloud using their API, so that I could fill my database with useful test data against which to tune my algorithm. I’ve been working nonstop on this app idea I laid out exactly one month ago. It’s nominally my final project for CS50—due this Sunday!—but it’s become much more than that, as I always hoped it would.
Over Thanksgiving, I spent late nights coding at my grandma’s house in Wyoming, precariously connected to the internet over tethered cellular data. I generated piles of CSVs as I experimented with different properties that might indicate promising SoundCloud musicians inspired by artists a user follows on Rdio. My working title for the project was “Riser.” Since all my early files remained in the RIser folder, you can see the accumulated detritus of experimentation:
(Terminal sporting Erik’s dotfiles. They’re indispensable!)
As you can see, the folder was a mess. I’m philosophically okay with messiness (especially in the beginning of any new project), but I’ll admit that I added a needless layer of messiness by not using version control from the beginning.
Conceptual discomfort with version control was not the problem. I love using Git and GitHub; my GitHub profile shows 18 public repos—mostly forks of other projects—and I have 5 private ones (mostly original material) besides. The two main sticking points were subtler:
- To work with the Rdio and SoundCloud APIs, I needed to hand off some personal information through my app. In the beginning, I was just storing that info willy-nilly through the code. I eventually moved it to a credentials file (credentials.yml), but still had a nagging worry; I didn’t want to risk uploading a credentials file to GitHub.
- I especially didn’t want to “risk it” because I semi-remembered that I’d hit my limit of private repos on GitHub’s micro plan. (Free to students.)
In truth, I probably could have figured out what to do. My eventual solution was to delete one of my private repos (which was actually just an empty app, so it was good to get that cleaned up anyway) and to add credentials.yml to my gitignore file so that Git would, well, ignore it when deciding what to track and send to GitHub. A quick conversation with Erik was all it took to get me over the hump and into using version control (in a new folder bearing the project’s final, still-top-secret name) at last. But what’s funny is that I’d actually handled each of those situations once or twice before; they weren’t completely alien to me. Rather, the hurdles felt just unfamiliar enough that I held on to some resistance below the level of conscious awareness. Minute to minute, the sensation was: I just want to keep making my app better! But now I’m kind of disappointed not to have the full history of my progress preserved eternally on GitHub.
Next time will be better.
And the script that went to sleep? Well, that had a happy ending. After turning off Energy Saver with a flourish of righteous indignation, I spent some more morning minutes squinting at my screen (eyes slowly opening), improving the script, messing with my database, until it seemed like it was in better working condition. I set it running and then stepped outside to go get oatmeal from the cafeteria.
It was my first trip outside in…oh, about 36 hours.
I’m hopelessly hooked.