My Best Worst Program
Ah, Emacs! This is the first post written entirely in Emacs for robnagler.com after it was migrated from ViaRob. Yay!
The conversion program was non-trivial but still under 300 lines. The Python program reads BOP Wiki and outputs Kramdown-flavored Jekyll with an Nginx map for the redirects from viarob.com to robnagler.com to maintain backwards compatibility.
This was the Best Program I’ve written in a while, because it solved one problem, completely. A single file of code that addressed all the business requirements, which will never be used again, except as an example for this article.
Most of what I do involves tens of files to do anything, usually a lot more. Even when adding a line or two of code, I may have to read through tens of packages, comprising hundreds of files.
Much of my software seems to live forever. The BOP Wiki has been around since 2006, and will be in use for many years to come. That means writing tests, dealing with bugs, and eliciting feedback.
None of this is true about My Worst Program. I employed copy-and-paste liberally. There are no tests. I didn’t talk to anyone about it. There were plenty of bugs, but I dealt with some of them by editing the input files in Emacs with a macro, because that was faster. Other bugs were fixed after the fact.
However, even My Worst Program uses techniques that many programs seem to do without. I’ll list three of the most important here (in order):
Fail Fast to catch missed cases, e.g. there shouldn’t be any missed at-signs (@)
Constants bind concepts explicitly, and help me think clearly about them.
No naked prints, just out of religous habit.
I’m sure you have a different opinion, and feel free to email me at robnagler.com.
The important thing is that My Best Worst Program worked, and I’m happy to write that here in my favorite text editor where I now can commit changes to this article quickly and easily!