Inside Architecture

Notes on Enterprise Architecture, Business Alignment, Interesting Trends, and anything else that interests me this week...

Coding Dojo suggestion: the decorator kata

Coding Dojo suggestion: the decorator kata

  • Comments 3

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.

  • 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.
  • 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.
  • 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.
Page 1 of 1 (3 items)