I didn’t do the best possible thing in this morning’s XST article. Here’s what I think about that.
As those who can stand the series will read, this morning in XST 26, I wrote 35 or 40 lines of code supported only by a test that asserted that there would be two records in the output. There are three or four loops in the code, three methods, three or four XSets, including a couple of nested ones. I made two typos and no logic errors. The output is correct, not just in count but in content.
However, as I wrote the code, I could feel that I was out on a limb. I wrote one subordinate method with no test, and wrote another one in line and then extracted it, on a red bar no less.
A strict TDD master would crack my knuckles for thatt, and in fact I did get off easy: I’ve fallen into an hour or two of mindless debugging in similar situations. I think I was aided by the fact that I had a good mathematical idea what I was up to, but even so I was fortunate not to have gotten in more trouble.
Do I beat myself up for that? No, I do not. Do I assign blame to me for this potentially messy situation? No, I do not.
Why? Because I know that in the moment, I was always doing the best that I knew to do in that moment. Yes, I’m sure that there was a second when I thought “Now I’ll make the match record”, and at that moment I should have said “So I’ll write a test for it first”, but I didn’t think or say that, I had the idea in my head and I ran with it.
It’s not like I said “I should write a test for this thing here” and then said “Moohahahah you tiny fool, no test for you!” and ran off into the darkness to commit even more evil acts.
I was giving the best that I had to the problem, to the code, to the article, and to myself. I don’t think there’s anything to “forgive”, but if there is, I forgive myself. Why would you need to forgive yourself for putting everything you have, in that moment, into what you’re doing. No forgiveness necessary.
But sometimes we do blame ourselves, and even more often, we blame others. Joe, you should have written a test for that. Jane, you should have refactored that better.
No. Joe and Jane, just like Jeffries, were putting everything they had into the work, everything that they had, in that moment, to give.
Joe was wondering how his sick cat was doing. Jane was trying to work out what to give Joe for his birthday. Jeffries wasn’t particularly distracted, he just wasn’t 100 percent on his game.
We’re all doing our best up in this world, and we need to forgive ourselves, forgive others, always.
Better yet, drop the whole blame notion. It’s not helpful. And then no one around us needs our forgiveness. That could be a very good thing.