Yesterday I facilitated the Ohce kata in a Barcelona Software Craftsmanship event.
Since I was facilitating, I didn't have the opportunity to write any code.
So, when I got home, I did the kata in Java using outside-in TDD and jMock.
I committed after each passing test and each tiny refactoring, so that you can follow the process if you feel like.
You can check the commits step by step here.
You can find the resulting code in this GitHub repository.
Thanks to all the attendees and to Magento Barcelona for kindly having us once more.
Update:
I improved the design in this new version of the code:
ohce is a console application that echoes the reverse of what you input through the console.
Even though it seems a silly application, ohce knows a thing or two.
- When you start ohce, it greets you differently depending on the current time, but only in Spanish:
- Between 20 and 6 hours, ohce will greet you saying: ¡Buenas noches < your name >!
- Between 6 and 12 hours, ohce will greet you saying: ¡Buenos días < your name >!
- Between 12 and 20 hours, ohce will greet you saying: ¡Buenas tardes < your name >!
- When you introduce a palindrome, ohce likes it and after reverse-echoing it, it adds ¡Bonita palabra!
- ohce knows when to stop, you just have to write Stop! and it'll answer Adios < your name > and end.
This is an example of using ohce during the morning:
$ ohce Pedro
> ¡Buenos días Pedro!
$ hola
> aloh
$ oto
> oto
> ¡Bonita palabra!
$ stop
> pots
$ Stop!
> Adios Pedro