Spaceship TDD Style

17
@gil_zilberfeld Spaceship TDD Style Gil Zilberfeld

description

Slides of the lab we ran at Reversim summit 2013, building a spaceship in TDD

Transcript of Spaceship TDD Style

Page 1: Spaceship TDD Style

@gil_zilberfeld

Spaceship TDD StyleGil Zilberfeld

Page 2: Spaceship TDD Style

@gil_zilberfeld

Who Am I

Agile helperSoftware improverAuthor of “Everyday Unit Testing”

www.gilzilberfeld.comwww.everydayunittesting.com@gil_zilberfeld

Page 3: Spaceship TDD Style

@gil_zilberfeld

Test Driven Development

Page 4: Spaceship TDD Style

@gil_zilberfeldhttp://www.buildtheenterprise.org/

Page 5: Spaceship TDD Style

@gil_zilberfeld

Rules of Engagement

• We’re building parts of a spaceship• Gotta have a test framework• Break into pairs• Introduce yourself - 5 minutes• Try to stick to technology you feel comfortable in

• Work in rounds• 15 minute work• 10 public review

Page 6: Spaceship TDD Style

@gil_zilberfeld

The Fantastic Four

• Navigation• Weapons and Shields• Engine• Environment

Not the whole ship!

Page 7: Spaceship TDD Style

@gil_zilberfeld

Round 1: Silence of the Names

• Write empty tests• Write as many test cases as possible using names• All tests should pass• No speaking

Page 8: Spaceship TDD Style

@gil_zilberfeld

Review - Names

• How do you feel about the names? Did it change over time?• Did both of you suggest names?• Are the names clear?• Did the tests pass?• How did the name ideation go?• How did the first test set the stage?

Page 9: Spaceship TDD Style

@gil_zilberfeld

Round 2: Test Runner

• 1st person selects, writes and fails a test• 2nd person makes it pass• No refactoring• All tests must pass

Page 10: Spaceship TDD Style

@gil_zilberfeld

Review – Test First, Pass Second

• How many tests passed?• Which tests did you start with?• Who’s holding up the line? What did you feel about this?• What is the quality of the code?• What is the quality of the test?• Do the names describe the tests correctly?• How much conversation time?

Page 11: Spaceship TDD Style

@gil_zilberfeld

Round 3 - Transformers

• Refactor code and tests• Save the old version• No adding and removing tests• All tests must pass

Page 12: Spaceship TDD Style

@gil_zilberfeld

Review - Refactoring

• What did you decide to refactor?• Who led the process?• Did everyone agree on the changes?• What did you refactor more, code or tests?• Did you run the tests after every change?• Did you do enough refactoring?• How long between test runs?

Page 13: Spaceship TDD Style

@gil_zilberfeld

Round 4 –Predator Vs Alien

• Break up the pairs• 3 minute introduction

• The Predators write the tests• No talking to the aliens• Add more tests if needed• Step away when a test fails

• The Aliens write the passing code• No talking to predators• Observe already working tests and code• Step away when a test passes

• All tests must pass• Get points for passing additional tests

Page 14: Spaceship TDD Style

@gil_zilberfeld

Review – Facing the unknown

• Predators:• What was the quality of tests compared to the ones you wrote before?• Why did you pick those test cases?• How did you work together?

• Aliens:• What did you think about the tests picked by the predators?• Was the existing code helpful?• How did you work together?

Page 15: Spaceship TDD Style

@gil_zilberfeld

The many faces of TDD

• TDD is not just Red-Green-Refactor• Can be done in different ways• It is a learning experience• More fun in groups / pairs

Page 16: Spaceship TDD Style

@gil_zilberfeld

What did you learn?

• New• Surprising• Disappointing

Page 17: Spaceship TDD Style

@gil_zilberfeld

Thank You!

• Questions?• Contact me:• @gil_zilberfeld• http://www.gilzilberfeld.com• http://www.everydayunittesting.com