piccolo coding dojo (milano xpug 2013-04-11)
TRANSCRIPT
![Page 1: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/1.jpg)
Piccolo Coding DojoXPUG Milano 10 aprile 2013
Andrea Franciahttp://andreafrancia.it
Thursday, April 11, 13
![Page 2: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/2.jpg)
Timetable
• A short review of TDD (1pom)
• Practice with TDD (2pom)
• Retrospective (1pom)
Thursday, April 11, 13
![Page 3: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/3.jpg)
Test Driven Development
Thursday, April 11, 13
![Page 4: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/4.jpg)
The heart of TDD
1. write a test
2. watch it fail
3. make it pass
4. repeat
Thursday, April 11, 13
![Page 5: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/5.jpg)
Example: calculator
Thursday, April 11, 13
![Page 6: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/6.jpg)
Thursday, April 11, 13
![Page 7: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/7.jpg)
Thursday, April 11, 13
![Page 8: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/8.jpg)
Thursday, April 11, 13
![Page 9: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/9.jpg)
Thursday, April 11, 13
![Page 10: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/10.jpg)
Thursday, April 11, 13
![Page 11: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/11.jpg)
Thursday, April 11, 13
![Page 12: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/12.jpg)
Thursday, April 11, 13
![Page 13: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/13.jpg)
Thursday, April 11, 13
![Page 14: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/14.jpg)
Thursday, April 11, 13
![Page 15: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/15.jpg)
Example: file name extension
Thursday, April 11, 13
![Page 16: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/16.jpg)
Thursday, April 11, 13
![Page 17: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/17.jpg)
Thursday, April 11, 13
![Page 18: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/18.jpg)
Thursday, April 11, 13
![Page 19: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/19.jpg)
Thursday, April 11, 13
![Page 20: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/20.jpg)
Three Rules of TDD
1. You can’t write any production code unless is to make green a red test
2. You can’t add more code to a test than is sufficient to make it red
3. You can’t write more production code than is sufficient to make the test green
http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
Thursday, April 11, 13
![Page 21: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/21.jpg)
Refactoring (def):
improving design without changing its observable behavior.
Thursday, April 11, 13
![Page 22: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/22.jpg)
Refactoring (when)
• During the Green
refactor
make itpass
writeanother
test
Thursday, April 11, 13
![Page 23: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/23.jpg)
Simple Design
A design is simple when:
1. pass all tests
2. contains no duplication
3. express the intent
4. minimal, nothing superfluous
http://c2.com/cgi/wiki?XpSimplicityRulesThursday, April 11, 13
![Page 24: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/24.jpg)
What is not unit test?
A test is not a unit test if:
1. It talks to a database.
2. It communicates across a network.
3. It touches the file system.
4. Requires some manual set-up
Working Effectively with Legacy Code - Michael Feathers
Thursday, April 11, 13
![Page 25: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/25.jpg)
Thursday, April 11, 13
![Page 26: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/26.jpg)
Grazie
Thursday, April 11, 13
![Page 27: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/27.jpg)
Domande?
Thursday, April 11, 13
![Page 28: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/28.jpg)
Game of Life
Thursday, April 11, 13
![Page 29: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/29.jpg)
THE GAME OF LIFE IS A TWO
DIMENSIONAL GRID OF SQUARE CELLS EACH OF WHICH IS
IN ONE OF TWO POSSIBLE STATES
ALIVE OR DEAD
http://www.slideshare.net/gabriele.lana/coderetreat
Thursday, April 11, 13
![Page 30: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/30.jpg)
AT EACH STEP IN TIME EVERY CELL INTERACTS WITH ITS 8 NEIGHBORS
FOLLOWING 3 RULES
http://www.slideshare.net/gabriele.lana/coderetreat
Thursday, April 11, 13
![Page 31: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/31.jpg)
1. ANY LIVE CELL WITH FEWER THAN 2 LIVE NEIGHBORS DIES OF LONELINESS
http://www.slideshare.net/gabriele.lana/coderetreatThursday, April 11, 13
![Page 32: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/32.jpg)
2. ANY LIVE CELL WITH MORE THAN 3 LIVE NEIGHBORS DIES OF OVERCROWDING
http://www.slideshare.net/gabriele.lana/coderetreatThursday, April 11, 13
![Page 33: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/33.jpg)
3. ANY DEAD CELL WITH EXACTLY 3 LIVE NEIGHBORS COMES TO LIFE OF WARMTH
http://www.slideshare.net/gabriele.lana/coderetreatThursday, April 11, 13
![Page 34: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/34.jpg)
LIFE EVOLUTION
1 2 3
http://www.slideshare.net/gabriele.lana/coderetreatThursday, April 11, 13
![Page 35: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/35.jpg)
LIFE EVOLUTION1 2 3
http://www.slideshare.net/gabriele.lana/coderetreatThursday, April 11, 13
![Page 36: Piccolo coding dojo (milano xpug 2013-04-11)](https://reader031.vdocumenti.com/reader031/viewer/2022021814/58ef65961a28ab50358b4581/html5/thumbnails/36.jpg)
LIFE EVOLUTION1 2 3
http://www.slideshare.net/gabriele.lana/coderetreatThursday, April 11, 13