Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Diamond Kata Workshop

Diamond Kata Workshop

Done @ ncraft 2015, Paris

Tweet

More Decks by Jean-Laurent de Morlhon

Other Decks in Programming

Transcript

  1. Kata Given  a  letter,  print  a  diamond  starting  with  ‘A’

     with   the  supplied  letter  at  the  widest  point.   For  example:  print-­‐diamond  ‘C’  prints      A    B  B   C      C    B  B      A
  2. Kata >  A   A   >  B    A

      B  B    A >  D        A      B  B    C      C   D          D    C      C      B  B        A
  3. Boucardian Analysis Line Pad left Length Pad Middle * Line

    0  —-­‐A 3 4 n/a Line 1 —B-­‐B 2 5 1 Line 2 -­‐C—-­‐C 1 6 3 Line 3 D——-­‐D 0 7 5
  4. Questions • What approaches did you follow : Brute Force

    / Recycling Tests / Small Increment tests / Boucardian like analysis ? • Does TDD allows you to delete a test ? • Did you write a test that was too hard to make it pass ? • How did you enhance visually the code to count the spaces ? • Does extracting methods/functions on such a small piece of code is really necessary ?
  5. ?

  6. Going further • http://claysnow.co.uk/recycling-tests-in-tdd/ • http://alistair.cockburn.us/Thinking+before +programming • http://natpryce.com/articles/000807.html •

    http://blog.gdinwiddie.com/2014/11/30/another- approach-to-the-diamond-kata/ • https://github.com/sandromancuso/diamond_kata/