The Best Code You'll Never Write

CREDIT: markusspiske via pexels (CC0/2.0)

Among the software I’ve delivered recently, one script especially stands out. It’s a modest thing, retrieving data from a sequence of scheduled tasks, but it’s remarkable for what it isn’t.

First, the setting.

Every evening a set of tasks aggregate key metrics from across our service ecosystem and cache the results in Amazon S3. The data lie there largely forgotten until questions arise that other dashboards and stores can’t answer.

They aren’t gathering dust in S3 for a lack of value: rather, the insights they contain could inform many questions important to the business. But the parties most interested in them are infrequent AWS users from sales and marketing with little patience for spelunking into our infrastructure.

“Aha!” I thought. “S3 is the problem! If we can just get these data onto everyone’s desktops, they can start referencing them in their day-to-day jobs.”

I rolled up my sleeves, and by afternoon had a short script for scraping the relevant data into a local directory. It was accessible: given a configured instance of s3cmd, the user wouldn’t need to know anything about our AWS configuration (or track down their rarely-used credentials). It was clever, too, recursing its way through the bucket to mirror its structure within the local directory.

But as I finished writing out the usage instructions, it struck me: what I had just written already existed. s3cmd sync.

Face, palm.

Out went the script, and in came its nearly trivial replacement:

s3cmd sync "s3://${BUCKET}"

I grinned to myself. Not for the time wasted during the morning, of course, but for the thirty seconds it took to delete my script for one with maintenance requirements hovering near absolute zero.

See, writing software is easy. But pity the developer who writes it without regard to the costs of upkeep and maintenance — and rejoice in those fortunate times they can be avoided entirely!

Stand on the shoulders of giants, with their thorough documentation, clean interfaces, vibrant communities, and regular bugfixes! And us, my friend? Let’s save our energy for the problems yet to be solved.