Wallogit.com
2017 © Pedro Peláez
Uncle Bob's bowling kata done in PHP.
This repository is a PHP-based starter-kit for multiple TDD Kata., (*1)
composer installwill install PHPSpec and handle autoloading., (*2)
PHPSpec can be accessed at bin/phpspec from the root folder of the project., (*3)
The idea of the kata is that you're not thinking about how to solve the problem of the bowling game. But, rather you're memorizing the flow of building it using TDD. The problem is already solved, as you can see in the attached document. Each step is already defined. Simply memorize all of step one and do it until you have it mastered, then add another step. Once you can do the entire exercise out of memory, you'll be able to start reaping the benefits., (*4)
What are the benefits exactly? The kata (much like kata in Tae Kwon Do) are about repetition. Utilize your best IDE shortcuts, do everything in the best way possible. Repeat the exercise often and you'll cement into your mind many small problemsolution combinations. In this way we can build the skills necessary to be able to apply TDD in increasing frequency in our work., (*5)
Just like you've probably learned to type QWERTY using poor form, learning another layout like DVORAK could give you the opportunity to type with better form. But that only works if you practice using EXCLUSIVELY good form. Do not consider this exercise if you're going to use poor form. Use your best, most powerful tools(IDE shortcut combinations, etc), and try to improve your execution of the kata every time you do it., (*6)
The following excerpt pulled directly from http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata, (*7)
Here is a kata for the Bowling Game problem. I have broken it down into the same tiny little steps that I do when I demonstrate it. However, as is usual for a kata, I have left out most of the explanatory comments., (*8)
A kata is meant to be memorized. Students of a kata study it as a form, not as a conclusion. It is not the conclusion of the kata that matters, it's the steps that lead to the conclusion. If you want to lean to think the way I think, to design the way I design, then you must learn to react to minutia the way I react. Following this form will help you to do that. As you learn the form, and repeat it, and repeat it, you will condition your mind and body to respond the way I respond to the minute factors that lead to design decisions., (*9)
Michael Feathers has long pondered the concept of "Design Sense". Good designers have a "sense" for design. They can convert a set of requirements into a design with little or not effort. It's as though their minds were wired to translate requirements to design. They can "feel" when a design is good or bad. They somehow intrinsically know which design alternatives to take at which point., (*10)
Perhaps the best way to acquire "Design Sense" is to find someone who has it, put your fingers on top of theirs, put your eyeballs right behind theirs, and follow along as they design something. Learning a kata may be one way of accomplishing this., (*11)
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., (*12)
[Uncle Bob's kata document](kata/Bowling Game Kata.ppt) shows the steps of the kata., (*13)
Watch Shawn McCool run through this exercise using PHPStorm and PHPSpec., (*14)
Watch Kacper Gunia run through this exercise using PHPStorm and PHPSpec., (*15)
Here are the sections to memorize:, (*16)
There is also a preamble section entitled "A Quick Design Session". This is part of the kata when demonstrating TDD to others, but is not part of the "Design Sense" of the kata itself., (*17)
The follow exrcept is pulled directly from Roy Osherove's blog., (*18)
The following is a TDD Kata- an exercise in coding, refactoring and test-first, that you should apply daily for at least 15 minutes (I do 30)., (*19)
Before you start: - Try not to read ahead. - Do one task at a time. The trick is to learn to work incrementally. - Make sure you only test for correct inputs. there is no need to test for invalid inputs for this kata, (*20)