In software we do our practicing on the job, and that’s why we make mistakes on the job. We need to find ways of splitting the practice from the profession. We need practice sessions.
Code Kata is an attempt to bring this element of practice to software development. A kata is an exercise in karate where you repeat a form many, many times, making little improvements in each.
—Dave Thomas, Agile Manifestor Co-Author and Author of The Pragmatic Programmer
From Dave Thomas' Code Kata site.
Today we'll be working on a code kata called the Greeter Kata that I have customized for the exercise. The intent of this kata is to give the team an opportunity to get a feel for the Test-Driven Development (TDD) workflow without dealing with the challenges of a large scale codebase that was not written test-first. It will incrementally introduce some common challenges and approaches for dealing with them.
Upon logging into ACME Online Systems a user will be greeted. The greeting will welcome them and display their work for the day.
- Given a name of the current user welcome them to the system via a message.
- Adjust the message based on the time of day in the current timezone
- 5am - 12pm - provide a morning message
- 12pm - 5pm - provide an afternoon message
- 5pm - 7pm - provide an evening message
- 7pm - 5am - provide a night message
- Display a birthday message on the user's birthday - Append to the greeting "have a great birthday!"
- Display the user's age in the birthday message
- For this exercise we are only going to be building a console application so we don't have to introduce presentation code and frameworks.
- There are some classes already defined to help get you started (User & TimeProvider)
- Install Mobster to manage drivers in the session
- ALWAYS start in the test
- Just enough test code to fail
- Just enough production code to pass
Now Repeat