12
Agile Mëtteg – 29 Nov 2012 Coding Dojo

Coding Dojo

Embed Size (px)

DESCRIPTION

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!

Citation preview

Page 1: Coding Dojo

Agile Mëtteg – 29 Nov 2012Coding Dojo

Page 2: Coding Dojo

2

BOW (REI)

Who are we?Eric Ferrot ([email protected])Cédric Pontet ([email protected] , @cpontet)

Who are you?NameCompanyExperienceLanguage

29 Nov 2012 Agile Mëtteg – Coding Dojo

http://www.breakaway.cc/Asia/Japan/Japan-Bowing.php

Page 3: Coding Dojo

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

Page 4: Coding Dojo

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

道場

Page 5: Coding Dojo

5

CODING DOJO / CODE KATA

WikipediaKata (programming)

Dave Thomas (Agile Manifesto)

CodeKata

Laurent Bossavit & Emmanuel GaillotCodingDojo

Emilie BacheOnline resources for Coding DojosCoding Dojo Handbook

29 Nov 2012 Agile Mëtteg – Coding Dojo

Page 6: Coding Dojo

Agile Mëtteg – Coding Dojo 6

GOAL

Practice of Test Driven DesignBaby stepsRefactoring

Acquire good developer habits

29 Nov 2012

Test

CodeRefactor

Page 7: Coding Dojo

Agile Mëtteg – Coding Dojo 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

29 Nov 2012

Input Result

1 1

2 2

3 fizz

4 4

5 buzz

6 fizz

10 buzz

15 fizzbuzz

30 fizzbuzz

Page 8: Coding Dojo

Agile Mëtteg – Coding Dojo 8

TRANSFORMATION PRIORITY PREMISE

29 Nov 2012

http://cleancoder.posterous.com/the-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

Page 9: Coding Dojo

Agile Mëtteg – Coding Dojo 9

PRIME FACTORS

Compute the prime factors of a given natural number

29 Nov 2012

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]

Page 10: Coding Dojo

Agile Mëtteg – Coding Dojo 10

REFACTORING KATA

Emilie BacheCan you refactor ?In really small steps ?Can you turn some, frankly, ugly code into a paradigm of elegant, readable, extensible design?

29 Nov 2012

Yahtzee

http://www.parentdish.com/2010/04/20/yahtzee-game/

Page 11: Coding Dojo

11

SAYONARA

What do you think ?Feedback is welcome

Where to find Katas ?Catalogs• CodersDojo• CodeKata• CodingDojo• Schuchert

Samples• CodersDojo• Refactoring Katas

29 Nov 2012 Agile Mëtteg – Coding Dojo

http://www.hoshuha.com/blog/japanese-bowing-etiquette.html