karumi dojo. tdd roman numerals

14
Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs Karumi Dojo Pedro Vicente Gómez Sánchez Android Expert at Karumi [email protected] @pedro_g_s github.com/pedrovgs

Upload: pedro-vicente-gomez-sanchez

Post on 06-Aug-2015

434 views

Category:

Engineering


2 download

TRANSCRIPT

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Karumi DojoPedro Vicente Gómez SánchezAndroid Expert at Karumi

[email protected]@pedro_g_sgithub.com/pedrovgs

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Irene HerranzManaging Director

Alberto GrageraTechnical Director

Jorge BarrosoAndroid Expert

Davide MendoliaFull Stack Engineer

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Karumi Dojo● We are here to practice and learn.

● This is a bullshit free environment.

● This exercise meant to be collaborative, not competitive.

● Try to open your mind to new concepts.

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Karumi Dojo● We are here to practice Test-Driven Development.

● TDD is a software development process, not a dogma.

● We are going to practice pair programming.

● Keep always in mind the TDD Cycle.

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Rules:

● Write enough test code so that to get a single test failure.

● Write enough production code to get all your tests to pass.

● Refactor until the code is Simple/Clean.

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Rules: The TDD Cycle

RED

GREENREFACTOR

3. Simplify and clean your code.

1. Write a failing test.

2. Make the code work.

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Roman NumeralsThe Romans wrote numbers using letters - I, V, X, L, C, D, M.

The Kata says you should write a function to convert from normal numbers to Roman Numerals: eg

1 --> I

10 --> X

7 --> VII

For a full description of how it works, take a look at http://www.novaroma.org/via_romana/numbers.

html.

* There is no need to be able to convert numbers larger than 3000.

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Tips● Baby steps.

● Don’t lose the green.

● Choose the language you prefer.

● Refactor your code.

● Build errors are not failing tests.

● Follow the TDD Cycle.

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Roman Numerals bonus:● Write a function to convert in the other direction, ie

numeral to digit. Eg:

I --> 1

X -> 10

VII --> 7

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Extra points

Pedro V. Gómez Sánchez - [email protected] - @pedro_g_s - github.com/pedrovgs

Contract testing

● Contract tests check if the contract defined by a interface is implemented properly.

● Using inheritance we are going to create a base test cases which every implementation has to execute.

● Take two different sorting algorithms and apply this technique.