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.

Baby Steps TDD Approaches

2,427 views

Published on

The slides of my "Baby Steps TDD Approaches" session at the Softwerkskammer Munich meetup on 9th of April 2015 where I present a tool box which you can use to reach smaller steps to optimize feedback speed and reduce risk during programming.

Published in: Software

Baby Steps TDD Approaches

  1. 1. Baby Steps TDD Approaches Softwerkskammer Meetup Munich @codecentric 09.04.2015 David Völkel
  2. 2. Agenda ● Pizza ● Theory ● Coding Kata ● Another beer
  3. 3. Baby Steps ● Who knows the notion?
  4. 4. ● 2011 Kent Beck‘s Responsive Design ● 2013 Adi Bolboaca Taking Baby Steps ● 2014 Seb Rose & … Diamond Kata ● [2014 Mikado Method] How I stumbled upon…
  5. 5. Leap change 1 Initial code state change 2 state 1 state 2 … change n target code state ● slow feedback ● high risk ● exponential complexity ● problems hard to find
  6. 6. Stepping Stone change 1 Initial state change 2 state 1 state 2 … change n target state get green asap ● commit on green ● revert to green +
  7. 7. Stepping Stone change 1 Initial state change 2 state 1 state 2 … change n target state + fast feedback + less risk - a bit more effort
  8. 8. "Taking Baby Steps“ Kata Contraints (Adi Bolboaca, Erik Talboom) ● Write Feature ● Test ● Implement ● Refactoring 2 min. 2 min. red? green? git reset --hard git commit
  9. 9. The “Diamond Kata“ A => A B => _A_ B_B _A_ C => __A__ _B_B_ C___C _B_B_ __A__
  10. 10. Parallel ● Old and new version parallel at the same time ● Switch one usage at a time old create new delete old old not used anymore
  11. 11. My too big Feature Simplification baby feature Layer 1 Layer 2 integrated test against vertical slice
  12. 12. My too big Feature Simplification baby feature Layer 1 Layer 2 Narrow focus of test C => __A__ _B_B_ C___C _B_B_ __A__ C => __A__
  13. 13. Outside-In TDD Feature Layer 1 Layer 2 Unit test Mocks
  14. 14. Component Feature Layer 1 Component Helper Class vs. Method? Unit test bottom up / inside-out
  15. 15. On-Site TDD • Temporary assertions in production code • Delete afterwards • Even quicker: a REPL public String diamond(String s) { if (s.equals("A")) { return s; } else { assertEquals("A", predecessor(s)); return (predecessor(s) + s); } }
  16. 16. Test-Recycling • Start with simple test • Subsequent rewrites of the same tests B => AB B => ABB B => AnBBn
  17. 17. Let‘s code the “Diamond Kata“! Contraints "Taking Baby Steps“ ● Write Feature ● Test ● Implement ● Refactoring ● [Don‘t talk] A => A B => _A_ B_B _A_ C => __A__ _B_B_ C___C _B_B_ __A__ 2 min. 2 min. red? green? git reset --hard git commit
  18. 18. Retrospective
  19. 19. Images THOR https://commons.wikimedia.org/wiki/File:Parkour_leap_of_faith.j pg?uselang=de Seattle Municipal Archives https://commons.wikimedia.org/wiki/File:Kids_at_Kubota_Garde n_2003.jpg
  20. 20. License Creative Commons Attribution-ShareAlike 3.0 https://creativecommons.org/licenses/by-sa/3.0/de/

×