Coding Dojo:
Fun with Tic-Tac-Toe
December 2014
Peter Kofler, ‘Code Cop’
@codecopkofler
www.code-cop.org
Copyright Peter Kofler, licensed under CC-BY.
Peter Kofler
• Ph.D. (Appl. Math.)
• Professional Software
Developer for 15 years
• “fanatic about code quality”
• I help development teams
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Coding Dojo?
Expectations?
The Coding Dojo Mindset
●
Safe place outside
work
●
We are here to learn
●
Need to slow down
●
Focus on doing it right
●
Collaborative Game
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Rules
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Pair Programming
●
Collaborative = Pair Programming
●
“Randori“ (pairing on the projector)
●
or regular programming in pairs
●
regular Pair Programming
●
do not talk for too long
●
do not interrupt the other
●
no “keyboard hugging“
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Test Driven Development
●
Test Driven Development
●
think about test cases
●
write the test first
●
use TDD (or at least “sort of” TDD)
●
write a test before you write code
●
refactor mercilessly
●
no debugger
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
(Maybe Some) Constraints
●
Challenges during a dojo or coderetreat
●
Moving to the extreme is a way of learning
●
Examples
●
Missing Tool (No Mouse, …)
●
Missing Feature (No IFs, …)
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Today surely some fun
Dojo Structure
●
Introduction 10'
●
Coding Fun 60'
●
Interim (Retrospective) 15'
●
Break 10'
●
New Constraint
●
Moar Coding Fun 60'
●
Retrospective 15'
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Tic-Tac-Toe
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Assignment
●
http://en.wikipedia.org/wiki/Tic-tac-toe
●
Board 3x3
●
X plays first, O plays second
●
Implement
●
2 Player Game
●
Determine Winner
●
AI Bot Player
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Constraint
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Write the worst code you can
●
You know how to do that ;-)
●
e.g. wrong/no object orientation
●
e.g. wrong/no usage of types
●
e.g. wrong/no abstractions
●
e.g. too small/big units
●
http://mindprod.com/jgloss/unmain.html
●
Have Fun!
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Prepare
●
Find a pair.
●
Choose a programming language.
●
Set up the environment.
●
Create new project.
●
Add testing framework.
●
Check Wikipedia for requirements.
●
Implement Tic-Tac-Toe.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Don't Focus on
Getting it Done.
F0cus on Doing
It Horrible ;-)
→Practice
Short Retrospective
●
How did it work out?
●
How do you feel?
●
What did you
learn and want
to share with
the group?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
“Evil” Constraint
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Silent Evil Pairing
●
Ping-pong (one person writes the tests, the
other person writes the implementation code,
then switch)
● Mute (nobody can talk) – optional
●
Find the Loophole (the implementation person
purposely writes the wrong algorithm that still
makes the tests turn green. But they have to
keep the code very clean all the while.)
● Have Fun!
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Prepare
●
Find a new pair.
●
Choose a programming language.
●
Set up a fresh environment.
●
Start over with Tic-Tac-Toe.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Don't Focus on
Getting it Done.
F0cus on Doing
It Perfectly.
→Practice
Full Closing Circle
●
What did you learn today?
●
What surprised you today?
●
What will you do
differently in the
future?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Coding Dojo Vienna
●
Biweekly Coding Dojo in Vienna
●
Every other Wednesday 6PM
●
Changing locations
●
Follow
#CodingDojoVie
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
http://codingdojovie.github.io/
Peter Kofler
@codecopkofler
www.code-cop.org
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
CC Images
●
Steel http://www.flickr.com/photos/aeinbu/4038583556
●
Dojo
http://www.flickr.com/photos/49715404@N00/3267627038/
●
Rule http://www.flickr.com/photos/phunk/4188827473
●
Todos
http://www.flickr.com/photos/kylesteeddesign/3724074594/
●
Game http://www.flickr.com/photos/benclinch/476855843/
●
Wants you http://www.flickr.com/photos/shutter/105497713/
●
Pumpkin http://www.flickr.com/photos/martynr/54132892/
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

Coding Dojo: Fun with Tic-Tac-Toe (2014)

  • 1.
    Coding Dojo: Fun withTic-Tac-Toe December 2014 Peter Kofler, ‘Code Cop’ @codecopkofler www.code-cop.org Copyright Peter Kofler, licensed under CC-BY.
  • 2.
    Peter Kofler • Ph.D.(Appl. Math.) • Professional Software Developer for 15 years • “fanatic about code quality” • I help development teams PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 3.
  • 4.
    The Coding DojoMindset ● Safe place outside work ● We are here to learn ● Need to slow down ● Focus on doing it right ● Collaborative Game PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 5.
    Rules PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY
  • 6.
    Pair Programming ● Collaborative =Pair Programming ● “Randori“ (pairing on the projector) ● or regular programming in pairs ● regular Pair Programming ● do not talk for too long ● do not interrupt the other ● no “keyboard hugging“ PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 7.
    Test Driven Development ● TestDriven Development ● think about test cases ● write the test first ● use TDD (or at least “sort of” TDD) ● write a test before you write code ● refactor mercilessly ● no debugger PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 8.
    (Maybe Some) Constraints ● Challengesduring a dojo or coderetreat ● Moving to the extreme is a way of learning ● Examples ● Missing Tool (No Mouse, …) ● Missing Feature (No IFs, …) PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Today surely some fun
  • 9.
    Dojo Structure ● Introduction 10' ● CodingFun 60' ● Interim (Retrospective) 15' ● Break 10' ● New Constraint ● Moar Coding Fun 60' ● Retrospective 15' PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 10.
    Tic-Tac-Toe PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY
  • 11.
    Assignment ● http://en.wikipedia.org/wiki/Tic-tac-toe ● Board 3x3 ● X playsfirst, O plays second ● Implement ● 2 Player Game ● Determine Winner ● AI Bot Player PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 12.
    Constraint PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY
  • 13.
    Write the worstcode you can ● You know how to do that ;-) ● e.g. wrong/no object orientation ● e.g. wrong/no usage of types ● e.g. wrong/no abstractions ● e.g. too small/big units ● http://mindprod.com/jgloss/unmain.html ● Have Fun! PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 14.
    Prepare ● Find a pair. ● Choosea programming language. ● Set up the environment. ● Create new project. ● Add testing framework. ● Check Wikipedia for requirements. ● Implement Tic-Tac-Toe. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 15.
    Don't Focus on Gettingit Done. F0cus on Doing It Horrible ;-)
  • 16.
  • 17.
    Short Retrospective ● How didit work out? ● How do you feel? ● What did you learn and want to share with the group? PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 18.
    “Evil” Constraint PETER KOFLER,CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 19.
    Silent Evil Pairing ● Ping-pong(one person writes the tests, the other person writes the implementation code, then switch) ● Mute (nobody can talk) – optional ● Find the Loophole (the implementation person purposely writes the wrong algorithm that still makes the tests turn green. But they have to keep the code very clean all the while.) ● Have Fun! PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 20.
    Prepare ● Find a newpair. ● Choose a programming language. ● Set up a fresh environment. ● Start over with Tic-Tac-Toe. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 21.
    Don't Focus on Gettingit Done. F0cus on Doing It Perfectly.
  • 22.
  • 23.
    Full Closing Circle ● Whatdid you learn today? ● What surprised you today? ● What will you do differently in the future? PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 24.
    Coding Dojo Vienna ● BiweeklyCoding Dojo in Vienna ● Every other Wednesday 6PM ● Changing locations ● Follow #CodingDojoVie PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY http://codingdojovie.github.io/
  • 25.
    Peter Kofler @codecopkofler www.code-cop.org PETER KOFLER,CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  • 26.
    CC Images ● Steel http://www.flickr.com/photos/aeinbu/4038583556 ● Dojo http://www.flickr.com/photos/49715404@N00/3267627038/ ● Rulehttp://www.flickr.com/photos/phunk/4188827473 ● Todos http://www.flickr.com/photos/kylesteeddesign/3724074594/ ● Game http://www.flickr.com/photos/benclinch/476855843/ ● Wants you http://www.flickr.com/photos/shutter/105497713/ ● Pumpkin http://www.flickr.com/photos/martynr/54132892/ PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY