Your legacy code matters
Craig Hockenberry tweeted about some stuff a couple nights ago:
That site was built with using 1997’s state-of-the-art HTML and CSS. Eighteen years later, it still renders as we intended.— Craig Hockenberry (@chockenberry) November 18, 2015
On the other hand, an app I wrote in 2008 can no longer run on any device or OS version. It’s completely lost to time.— Craig Hockenberry (@chockenberry) November 18, 2015
There’s a whole generation of young iOS developers who don’t lament leaving a legacy of work. But they will.— Craig Hockenberry (@chockenberry) November 18, 2015
Meanwhile, I’m back in Virginia for Thanksgiving and, on a lark, decided to start digging through my closet. I found some old shirts and some bad fantasy novels and a couple floppy disks filled with some of my first programming:
- A Dreamweaver site I built for one of my work-in-progress “novels”
- An RPG built in Visual Basic
- A “guess your number” Java applet
It was great to actually poke around these things (thanks to the equally old PC we have which still sports a floppy drive.) I’m impressed, for instance, that my ability to give variables descriptive names was actually pretty strong for a middle schooler before I discovered the gospel of
var x in high school. 1
It felt like flipping through an old grade school yearbook.
My first commit is for a repository called vivi. It’s the first steps towards a Python static-site generator, with a couple blog posts thrown in for good measure. It features tabs in lieu of spaces, but the code is still pretty Pythonic beyond that.
More striking to me than the actual commit, though, was the time at which I wrote it: August of 2012, when I spent the summer in Seattle as an intern in the U District.
I didn’t have many pictures of that summer: it was a quiet and somewhat lonesome one. But browsing through this repository, I remember so much — the long afternoons spent biking the Burke-Gilman trail, the evenings spent happily holing myself away with an IDE and Sinatra’s discography. It makes me feel warm.
I spend a good chunk of my free time developing for iOS. I like the platform; I like Swift; I don’t necessarily like Apple, but I think they make very nice products, and I generally enjoy the time I spend inside XCode.
The repository to which I’ve pushed the most commits is Barback, a Swift app. Between Swift’s rapid evolution and my own rapid maturation as a mobile developer, the sense of legacy code nostalgia is compressed. I look back at commits from a year ago and chuckle at my ignorance 2.
I worry, as Craig says above, that all of these artifacts will be rendered unretrievable. Will I be able to compile Swift five years from now? Will I be able to run this code on an iPhone five years from now?
The answer is probably no.
Programming is an important part of who I am. I’ve spent more than half of my life developing things — for work, for fun, for the unmeasurable thrill of creation and discovery. Those artifacts are just as important as Instagram photos or grade-school yearbooks: they are reminders of who you were and where you’ve come from.
Old code is absolutely worth preserving. (The ability to run it, too.)
Spend some time digging through the artifacts of your (recent or otherwise) youth. You may be delighted with what you discover.