I ran across a posting by Robert Martin on the Coding Dojo and I admit to being intrigued.  I’m running a low-priority thread, in the back of my mind, looking for good examples of kata to use in a coding dojo.

Here’s one that I ran across in a programming newsgroup.

You have an app that needs to be able to read a CSV file.  The first line of the file specifies the data types of the fields in the remaining lines.  The data type line is in the format


For example:

you must use a decorator pattern.  The decorator must be constructed using a builder pattern that consumes the data type line.  Output is a file in XML format

   <row><name>Joe Black</name><zipcode>90210</zipcode>… </row>

Any row that doesn’t match the specification will not produce an output line.  The output will pick up with the next line.  The file, when done, must be well-formed.

Of course, with a kata, the only thing produced at the start is the set of unit tests (and perhaps, in the interest of time, the frame of the classes from a model).  The rest is up to the participants.

Comments are welcome, of course.