The Artima Developer Community
Sponsored Link

Agile Buzz Forum
TDD Randori Workshop

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Mark Levison

Posts: 877
Nickname: mlevison
Registered: Jan, 2003

Mark Levison an agile software developer who writes Notes from a tool user.
TDD Randori Workshop Posted: Oct 23, 2008 3:06 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Mark Levison.
Original Post: TDD Randori Workshop
Feed Title: Notes from a Tool User
Feed URL: http://feeds.feedburner.com/NotesFromAToolUser
Feed Description: Thoughts about photography, software development, reading, food, wine and the world around us.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Mark Levison
Latest Posts From Notes from a Tool User

Advertisement

A few weeks ago I ran my first Coding Dojo/Randori and while the participants learned from the session there had been a few key flaws:

  • The problem was too big
  • The problems was in a domain that was unfamiliar to everyone
  • The facilitator (me) participated too much Ouch. It was true.

This week we ran a second session and had a much better time. The key to success - pick a smaller problem and let people struggle for a good long time before making suggestions. In addition remind them frequently to ask the audience for help.

This week's problem:

Score a bowling game, (credit to Bob Martin and Ron Jeffries for the idea) based on the following rules:

  • A single bowling game consists of ten frames.
  • For each frame, a bowler is allowed a maximum of two rolls to knock down all ten pins
  • When a Strike is thrown, the current frame is finished
  • Scoring:
    • 0-9 pins knocked down: score the number of pins
    • Spare: 10 + number of pins knocked down by the next throw
    • Strike: 10 + number of pins knocked down by the next two throws.

Effectively this means the ball after a Spare is counted twice - once for the spare and once for the strike. With Strikes the next two balls are counted twice.

Scoring Examples (from wikipedia):
A Single strike:

Frame 1, ball 1: 10 pins (strike)
Frame 2, ball 1: 3 pins
Frame 2, ball 2: 6 pins
The total score from these throws is:
  • Frame one: 10 + (3 + 6) = 19
  • Frame two: 3 + 6 = 9
TOTAL = 28

Mulitple strikes:

Frame 1, ball 1: 10 pins (Strike)
Frame 2, ball 1: 10 pins (Strike)
Frame 3, ball 1: 10 pins (Strike)
Frame 4, ball 1: 0 pins (Gutterball)
Frame 4, ball 2: 9 pins
The total score from these throws is:
  • Frame one: 10 + (10 + 10) = 30
  • Frame two: 10 + (10 + 0) = 20
  • Frame three: 10 + (0 + 9) = 19
  • Frame four: 0 + 9 = 9
TOTAL = 78

It appears this problem was much better suited to where the group is at now. To start the process off I seeded the work with a few tests (TestOneThrow(), TestTwoThrows(), testMutilpleFrames(), testMidFrame()) and a trivial amount of code to satisfy the problem. As the product owner I asked the team to add the following features:

  • The bowler throws one spare
  • Scoring reverts to normal after throwing a spare
  • The bowler throws a strike
  • Scoring reverts to normal after a strike
  • Score successive spares
  • Score successive strikes
  • Score a perfect game (300 pts).

We made fairly good progress through the feature list but didn't manage to tackle the last three features. With one of the failing tests early on we had good example of why the parameter order matters in JUnit's asserts. The asserts are written assertEquals(Expected, Actual) = if the test fails JUnit says "Line XXX epxected 42 was 22". Get the parameters in the wrong order and more than a few minutes will be wasted trying to solve the wrong problem.

Towards the end (working on the the bowler throws one strike) the pair at the computer was bogging down unsure why things weren't working. At this stage I intervened and helped add sysout's in every branch to illuminate what paths were being followed, It turns out that several mistakes had been made and the wrong paths were being followed in test cases. While I shouldn't have intervened it did break the log jam and allow the team finish the feature. At this stage the team feels the code is a bit of a mess and so we will pick up the exercise from the same place next time.

Our retrospective generated a much smaller set of notes this time:
Happy:

  • Lots of pizza
  • Good problem (everyone understands the rules of bowling)
  • Fun to learn about bowling
  • Good hands on experience
  • Much better level of involvement from the facilitator
  • Having some working tests and code to seed the exercise is much better than starting from a blank file.

Sad:

  • Need more involvement from the audience.
  • Should've brought a mouse - I did last time Doh.
  • Didn't really understand bowling until halfway through the session

So net result I picked a better problem than last time and we all learned a little about TDD. In addition we all discovered that scoring in bowling looks deceptively simple but in actual fact is a non-trivial problem.

Problem sources for Coding Dojo's:

Have you tried a Randori or Coding Dojo? What was your experience?

If you enjoyed this post, subscribe now to get free updates.

Read: TDD Randori Workshop

Topic: Smalltalk BOFs Previous Topic   Next Topic Topic: The Shared Fantasy

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use