One of my goals for 2017 is to make TDD katas a part of my daily routine. What is a Kata? Just as in martial arts it is training through repetition, practicing the same exercise again and again until you can do it in your sleep.
Some would say, it is the only way to learn TDD. This makes sense for several reasons: you start in a small, protected scope and can apply pure test driven development. This way you are able to train the different mindset (the red-green-refactor cycle) without frustration. It means, you will not have to learn working around the quirks of a framework at the same time.
TDD Tip #49: Focus on building good habits to make TDD your default behaviour #101TddTips pic.twitter.com/fO5fWh7khJ
— Codemanship (@codemanship) 6. Dezember 2016
You want to learn TDD but don’t feel comfortable yet, using it in real projects? Train with Katas, just 15-30 minutes each. Need motivation? Join me!
Every week I will post a new Kata that I want to repeat at least three times, and share learnings from the previous week. Here’s an RSS feed for the kata posts!
I’m planning to try out different programming languages and different test frameworks to get more comfortable with them. But if you are just starting out with TDD, you can as well stick with one. And if you are unsure when you should start using it “for real”, try this:
TDD Tip #48: A good way to know if you’re ready to apply TDD to commercial projects is when it doesn’t slow you significantly #101TddTips pic.twitter.com/Qp9HlQxg5w
— Codemanship (@codemanship) 5. Dezember 2016
First Kata: The Bowling Game
Uncle Bob’s bowling game kata is a famous one to start with test driven development
To get started, try to follow the steps in the Power Point as close as possible (Direct link to PPT)
It is even suggested to begin with very little steps, if this is your first kata, and only make the first test pass on your first day, move on when you internalized that one:
If you wish to try this style of learning, I suggest you proceed by memorizing it in short sections. Fully learn one section before adding the next. I have broken the kata up into five short sections. Learn each in order, and don’t learn the next until you have mastered the previous. Move slowly and deliberately. DO NOT RUSH. A kata needs to seep into your bones, and this take time.
My personal goals this week
- Try it out in Ruby
- Also do it in PHP, using Knapsack collections