coding dojo: fun with tic-tac-toe (2014)

26
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.

Upload: peter-kofler

Post on 15-Jul-2015

107 views

Category:

Technology


5 download

TRANSCRIPT

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

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.

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

Peter Kofler

• Ph.D. (Appl. Math.)

• Professional SoftwareDeveloper for 15 years

• “fanatic about code quality”

• I help development teams

PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

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

Coding Dojo?Expectations?

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

The Coding Dojo Mindset

● Safe place outsidework

● 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

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

Rules

PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

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

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

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

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

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

(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

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

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

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

Tic-Tac-Toe

PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

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

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

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

Constraint

PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

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

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

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

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

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

Don't Focus on Getting it Done.F0cus on Doing

It Horrible ;-)

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

→Practice

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

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

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

“Evil” Constraint

PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

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

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

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

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

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

Don't Focus on Getting it Done.F0cus on Doing

It Perfectly.

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

→Practice

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

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

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

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/

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

Peter Kofler

@codecopkofler

www.code-cop.org

PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

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

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