Confessions of a Closet Programmer
Previously on this blog, Vincent talked about learning Java. That reminded me of this post that I had kept as a draft for a very long time. It’s more like a (really) short story, though. I guess it just a love story about Ruby and perils of having too much time on your hands.
I have a confession. I recently wrote a program, or maybe it’s just a script. I’m a bit ashamed to confess this, because it serves little if any purpose.
You see, one group of my friends hang at this irc-channel where they post occasionally funny links. The problem, of course, is that you’d need a connection to IRC to see what’s going on in the channel and IRC is usually blocked at any public or work access points. It’s also a pain to keep track of all the links unless you’re online all the time, 24/7.
So, having some time on my hands, I started writing a little Ruby program that would parse the irssi logs for all links and publish the latest ones as an Atom/RSS feed. Thanks to the open source movement, it was easy to find a library, atom-tools, that would do the heavy lifting of writing out the XML of an Atom feed. I decided writing the regular expressions to parse the logs was enough so I could say I had actually done something myself.
It was fun. And I got to use Transmit and love its feature-I-now-can’t-live-without Edit With <editor here>.
“Why Ruby?”, you might ask. Because it’s the only language, which syntax I remember and to which I remember where the documentation is (thanks RDoc ). Publishing this little gem (in figurative sense, not as a ruby gem) on my friend’s server pointed once again the blocking problem of Ruby. My friend’s Debian box had an outdated version of Ruby and when I finally (okay, it took a day after I hinted about that) got him to update that it was still missing IRB (Ruby’s interactive shell). Debian doesn’t like rubygems, so I had to add atom-tools library the hard way. Running the script on Apache through something like mod_ruby or mod_fcgi or something? I chose to run the script as a cron job instead. Deploying my little ruby script was a pain. Had I written a php, python or perl script I would’ve no doubt avoided some of the obstacles, but my main idea was not to actually have a script converting irssi logs to feeds, but enjoying writing a program, i.e. coding.
But I wasn’t satisfied after the script started to write out every hour the latest links on our irc-channel. There were so many features I could add to it! I could make it so that instead of just linking to an image, it could also display the image as inline content! I could make it better! I could make it faster! I have the technology!
I wasn’t satisfied with the code. It wasn’t poetry, but the source was still… ugly. I wanted to make little classes out of everything. Make it more general and modular. To give rhythm to the code. (I blame myself for reading The Ruby Way).
I was over-engineering. The script was done. It did what I had wanted it to do. But I wasn’t satisfied, I wanted more. There were still bugs to fix.
If you have a burning desire to parse links out of your irssi logs with Finnish dates in timestamps, the code is available … at request.
Related posts:
Like









