I’m a still programmer, at least a little bit, no matter how hard I try. Let me try to explain why I haven’t yet posted my next “whaling” article.
Temptation
So in the midst of writing my “whaling” articles about the technical details of the Testing Grouplet’s work, I started talking a lot about programming, about concepts and consequences and all that. The next post in the series is at least half-, if not three quarters-done, and contains sections of what should resemble C++ code. And, as you can see, I use a lot of section headings, tables of contents, and footnotes. Though the Textile markup language I use to write the posts themselves handles a lot of things, maintaing tables of contents and footnote references is not one of them.1
Before I knew it, I had the itch to write a program. Though my background is
largely C++ and Python, I used Ruby, since I’ve dabbled in it to write other
small scripts for this blog, and I enjoy learning new languages, new ways of
expressing a programming concept. The first version only handled the footnote
references, and was pretty short. But I realized keeping the table of contents
current and correct was kinda painful too. So, in the interest of good
Object-Oriented Programming, I factored out a FootnoteUpdater
class and a
TableOfContentsUpdater
class. After setting up a stripped-down version of a
blog post for testing, I tweaked and polished this script ’til I got it just
right. Mission accomplished!
Going Nuts
Well, not so fast there, pal. As part of my earlier post on Object-Oriented Programming, I started gushing with enthusiasm about the Go programming language. I’d never really used it before at Google or for anything else, but since I was in a programming frame of mind, and I just wrote a small, yet useful object-oriented program in a dynamically-typed language, and I’d just gone on about how excited I was about Go, and I started wondering how easy it would be to do the same in Go and how much code Go would take… You see where this is going, right?
Well, I’m happy to say Go exceeded my already-inflated expectations by far. The code was a little more verbose, but not by much. The programming environment afforded by the Go tools and their conventions is soooo damn nice—at least if you’re a Vim and command-line type like me. If you’re not, Go may make a believer out of you. I mean, it compiles fast, tests fast, testing and doc and formatting tools are built in… It gives you remarkable power, and then gets out of your way!
Granted, I didn’t even begin to touch some more advanced features, especially the channel-based concurrency features. But, I wrote my first real Go program to solve a real problem—no matter that I already wrote a Ruby program to do the same identical thing—and kind of fell in love with programming all over again. I did, in fact, go nuts.2
Evidence
Oh, but that’s not enough for me yet, friends. I’m not thinking of going back into tech—I’m still dead-set on Berklee in the spring—but I have to admit there’s a piece of me that likes this coding stuff, always will, and aches to share what I can and get feedback in kind. To that end, I offer my humble scribblings to whosoever is curious via my new Google code project. It’s not mind-blowing code, and there’s not much of it, but I’m having too much fun not to at least put it out there to potentially share, and to convince some of my friends to give Go a spin.
And so, now I leave you with the Ruby version of my post-formatting program, which is very short and (relatively) elegant: update_post.rb
And the Go version, nearly as short, if a bit overengineered: the update-post.go driver and the updaters.go module containing the core logic—along with updaters_test.go, which I wrote after the fact, using Go’s built-in testing support
Enjoy! And now that I’m out of excuses, I’ll get back to the “whaling” business shortly.3
Epilogue
Here it is five years later, November 19, 2017, and what am I doing? Updating my blog sources from Textile to Markdown. Markdown eventually pulled ahead as the plaintext markup of choice across the industry, and before I do any sort of large-scale overhaul of my blog, I’m working through the conversion process.
Pandoc and tomd helped, but didn’t quite finish the job. Part of what
I’m having to do by hand is convert all my old internal links to use the
Jekyll link
tag, which helps with validating paths during the
site building process.
The other thing I’m having to do? Replace my custom footnotes with Kramdown footnotes. I’m still preserving a little bit of namespacing, and the Table of Contents update doesn’t preserve namespacing at all, but for in-page anchors, I’m not too worried about the change to the new format. I’m just glad not to have to run a separate program anymore.
Footnotes
-
Well, it does support footnotes to some degree, but since the front page of the blog has multiple articles, the Textile footnotes aren’t ideal since they can’t guarantee unique element IDs. For that reason, I like to specify post-specific prefixes to each footnote ID, as well as each section headline ID. Plus, I’d still have the issue of having to update the footnote numbers manually, anyway. ↩
-
Go’s entire world is full of puns. The mascot is a gopher. Check out the FAQ, particularly the first section, “Origins”. ↩
-
And yes, of course, I did run the Go version of the update-post filter on this very post. ↩