$30 off During Our Annual Pro Sale. View Details »

Global Day of Code Retreat 2012: Munich Edition

Global Day of Code Retreat 2012: Munich Edition

The slides I have used during the facilitation of the code retreat at E.S.R. Labs.

Sebastian Benz

December 08, 2012
Tweet

More Decks by Sebastian Benz

Other Decks in Technology

Transcript

  1. Code Retreat Munich
    Sebastian Benz (@sebabenz)
    Sonntag, 9. Dezember 12

    View Slide

  2. #gdcr12
    Sonntag, 9. Dezember 12

    View Slide

  3. Schedule
    08.15 - 08.45am: Arrival
    08.45 - 09.00am: Introduction
    09.00 - 09.45am: Sessions #1
    10.00 - 10.45am: Sessions #2
    11.00 - 11.45am: Sessions #3
    12.00 - 01.30pm: Lunch, socializing
    01.30 - 02.15pm: Sessions #4
    02.30 - 03.15am: Sessions #5
    03.30 - 04.15am: Sessions #6
    04.15 - 05.00pm: Closing circle
    Sonntag, 9. Dezember 12

    View Slide

  4. The point of a code retreat is not
    to make progress on the problem.
    The point is to write perfect code!
    Corey Haines
    Today
    Sonntag, 9. Dezember 12

    View Slide

  5. Session I: Get to know the problem
    Sonntag, 9. Dezember 12

    View Slide

  6. Conway‘s Game of Life
    Sonntag, 9. Dezember 12

    View Slide

  7. Conway‘s Game of Life
    Sonntag, 9. Dezember 12

    View Slide

  8. 1. Any live cell with fewer than two live
    neighbours dies, as if caused by
    under-population.
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  9. 1. Any live cell with fewer than two live
    neighbours dies, as if caused by
    under-population.
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  10. 1. Any live cell with fewer than two live
    neighbours dies, as if caused by
    under-population.
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  11. 2. Any live cell with two or three live
    neighbours lives on to the next
    generation
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  12. 2. Any live cell with two or three live
    neighbours lives on to the next
    generation
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  13. 3. Any live cell with more than three
    live neighbours dies, as if by
    overcrowding.
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  14. 3. Any live cell with more than three
    live neighbours dies, as if by
    overcrowding.
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  15. 4. Any dead cell with exactly three live
    neighbours becomes a live cell, as if
    by reproduction.
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  16. 4. Any dead cell with exactly three live
    neighbours becomes a live cell, as if
    by reproduction.
    Rules
    Sonntag, 9. Dezember 12

    View Slide

  17. http://en.wikipedia.org/wiki/Conway's_Game_of_Life
    Sonntag, 9. Dezember 12

    View Slide

  18. 4 Rules of simple Design
    Sonntag, 9. Dezember 12

    View Slide

  19. 4 Rules of simple Design
    - Runs all the tests
    Sonntag, 9. Dezember 12

    View Slide

  20. 4 Rules of simple Design
    - Runs all the tests
    - Contains no duplications
    Sonntag, 9. Dezember 12

    View Slide

  21. 4 Rules of simple Design
    - Runs all the tests
    - Contains no duplications
    - Expresses the intent of the programmers
    Sonntag, 9. Dezember 12

    View Slide

  22. 4 Rules of simple Design
    - Runs all the tests
    - Contains no duplications
    - Expresses the intent of the programmers
    - Has no superfluous parts
    Sonntag, 9. Dezember 12

    View Slide

  23. Session II: Pair Programming
    Primitive Obsession
    Sonntag, 9. Dezember 12

    View Slide

  24. TDD
    Write a failing
    unit test
    Make the
    test pass
    Refactor
    Sonntag, 9. Dezember 12

    View Slide

  25. Ping-Pong Programming
    1. A writes a new test and sees that it fails.
    2. B implements the code needed to pass the test.
    3. B writes the next test and sees that it fails.
    4. A implements the code needed to pass the test.
    Sonntag, 9. Dezember 12

    View Slide

  26. Session III: How often can you commit?
    Reveal Intent
    Sonntag, 9. Dezember 12

    View Slide

  27. Taking Baby Steps
    1. Setup a timer for 2 minutes interval when you start
    2. Write exactly one test
    - If the timer rings and the test is red then revert and start over.
    - If the test is green before timer rings then commit
    3. Restart timer
    4. Refactor
    - If the timer rings and the refactoring is not complete then revert
    start over.
    - If the refactoring is complete before the timer rings then commit
    5. Go to step 1
    One important note: there can be no discussions in between timers,
    everything needs to happen within the timeboxes.
    Sonntag, 9. Dezember 12

    View Slide

  28. Some Git Help
    Set up repository and working branch
    1. in the console/terminal: go to your project folder
    2. git init → initialize origin/master branch
    3. do initial setup (adding references, building project structure, …)
    4. commit
    How to commit
    1. git add . → track all the new files of the branch to version control
    2. git commit -a -m “commit message” → a = commit all changed files,
    m = message. The message cannot be missing or be empty.
    3. git status → to check if all changes were committed
    How to revert
    1. git reset –hard → revert to the last committed changes on the branch
    2. git status → to check if all changes were reverted
    Sonntag, 9. Dezember 12

    View Slide

  29. www.softwerkskammer.de
    Sonntag, 9. Dezember 12

    View Slide

  30. Session IV: Mute Evil
    Programmer
    Mute evil programmer...
    Sonntag, 9. Dezember 12

    View Slide

  31. Mute Evil Programmer
    - Ping-pong - one person writes the
    tests, the other person writes the
    implementation code
    - Mute - nobody can talk
    - Find the Loophole - the
    implementation person purposely
    writes the wrong algorithm that still
    makes the tests turn green.
    Sonntag, 9. Dezember 12

    View Slide

  32. Session V: Tell don’t Ask
    Tell don’t ask
    Sonntag, 9. Dezember 12

    View Slide

  33. No function should have a return value
    Sonntag, 9. Dezember 12

    View Slide

  34. Session VI: Freestyle
    Give it your best shot
    Sonntag, 9. Dezember 12

    View Slide

  35. Choose your own challenge
    - No conditionals (no if / case)
    - Verbs instead of Nouns
    - Object Calisthenics
    - ...
    Sonntag, 9. Dezember 12

    View Slide

  36. Object Calisthenics
    1. Use only one level of indentation per method
    2. Don’t use the else keyword
    3. Wrap all primitives and strings
    4. Use only one dot per line
    5. Don’t abbreviate
    6. Keep all entities small
    - 50 lines per class
    - 4 lines per method
    7. Don’t use any classes with more than two instance variables
    8. Use first-class collections
    9. Don’t use any getters/setters/properties
    Sonntag, 9. Dezember 12

    View Slide