Automatic hiking and Python code
I recently added forest hikes to my exercise routine.
It's actually crawling up and down trails on a giant forested hill, making it even more interesting. And it's been great. I've even worked out a standard route, which my magic calorie-counting device tells me burns about 700 calories.
But I noticed something interesting:
At first, when I did this route, it was tedious and hard. I mean, it's climbing up and down steep trails for an hour and half.
But now that I've done it a couple dozen times...
It just seems easy. Easy *mentally*. It's still hard physically. But I'll start my hike, pop in my earbuds, playing music or some lecture or something I want to hear...
And then I suddenly realize I'm halfway up the mountain. The difficult process has become automatic.
This reminds me of writing unit tests...
Especially when I'm doing test-driven development, which means I'm writing lots of tests... covering every last corner of what my program is doing.
Some of those tests are easy to write - like hiking downhill.
And some of those tests are really freakin' hard... like climbing up a steep, muddy, crumbly, narrow trail, between thorny bushes and a sheer cliff drop.
Here's what I've noticed: the more I do test-driven development, and the more I write unit tests...
The easier those difficult tests get.
They are still hard. But somehow, my attitude shifts, so my mind is just more willing to "stick with it". And it takes less and less WILLPOWER to endure through those tough spots. That's the key. It's not really easier; I just need to spend less willpower to accomplish it.
Of course, once you get to that place, you get a lot of other benefits too.
So ask yourself: how can you write more and better tests today than you did yesterday? And again tomorrow?