//Coding Dojo suggestion: the decorator kata

Coding Dojo suggestion: the decorator kata

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

[fieldname:typename],[fieldname:typename],…,[fieldname:typename]

For example:
[name:string],[zipcode:int],[orderdate:date],[ordervalue:decimal]

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

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

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.

By |2005-08-09T04:50:00+00:00August 9th, 2005|Enterprise Architecture|3 Comments

About the Author:

President of Vanguard EA, an Enterprise Architecture consulting firm in Seattle focused on the Pacific coast of the US. Nick has over 30 years of professional experience in management, systems, and technology. He is the co-author of the influential paper "Perspectives on Enterprise Architecture" with Dr. Brian Cameron that effectively defined modern Enterprise Architecture practices, and he is frequent speaker at public gatherings on Enterprise Architecture and related topics. He coauthored a book on Visual Storytelling with Martin Sykes and Mark West titled "Stories That Move Mountains".

3 Comments

  1. Hoplog August 23, 2005 at 5:28 am - Reply

    Na ?amach swojego bloga Nick Malik zaproponowa? bardzo ciekawe ?wiczenie maj?ce na celu utrwalenie wiedzy o dw&#243;ch wzorach projektowych: Builder i Decorator.

  2. Hoplog August 24, 2005 at 9:57 am - Reply

    Na ?amach swojego bloga Nick Malik zaproponowa? bardzo ciekawe ?wiczenie maj?ce na celu utrwalenie wiedzy o dw&#243;ch wzorach projektowych: Builder i Decorator.

  3. Hoplog August 29, 2005 at 3:50 am - Reply

    Na ?amach swojego bloga Nick Malik zaproponowa? bardzo ciekawe ?wiczenie maj?ce na celu utrwalenie wiedzy o dw&#243;ch wzorach projektowych: Builder i Decorator.

Leave A Comment

three × 5 =