Python Coding Dojo
March 19th
, 2014
PyUGAT
Coding Dojo?
Code!
Learn!
Have fun!
Coding Dojo?
● Safe place, not work
● Our Goal: to learn
● Not our goal: to finish the task
Practices
● Test-Driven Development
● Pair Programming
Test-Driven Development
Overview
Analyse Problem
Test List
Guiding Test
Red
Declare & Name
Arrange-Act-Assert
Satisfy comp...
Test-Driven Development
from nose.tools import *
import fizzbuzz
def test_1_returns_1():
    result = fizzbuzz.fizzbuzz(1)...
Test-Driven Development
def fizzbuzz(number):
    return "1"
Test-Driven Development
[…]
def test_2_returns_2():
    result = fizzbuzz.fizzbuzz(2)
    assert_equal(result, "2")
Test-Driven Development
def fizzbuzz(number):
    return str(number)
Test-Driven Development
[…]
def test_3_returns_Fizz():
    result = fizzbuzz.fizzbuzz(3)
    assert_equal(result, "Fizz")
Test-Driven Development
def fizzbuzz(number):
    if number == 3:
        return "Fizz"
    return str(number)
What will be the next test?
Pair Programming
● Driver: types at the computer
● Navigator
– Looks for:
● Tactical defects: Syntax errors, Typos, Callin...
Kata: „Word Wrap“
You write a class called Wrapper, that has a single static
function named wrap that takes two arguments,...
Randori
● 10 min introduction
● 10 min discussion
● 40 min working on the problem
– 1 driver, 1 navigator
– Every 5 min
● ...
Randori in Pairs
● Coding
– Split into pairs
– Work on the Kata for 45 minutes
– 5 minutes debriefing
● 5 minutes break
● ...
Happy Coding!
Retrospective
● Are you happy with the design of the code you ended up
with? Should you have refactored it more often?
● W...
Upcoming SlideShare
Loading in …5
×

Python Coding Dojo - 2014-03-19

472 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
472
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Python Coding Dojo - 2014-03-19

  1. 1. Python Coding Dojo March 19th , 2014 PyUGAT
  2. 2. Coding Dojo? Code! Learn! Have fun!
  3. 3. Coding Dojo? ● Safe place, not work ● Our Goal: to learn ● Not our goal: to finish the task
  4. 4. Practices ● Test-Driven Development ● Pair Programming
  5. 5. Test-Driven Development Overview Analyse Problem Test List Guiding Test Red Declare & Name Arrange-Act-Assert Satisfy compiler Green Implement solution Fake it Start over Refactor Remove Fake Remove Code Smell (No new functionality) Note new test cases
  6. 6. Test-Driven Development from nose.tools import * import fizzbuzz def test_1_returns_1():     result = fizzbuzz.fizzbuzz(1)     assert_equal(result, "1")
  7. 7. Test-Driven Development def fizzbuzz(number):     return "1"
  8. 8. Test-Driven Development […] def test_2_returns_2():     result = fizzbuzz.fizzbuzz(2)     assert_equal(result, "2")
  9. 9. Test-Driven Development def fizzbuzz(number):     return str(number)
  10. 10. Test-Driven Development […] def test_3_returns_Fizz():     result = fizzbuzz.fizzbuzz(3)     assert_equal(result, "Fizz")
  11. 11. Test-Driven Development def fizzbuzz(number):     if number == 3:         return "Fizz"     return str(number)
  12. 12. What will be the next test?
  13. 13. Pair Programming ● Driver: types at the computer ● Navigator – Looks for: ● Tactical defects: Syntax errors, Typos, Calling the wrong method ● Strategic defects in the driver's work – Driver's implementation or design fails to accomplish its goal – Strategic, long-range thinker of the pair ● Effective Pair: Constantly discusses alternative approaches and solutions to the problem ● Dysfunctional Pair: Quiet navigator
  14. 14. Kata: „Word Wrap“ You write a class called Wrapper, that has a single static function named wrap that takes two arguments, a string, and a column number. The function returns the string, but with line breaks inserted at just the right places to make sure that no line is longer than the column number. You try to break lines at word boundaries. Like a word processor, break the line by replacing the last space in a line with a newline.
  15. 15. Randori ● 10 min introduction ● 10 min discussion ● 40 min working on the problem – 1 driver, 1 navigator – Every 5 min ● driver → audience ● navigator → driver ● audience (1 person) → navigator ● 5 min break ● 40 min working on the problem – Like before ● 15 min retrospective
  16. 16. Randori in Pairs ● Coding – Split into pairs – Work on the Kata for 45 minutes – 5 minutes debriefing ● 5 minutes break ● Coding – Split into pairs – Work on the Kata for 45 minutes – 5 minutes debriefing ● 10 minutes retrospective
  17. 17. Happy Coding!
  18. 18. Retrospective ● Are you happy with the design of the code you ended up with? Should you have refactored it more often? ● What are the best aspects of the design of the code we've ended up with? ● Did we learn anything new? ● Did anything unexpected happen? ● What do we still need to practice more? ● What should we do differently in the next dojo? ● What will you do differently tomorrow in your production code?

×