A while ago I started to play a little game when doing test-driven development:
Every time I run my microtest, I predict the outcome. Will the test fail or pass?
When my prediction was right, I continue. When it was not right, I investigate and explore why my code behaved differently than I thought it would be. I will not simply go on and poke around (though I do that frequently, too) but really try to understand why my expectation of the code’s behavior was different to reality.
When I found the cause for the wrong prediction, I try to learn from reality and grow my knowledge about the code. Sometimes I not only find gaps in my knowledge but also flaws in my work process or in the way I do things.
I found this game to be a very powerful tool of learning. I’m still not very seasoned in doing it, but it’s something I want to practice more often.
Today I realized that I can not only use this technique for TDD, but for many different things in software development and also life. We are constantly predicting what will happen, what consequences our actions will have:
Will my code work after merging that branch?
What will change when I change this setting?
Will I catch the bus when I go now?
Will I need an umbrella today?
How will my co-worker react to the feedback I give him?
We constantly predict, but I usually don’t evaluate the outcome in reality and explore the reasons when my prediction was wrong. In not doing the evaluation and exploration, I probably miss a powerful tool to consciously learn and instead stick with a very unconscious and probably tedious trial-and-error approach.
That’s something I want to change: What will happen when I start to notice the predictions I’m doing all the time, when I consciously evaluate their outcome and explore why my prediction was wrong?
My prediction is that I will not only learn faster and become more aware of myself and the things around me, but might also find flaws in my thinking, in the way I approach things and in beliefs I hold.
Sounds like quite some effort and also a bit scary, but I want to try it out.
I would love to hear your thoughts on that!