Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Day1 - TDD (Lecture SS 2015)

548 views

Published on

Day1 - TDD (Lecture SS 2015)

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Day1 - TDD (Lecture SS 2015)

  1. 1. ! ! ! "leanpub.com/socra"!
  2. 2. TDD + JavaScript From „wtf“ to „hell yeah“ Wolfram Kriesing, uxebu @wolframkriesing
  3. 3. My slides are english Refaktorisierung Einheitentest Akzeptanztest Paar-Programmierung
  4. 4. How I wish to be programming …
  5. 5. Still learning not to …
  6. 6. Schedule Intro No Ping Pong TDDing Baby steps GSpread break we hack
  7. 7. What is (Software) Craftsmanship?
  8. 8. Journey
  9. 9. endless journey
  10. 10. https://leanpub.com/socra
  11. 11. Hello
  12. 12. Something about me …
  13. 13. About you …
  14. 14. JavaScript - Var(ious) #1 http://dmitry.baranovskiy.com/post/91403200
  15. 15. JavaScript - Var(ious) #2
  16. 16. JavaScript - Var(ious) #2.1
  17. 17. JavaScript - Var(ious) #3
  18. 18. JavaScript - Var(ious) #4
  19. 19. Let’s hack
  20. 20. Roman numerals 1 I 5 V 10 X 50 L 100 C 500 D 1000 M • build as much as you can • 30min • estimate if you get it done • GO IV - 4 IX - 9 XII - 12 XIX - 19 XLIX - 49
  21. 21. Did you get it done?
  22. 22. Do you like your code?
  23. 23. Do you know it works?
  24. 24. Did you have a strategy?
  25. 25. Did you write on paper?
  26. 26. Let’s say you have to add a feature.
 Will all the rest still work?
  27. 27. Is your code maintainable?
  28. 28. What is TDD?
  29. 29. TDD is no Replacement for OO Design (Patterns) SOLID DRY but helps detect deficiencies Law of Demeter
  30. 30. aim of TDD: help to get a good design side effect: unit tests
  31. 31. Step by Step
  32. 32. Step 1 Find a deficiency write it out in code, in a test • focus • constrain the problem
  33. 33. Step 2 Design (the API) because test code uses it • we get feedback • we understand testability
  34. 34. „TDD is no better than it’s driver“ http://www.davesquared.net/2011/03/why-learning-tdd-is-hard-and-what-to-do.html
  35. 35. Quick feedback
  36. 36. Session#2
  37. 37. Code Kata
  38. 38. Code Kata first mentioned
 by Dave Thomas (co-author of the book The Pragmatic Programmer)
  39. 39. Code Kata to improve your programming skills by challenging your abilities and encouraging you to find multiple approaches is a small exercise
  40. 40. Coding Dojo
  41. 41. •First Coding Dojo in France •Practice - like a musician •TDD •Pair Programming •Safe Environment •No deadlines •Improve your skills
  42. 42. CodeRetreat
  43. 43. CodeRetreat 5x one day long intensive exchange
  44. 44. CodeRetreat coderetreat.org
  45. 45. JS CodeRetreat jscoderetreat.com
  46. 46. TDD #1
  47. 47. Choose a pair!
 Someone you never worked with!
  48. 48. Basic rules • One types, the other tells what to type • Write a failing test first • Do as little as possible to make it green • Switch roles on green
  49. 49. Roman numerals 1 I 5 V 10 X 50 L 100 C 500 D 1000 M • Implement 1..? • you got 45 minutes • no estimate • GO
  50. 50. Throw away your code At least don’t use it in session #2
  51. 51. Retro #1
  52. 52. Where is TDD?
  53. 53. Cost, Time, Effort
  54. 54. Functional Tests Integration Tests Exploratory Tests Manual Tests … Unit Tests
  55. 55. TDD #2
  56. 56. Choose a new pair!
  57. 57. Basic rules • One types, the other tells what to type • Write a failing test first • Do as little as possible to make it green • Switch roles on green • Improve over last time!
  58. 58. Roman numerals 1 I 5 V 10 X 50 L 100 C 500 D 1000 M • Implement 1..? • 45 minutes • no estimate • GO
  59. 59. Retro #2
  60. 60. What is TDD?
  61. 61. Kent Beck rediscovered TDD in 2003
  62. 62. encourages simple designs Beck, K. Test-Driven Development by Example, Addison Wesley - Vaseem, 2003 inspires confidence
  63. 63. confidence
  64. 64. confidencesimple design
  65. 65. Helps Design
  66. 66. Easy to Test? Simple Design?
  67. 67. What is a unit test? Testability What is a unit?
  68. 68. Tennis Session #1AAA
  69. 69. http://blog.mikemccandless.com/2014/08/scoring-tennis-using-finite-state.html love all while true; do npm test; sleep 3; done;
  70. 70. Tennis Session #24 rules of simple design
  71. 71. 4 rules of simple design http://c2.com/cgi/wiki?XpSimplicityRules 1) pass all tests
  72. 72. 4 rules of simple design http://c2.com/cgi/wiki?XpSimplicityRules 1) pass all tests 2) clear, expressive and consistent
  73. 73. 4 rules of simple design http://c2.com/cgi/wiki?XpSimplicityRules 1) pass all tests 2) clear, expressive and consistent 3) no duplication
  74. 74. 4 rules of simple design http://c2.com/cgi/wiki?XpSimplicityRules 1) pass all tests 2) clear, expressive and consistent 3) no duplication 4) small and simple code
  75. 75. GO!
  76. 76. Step 1 - Think Step 2 - Write a test Step 3 - How much does this test suck? Step 4 - Run the test and watch it fail Step 5 - Write just enough code to make it pass
  77. 77. I wrote too much code last time.
 I SHOULD STOP DOING THAT!
  78. 78. Step 1 - Think Step 2 - Write a test Step 3 - How much does this test suck? Step 4 - Run the test and watch it fail Step 5 - Write just enough code to make it pass
  79. 79. TDD - J.B. Rainsberger Step 1 - Think Step 2 - Write a test Step 3 - How much does this test suck? Step 4 - Run the test and watch it fail Step 5 - Write just enough code to make it pass

×