Coding Dojo: String Calculator (2013)

1,357 views
1,154 views

Published on

Published in: Technology, Sports
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,357
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Coding Dojo: String Calculator (2013)

  1. 1. Coding Dojo: String Calculator vienna.rb Dojo#1, Nov. 2013 Peter Kofler, ‘Code Cop’ @codecopkofler www.code-cop.org Copyright Peter Kofler, licensed under CC-BY.
  2. 2. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Peter Kofler • Ph.D. (Appl. Math.) • Professional Software Developer for 14 years • “fanatic about code quality” • I help development teams
  3. 3. Expectations?
  4. 4. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Coding Dojo Mindset ● Safe place outside work ● We are here to learn ● Need to slow down ● Focus on doing it right ● Collaborative Game
  5. 5. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Dojo Structure ● Introduction 15' ● Coding 30' ● Interim (Retrospective) 15' ● Break ● Coding 45' ● Retrospective 15'
  6. 6. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY TDD Skills ● Driving Development with Tests  ● Designing Test Cases ● Designing Clean Code ● Refactoring Safely
  7. 7. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY TDD should be... ● Add a test ● See it fail ● Add code to make all tests pass ● Refactor mercilessly ● Repeat
  8. 8. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY … but often is ● Think up design ● Write some tests that verify the design ● Write full implementation ● Test, debug, test, debug, test, debug, … ● Add TODO to refactor later
  9. 9. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY String Calculator
  10. 10. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Requirements ● Create a String calculator (class) with a method Add that accepts a string and returns a number ● ● ● ● ● The string contains 0, 1, or 2 numbers. It returns their sum. An empty string will return 0. Example inputs are “”, “1”, or “1,2”. Start with simplest test (empty string)
  11. 11. Don't Focus on Getting it Done. F0cus on Doing It Perfectly.
  12. 12. →Practice
  13. 13. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY More Requirements ● Now change the Add method to handle an unknown number of arguments (numbers inside string). ● ● e.g. “1,2,3” should return 6. Allow the Add method to handle also new lines between numbers (instead of commas). ● e.g. “1n2,3” should return 6.
  14. 14. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Closing Circle ● What did you learn today? ● What surprised you today? ● What will you do differently in the future?
  15. 15. Global Day of CodeRetreat #gdcr13 (14.12.2013) http://coderetreat.org/events/global-day-of-coderetreat-vienna-2014
  16. 16. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Peter Kofler @codecopkofler www.code-cop.org Kata by Roy Osherove @RoyOsherove http://osherove.com/tdd-kata-1/
  17. 17. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY CC Images ● Dojo http://www.flickr.com/photos/49715404@N00/3267627038/ ● Todos http://www.flickr.com/photos/kylesteeddesign/3724074594/ ● Calculator http://www.flickr.com/photos/7271689@N05/2209497074 ● Wants you http://www.flickr.com/photos/shutter/105497713/

×