Drafts in Six Lines of Code
A few years ago, I came across a presentation1 that Brian Kernighan gave back in 2009 called The Elements of Programming Style, a title borrowed from his book of the same name. In it, he made one point which I think applies equally well whether you are writing words or code.
So, there’s a balance that you have to find between too clever and - not clever enough - being kind of dim about what you’re doing
With this in mind, I took another look at the “drafts” script I mentioned in my last post. Thinking about the problem a bit more, I’ve found that Kernighan’s observation was precisely the problem I was having all along. Although I could read the script, and understand what it was doing, I didn’t really grasp why.
My knowledge of Make is not very deep and AWK even less so. As I hadn’t thought about this for some time and it’s usually easier to deal with the devil you know than the one you don’t, I ultimately decided to rewrite it in Ruby.
5 minutes of work, 6 lines of code, and (hopefullly) the incentive to write more often.
I am always impressed by how “down to Earth” Kernighan is every time I hear him speak.⏎