GLOBAL DAY OF
CODERETREAT
Munich,
November 18, 2017
@DAVIDVOELKEL
@codecentric
@softwerkskammer
#TDD
WHAT IS A CODERETREAT?
1 DAY
1 KATA
1 DAY
1 KATA
6 SESSIONS
6 PAIRING PARTNER
6 CONSTRAINTS
Hidden Slide Slower
2000 Developers
100 Cities
6 Continents
18 Time zones
GLOBAL DAY OF
CODERETREAT
ROLES
HOST
&Z?jBrA+>y(r
ROLES
HOST
FACILITATOR
&Z?jBrA+>y(r
ROLES
HOST
FACILITATOR
&Z?jBrA+>y(r
YOUR PAIR
ROLES
HOST
FACILITATOR
&Z?jBrA+>y(r
YOUR PAIR
YOU
WHY A CODERETREAT?
@ DAY JOB
@ DAY JOB
NO ROOM FOR
LEARNING &
IMPROVEMENT
A SAFE PLACE
NO TIME PRESSURE
A SAFE PLACE
NO TIME PRESSURE
BE RESPECTFUL
GOALS
FUN
GOALS
FUN
LEARN
CHALLENGE YOURSELF
Experiment
Stretch your
comfort zone
Learn new practices
FOCUS ON
finish the problem
doing it right
practicing
improvement
DELETE YOUR CODE
After each session
WHY RESET?
Clear your mind
Focus on different goals
Get to the same level
ORGA
PREREQUISITES
Coding Environment
Testing Framework
VCS (e.g. Git, Mercurial)
Local Sponsors
Hidden Slide Slower
PLEASE
Ask for help
Use the feedback wall
=>
AGENDA
Intro
Session 1-3
Lunch
Session 4-6
Closing Circle / Retro
KATA
TIC TAC TOE
3x3 Board
Player "X" and "O"
Player with 3 in one line wins
• horizontal
• vertical
• diagonal
SESSION 1 PART 1
"THE TEST LIST"
Goal
Understand
• the problem
• its test cases
SESSION 1 PART 1
"THE TEST LIST"
Collect a list of tests in a text file
(no coding yet!)
SESSION 1 PART 1
"THE TEST LIST"
Collect a list of tests in a text file
Player with 3 in one line wins
• horizontal
• vertical
• diagonal
SESSION 1 PART 1
"THE TEST LIST"
Sync
What tests do you have? Names?
Test categories? Dimensions?
Combinatorics?
SESSION 1 PART 2
"TEST FIRST"
Write a test and let it fail
Write the simplest possible
implementation that the test runs green
SESSION 1 PART 2
"TEST FIRST"
Why?
Set a clear goal
no YAGNI
Separate API from Implementation
Causality: Red->Green
Testing discipline, high coverage
early ROI
SESSION 1 PART 2
"TEST FIRST"
Write several tests and let them fail
SESSION 1 PART 2
"TEST FIRST"
Sync
Which tests did you write? Naming?
Object under Test?
Representation of Fields?
PLEASE LINE UP!
HOW IS YOUR EXPERIENCE
LEVEL WITH TDD?
SESSION 2
"TDD + PING PONG"
GOALS
Learn TDD
Change pairing roles often
SESSION 2
"TDD + PING PONG"
TDD
= test-first + refactoring
= red, green, refactor
SESSION 2
"TDD + PING PONG"
Focus
write test: what should code do
implement: solve the problem
refactor: good design
SESSION 2
"TDD + PING PONG"
Uncle Bob’s 3 Rules of TDD
1. You can't write any production code until you
have first written a failing unit test.
2. You can't write more of a unit test than is
sufficient to fail, and not compiling is failing.
3. You can't write more production code than is
sufficient to pass the currently failing unit test.
SESSION 2
"TDD + PING PONG"
TDD GOALS
Incremental & Clean Design
Fast Feedback
SESSION 2
"TDD + PING PONG"
Ping Pong Pairing
1. Alice writes failing test
2. Bob makes test green
3. Bob writes failing test
4. Alice makes test green
5. Alice writes failing test
6. …
SESSION 2
"TDD + PING PONG"
Uncle Bob’s 3 Rules of TDD
1. You can't write any production code until you
have first written a failing unit test.
2. You can't write more of a unit test than is
sufficient to fail, and not compiling is failing.
3. You can't write more production code than is
sufficient to pass the currently failing unit test.
Do refactor duplication and improve names
SESSION 2
"TDD + PING PONG"
Sync
What did you observe?
What did (not) work?
What about design/refactoring?
How did pairing work?
SESSION 3
"BABY STEPS TDD"
LEARNING GOALS
Why are baby steps important
How to achieve baby steps
SESSION 3
"BABY STEPS TDD"
change 1
Initial code state
change 2
state 1
state 2
…
change n
target code state
● slow feedback
● high risk
● exponential complexity
● problems hard to find
LEAP
SESSION 3
"BABY STEPS TDD"
get green asap
● commit on green
● revert to green
change 1
Initial state
change 2
state 1
state 2
…
change n
target state
BABY STEPS
SESSION 3
"BABY STEPS TDD"
+ fast feedback
+ less risk
- a bit more effort
change 1
Initial state
change 2
state 1
state 2
…
change n
target state
BABY STEPS
SESSION 3
"BABY STEPS TDD"
Start a 2 min. timer when you get red
When back to green reset the timer and
When timer rings and you are still in red
git reset --hard
git commit
SESSION 3
"BABY STEPS TDD"
Sync
Did you get better during the session?
How did it work, was it hard?
How did you achieve baby steps?
SESSION 4
"CLEAN CODE"
GOALS
Readable Code
Maintainable Code
SESSION 4
"CLEAN CODE"
Clean Code constraints
"Code Swap" at the end
SESSION 4
"CLEAN CODE"
Constraints
Use good names
No duplication > 2 times
Single Responsibility
Max 4 LOC / method
SESSION 4
"CLEAN CODE"
Why?
Use good names
No duplication > 2 times
Single Responsibility
Max 4 LOC / method
SESSION 4
"CLEAN CODE"
Code Swap
review
• 5 min by other team
• write comments
read comments
SESSION 4
"CLEAN CODE"
Sync
What was hard?
What violations did you see?
SESSION 5
"OOP"
GOAL
Rethink good Object Oriented Design
SESSION 5
"OOP"
What makes
good OO Design?
SESSION 5
"OOP"
Constraints
Wrap all primitives and strings
Use first-class collections
Use only one dot per line
Keep all entities small
No more than two instance variables
Don’t use any getters / setters / properties
SESSION 5
"OOP"
Why?
Wrap all primitives and strings
Use first-class collections
Use only one dot per line
Keep all entities small
No more than two instance variables
Don’t use any getters / setters / properties
SESSION 5
"OOP"
Constraints
Wrap all primitives and strings
Use first-class collections
Use only one dot per line
Keep all entities small
No more than two instance variables
Don’t use any getters / setters / properties
SESSION 5
"OOP"
Sync
• What was hard?
• How did you handle it?
• Which constraints make sense
for "real life"
SESSION 6
"FAVORITE"
The goal is fun!
SESSION 6
"FAVORITE"
Choose yourself
Your favorite of the day
No conditionals and/or loops
Wishful thinking (Outside-In)
Functional Calisthenics
…
Sync
• What did you choose?
• What was hard?
• How did you handle it?
SESSION 6
"FAVORITE"
• what did you learn today?
• what surprised you about today?
• what are you going to do differently
in your Project?
CLOSING
LICENSE
Creative Commons Attribution-ShareAlike
IMAGES
Some are Public Domain except theses licensed with
Creative Commons with attributions:
By Symbolon
By Ainsley Wagoner
IMAGES
By Luis Prado
Dave Gandy
Christopher.Michel
IMAGES
Kigsz
Another Believer
Maria Ly
IMAGES
Büşra ÖZCOŞKUN
Guru
Aneeque Ahmed
IMAGES
 Rudy Jaspers
 logan
Hopkins
IMAGES
 Kick
THOR
Seattle Municipal Archives
IMAGES
  Uriel Sosa
Adrien Coquet
Yogesh More

Global Day of Coderetreat Munich 2017