Your SlideShare is downloading. ×
0
1.BMW Car ITCode Retreat       Sebastian.Benz@bmw-carit.de
1. code2. delete   6x3. repeat
The point of a code retreat is not to make progress on the problem. The point is to           write perfect code!         ...
In each session...1. Set a goal2. Try to reach it3. Destroy your code4. Retrospect
Pair Programming• Talk about your assumptions, short-term  goals, general direction• Switch roles frequently• Communicatio...
Session IGet to know the problem...
Conway‘s Game of Life
Conway‘s Game of Life
1. Any live cell with fewer than two live neighbours   dies, as if caused by under-population.
1. Any live cell with fewer than two live neighbours   dies, as if caused by under-population.
1. Any live cell with fewer than two live neighbours   dies, as if caused by under-population.
2. Any live cell with two or three live   neighbours lives on to the next generation
2. Any live cell with two or three live   neighbours lives on to the next generation
3. Any live cell with more than three live   neighbours dies, as if by overcrowding.
3. Any live cell with more than three live   neighbours dies, as if by overcrowding.
4. Any dead cell with exactly three live   neighbours becomes a live cell, as if by   reproduction.
4. Any dead cell with exactly three live   neighbours becomes a live cell, as if by   reproduction.
Notes• All rules are applied simultaneously• Start by focusing on the rules• No GUI - use tests instead
Session IIEverything is an object.
Example                        neighbours   CellCellCell   Cell     vs.   Cell           CellCell                         ...
Challenge• Thou shalt not use arrays.
Session IIITest-drive your design.
Test-first ≠ Test-driven
TDDWrite a failing              Make the unit test                   test pass                  Refactor
TDD as if you meant it•   Write one failing test•   Make the test pass by writing implementation code in the test•   Creat...
Example
Challenge• Thou shalt TDD as if thou meant it.• Thou shalt not use the debugger.• Thou shalt know in advance which test wi...
Session IVIts all about the looks...
"There are two hard problems in computerscience: cache invalidation, naming things, and             off-by-one errors."   ...
"There are two hard problems in computerscience: cache invalidation, naming things, and             off-by-one errors."   ...
Example
Challenge• Thou shalt use good names.• Thou shalt express your intend by method names.• Thou shalt have only methods with ...
Session VMore challenges...
Challenge• Thou shalt use only functions and constants.                      or• Thou shalt not use loops (while, for, ite...
Session VIThe end game...
Upcoming SlideShare
Loading in...5
×

Code retreat @BMW Car IT

1,459

Published on

The slides I used during our code retreat at BMW Car IT.

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

No Downloads
Views
Total Views
1,459
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "Code retreat @BMW Car IT"

  1. 1. 1.BMW Car ITCode Retreat Sebastian.Benz@bmw-carit.de
  2. 2. 1. code2. delete 6x3. repeat
  3. 3. The point of a code retreat is not to make progress on the problem. The point is to write perfect code! Corey Haines
  4. 4. In each session...1. Set a goal2. Try to reach it3. Destroy your code4. Retrospect
  5. 5. Pair Programming• Talk about your assumptions, short-term goals, general direction• Switch roles frequently• Communication: "This method is too long" vs "Could we make this method shorter?"• Exercise: Ping-Pong-Pairing - one person writes a test, the other tries to fix it. more http://jamesshore.com/Agile-Book/pair_programming.html
  6. 6. Session IGet to know the problem...
  7. 7. Conway‘s Game of Life
  8. 8. Conway‘s Game of Life
  9. 9. 1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  10. 10. 1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  11. 11. 1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  12. 12. 2. Any live cell with two or three live neighbours lives on to the next generation
  13. 13. 2. Any live cell with two or three live neighbours lives on to the next generation
  14. 14. 3. Any live cell with more than three live neighbours dies, as if by overcrowding.
  15. 15. 3. Any live cell with more than three live neighbours dies, as if by overcrowding.
  16. 16. 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
  17. 17. 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
  18. 18. Notes• All rules are applied simultaneously• Start by focusing on the rules• No GUI - use tests instead
  19. 19. Session IIEverything is an object.
  20. 20. Example neighbours CellCellCell Cell vs. Cell CellCell Cell
  21. 21. Challenge• Thou shalt not use arrays.
  22. 22. Session IIITest-drive your design.
  23. 23. Test-first ≠ Test-driven
  24. 24. TDDWrite a failing Make the unit test test pass Refactor
  25. 25. TDD as if you meant it• Write one failing test• Make the test pass by writing implementation code in the test• Create a new implementation method/function by: • extract method on implementation code from (2), or • moving implementation code from (2) into an existing method• Only ever create new methods in the test class• Only ever create implementation classes to provide a destination for extracting a method created as per (4).• Populate implementation classes by moving methods from a test class• Refactor
  26. 26. Example
  27. 27. Challenge• Thou shalt TDD as if thou meant it.• Thou shalt not use the debugger.• Thou shalt know in advance which test will fail.
  28. 28. Session IVIts all about the looks...
  29. 29. "There are two hard problems in computerscience: cache invalidation, naming things, and off-by-one errors." Eric Florenzano / Phil Karlton
  30. 30. "There are two hard problems in computerscience: cache invalidation, naming things, and off-by-one errors." Eric Florenzano / Phil Karlton
  31. 31. Example
  32. 32. Challenge• Thou shalt use good names.• Thou shalt express your intend by method names.• Thou shalt have only methods with LOC < 3.
  33. 33. Session VMore challenges...
  34. 34. Challenge• Thou shalt use only functions and constants. or• Thou shalt not use loops (while, for, iterators,..).
  35. 35. Session VIThe end game...
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×