Agile Mëtteg - 29 November 2012
Welcome to the dojo! If you want to code like a ninja you have to practice your katas!
A code kata is a simple exercise that allows a developer to improve his coding, testing & refactoring skills.
In this session you will practice pair-programming, TDD & clean code.
This session is for developers only!
2. BOW (REI)
Who are we?
Eric Ferrot (eferrot@agilepartner.net)
Cédric Pontet (cpontet@agilepartner.net , @cpontet)
Who are you?
Name
Company
Experience
Language
http://www.breakaway.cc/Asia/Japan/Japan-Bowing.php
29 Nov 2012 Agile Mëtteg – Coding Dojo 2
3. KATA
Kata is a Japanese word describing detailed
choreographed patterns of movements practiced
either solo or in pairs.
By practicing in a repetitive manner
the learner develops the ability to execute those
techniques and movements in a natural, reflex-
like manner.
The goal is to internalize the movements and
techniques of a kata so they can be executed and
adapted under different circumstances, without
型
thought.
29 Nov 2012 Agile Mëtteg – Coding Dojo 3
4. DOJO
A dojo is a Japanese term which literally means
"place of the way".
The term can refer to a formal training place for
any of the Japanese do arts but typically it is
considered the formal gathering place for
students of any Japanese martial arts style such
as karate, judo, or samurai, to conduct training,
examinations and other related encounters.
道場
29 Nov 2012 Agile Mëtteg – Coding Dojo 4
5. CODING DOJO / CODE KATA
Wikipedia
Kata (programming)
Dave Thomas (Agile Manifesto)
CodeKata
Laurent Bossavit & Emmanuel Gaillot
CodingDojo
Emilie Bache
Online resources for Coding Dojos
Coding Dojo Handbook
29 Nov 2012 Agile Mëtteg – Coding Dojo 5
6. GOAL
Practice of
Test Driven Design
Baby steps
Refactoring
Test
Acquire good
developer habits
Refactor Code
29 Nov 2012 Agile Mëtteg – Coding Dojo 6
7. FIZZBUZZ
Return “fizz”, “buzz” or “fizzbuzz”.
For a given natural number greater than zero return
“fizz” if the number is dividable by 3
“buzz” if the number is dividable by 5
“fizzbuzz” if the number is dividable by 3 and 5
Input Result
1 1
2 2
3 fizz
4 4
5 buzz
6 fizz
10 buzz
15 fizzbuzz
30 fizzbuzz
29 Nov 2012 Agile Mëtteg – Coding Dojo 7
8. TRANSFORMATION PRIORITY PREMISE
Transformation Description
{}–>nil no code at all->code that employs nil
nil->constant
constant->constant+ a simple constant to a more complex constant
constant->scalar replacing a constant with a variable or an argument
statement->statements adding more unconditional statements
unconditional->if splitting the execution path
scalar->array
array->container
statement->recursion
if->while
expression->function replacing an expression with a function or algorithm
variable->assignment replacing the value of a variable
http://cleancoder.posterous.com/the-transformation-priority-premise
29 Nov 2012 Agile Mëtteg – Coding Dojo 8
9. PRIME FACTORS
Compute the prime factors of a given natural
number
Input Result ([…] denotes a list)
1 []
2 [2]
3 [3]
4 [2,2]
5 [5]
6 [2,3]
7 [7]
8 [2,2,2]
9 [3,3]
29 Nov 2012 Agile Mëtteg – Coding Dojo 9
10. REFACTORING KATA
Emilie Bache
Can you refactor ? Yahtzee
In really small steps ?
Can you turn some,
frankly, ugly code into
a paradigm of elegant,
readable, extensible
design?
http://www.parentdish.com/2010/04/20/yahtzee-game/
29 Nov 2012 Agile Mëtteg – Coding Dojo 10
11. SAYONARA
What do you think ?
Feedback is welcome
Where to find Katas ?
Catalogs
• CodersDojo
• CodeKata
• CodingDojo
• Schuchert
Samples
• CodersDojo http://www.hoshuha.com/blog/japanese-bowing-etiquette.html
• Refactoring Katas
29 Nov 2012 Agile Mëtteg – Coding Dojo 11
12. Follow us
Agile Partner web site
http://www.agilepartner.net
Blog
http://blog.agilepartner.net
@agilepartner
http://www.facebook.com/agilepartner
http://www.slideshare.net/agilepartner
29 Nov 2012 Agile Mëtteg – Coding Dojo 12