Intro to TDD

Why TDD?

  • Debugging : TDD means less debugging since you run your application and see it work every other minute

 

  • Courage : TDD provides developers a safety net for improving or extending an application

 

  • Documentation : The tests describe how to use a method and what to expect from it

 

  • Design : TDD enforces decoupling, this drives to cleaner, more flexible and more maintainable design

The 3 laws of TDD

You are not allowed to write any production code unless it is to make a failing unit test pass.

 

You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.

 

You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

Roman Numeral Kata

We would like to be able to convert Arabic numbers into their Roman numeral equivalents.

We just need some kind of program that can accept a numeric input and output the Roman numeral for the input number.

 

     1 --> I
     10 --> X
     7 --> VII

          etc.

 

Arabic #  Roman # Arabic # Roman #
1                I                8                VIII
2                II               9                IX
3                III              10              X
4                IV              20              XX
5                V               30              XXX
6                VI              40              XL
7                VII             50              L

60              LX             400            CD
70              LXXX        500            D
80              LXXX        600            DC
90              XC            700            DCC
100            C              800            DCCC
200            CC            900            CM
300            CCC         1000          M

 

         
 

Examples

 

Arabic # Roman #    Thousands    Cents    Tenths    Units
846         DCCCXLVI        -                   DCC       XL            VI
1999       MCMXCIX        M                 CM         XC           IX
2008       MMVIII             MM             -              -               VIII

 

         
 

Links

Made with Slides.com