Hunter S. Thompson once said, “Anything worth doing, is worth doing right.”
There’s been some pushback on this that I think has merit with some folks saying “Anything worth doing, is worth doing poorly.” In other words, sometimes attempting something, and perhaps not fully succeeding is still probably worth doing. If I decide I want to bake some bread, but I’m convinced I need to use only artisanal hand-ground flour and yeast I’ve harvested myself to do it “right”, I may never get a sandwich. But if I’m willing to settle for some cheap white flour and yeast I bought at the store, I’ll probably get that loaf baked a lot sooner. It may be a poor substitution for my original goal, but I’m at least no longer hungry.
But, I’d argue, even then it’s worth making that loaf well and with some care.
When I first started this blog, one of my goals was to focus on how I approach problems and look into thought processes. Yesterday I was reminded of this. It was a small ask, a process to monitor if new rows were being inserted into a database daily. If there were no rows, it meant the logging process had broken and probably needs to be recycled. Now, let me be clear from the start, that this is not a life critical process. It is right now, much more a “nice to know” process.
So, first I wrote a query, nothing special, basically:
declare @count int
select @count=count(*) from bar.dbo.report_logs where date = cast(getdate() as date)
if @count = 0 exec msdb.dbo.sp_send_dbmail @recipients=’email@example.com’, @subject=’No rows’, @body=’check out the foo process!’
Now, my first instinct was to put that into a scheduled task and be done. But then I thought, “this should really be a stored procedure”. So I wrapped it in some code to turn it into a stored procedure.
Then I realized that I should really probably at least put a few comments in, namely who wrote it, when, and most importantly why. While it’s obvious WHAT it does, it wasn’t clear why we’d want this.
It’s at that point that I had the thought that if I were going to do this, I’d do it well.
So, what’s the difference between doing this well and right? In a more perfect world, I might actually have this process cycle the service in question. But then I’d have to have code to handle situations where the service doesn’t come up. And we’d have to file a change order to introduce a process that potentially would have an impact on a service. And we’d have to wait until the end of the month freeze window, and, well the list goes on.
So, while I’m not going to do all of that, I’m going to make sure the part I can and will do is done well, commented properly, and documented properly. The rest can wait until we really need it.
If you are going to do something, even if you do it poorly, do that part well.