Day 7: Practice Makes Pefect
It is quite often said that repetition is the mother of learning.
However, I never really saw how that can be applied to programming. How can solving the same problems over and over again help me improve? It might make me type faster, but certainly not program more efficiently.
Therefore, when I first heard of coding katas, I was sceptic. In all honesty, it was really difficult for me to see the true benefit of it all. Nevertheless, this is the time to be open to different ideas and try out new things, without my baseless convictions weighing me down. So today I decided to try one.
The challenge was to solve the famous FizzBuzz problem using TDD As If You Meant It. Here are its rules:
Sounds simple enough, I thought. But humans are complex beings, and we quite often have the tendency to make simple things more complicated than they should be. Thinking small is just not in our nature; when presented with a problem, we go straight to the bottom of it - and more often than not we get stuck there. I made the same mistake today. It was just so hard for me to look at a simple problem simply, to start with tiny steps and slowly build my solution. I just had the inexplainable urge to skip through everything and write the final solution. Everything else seemed like a waste of time.
As the kata progressed, I started to see the error in my ways. Sure, FizzBuzz is an easy problem, and it can be solved perfectly fine without TDD. But reasoning about an easy problem in a simple way, teaches us how to do the same for large and complex ones. Besides, achieving small victories along the way makes the programming experience much more enjoyable, than writing the entire solution in one go and spending hours debugging it.
Needless to say, 45 minutes passed by very quickly. We didn’t finish the task in time, but that didn’t matter. What mattered is what we learned and how we improved our skills, even if it was for just a small margin. Another thing I took away from this experience is that katas are not about repeating the same thing infinite times in the hope of mastering it. Yes, you solve the same problems multiple times. But you can also solve them in different ways. Using TDD, not using TDD, using a functional approach, not using any loops… the possibilities are infinite. The ability to adapt to different circumstances is an incredibly useful skill to have, especially in programming.
Finally, I am happy that this experience today proved me wrong. Katas ARE cool. And thinking small does not show our inability to grasp a problem in its entirety, but rather the opposite: it takes true knowledge - and sometimes even a touch of genius - to be able to do it. For any problem. Any day. Under any circumstance.
I guess that is what makes us masters in the end.