Improving Design Through Test Driven Development (TDD)

  • View
    1.328

  • Download
    0

Embed Size (px)

DESCRIPTION

Improving Design Through TDD was presented at the DC Agile Engineering Conference on 12/7/2012 by Sam Brown (@SamuelBrownIV) and Mike McGarr (@jmichaelmcgarr).

Text of Improving Design Through Test Driven Development (TDD)

  • 1.Improving Design throughTest Driven Development (TDD) Sam Brown @SamuelBrownIV Mike McGarr @jmichaelmcgarrDC Agile Engineering Conference #DCAEC12

2. About UsSam BrownMike McGarr 11 years software engineer 11 years software engineer DevOps Evangelist at Excella Directory of DevOps for Certified Scrum Master Blackboard Learn Puppet Certified Founder of the DCProfessional Continuous Integration, Delivery and Deployment Meetup 3. Types of Tests 4. Unit TestsFastIndependentRepeatableSelf-VerifyingTimely 5. Test Driven Development Golden Rule of TDD: Never write production code without a failing test http://reddevnews.com/articles/2007/11/01/testdriven-development-tdd.aspx 6. TDD improves quality and designhttp://www.manning.com/koskela2/ 7. Coupling 8. Cohesion 9. Object Oriented Design PrinciplesSingle responsibility principle (SRP)Open/close principle (OCP)Liskov substitution principle (LSP)Interface segregation principle (ISP)Dependency inversion principle (DSP) 10. Bowling Game Ten Frames per game 2 rolls per frame Unless a strike is rolled Properly calculate Spares Properly calculate Strikes http://playcasper.com/venues/show/17 11. DesignDecision 12. DesignDecision 13. Notice the duplicationin the tests. Lets refactor this. 14. More duplication 15. DesignProblem roll()calculates scoreLets Refactor! 16. We need a concept offrames. 17. Ugly Code 18. Design Decisions Design client interface Refactor Change design without changing behavior Defer to last responsible moment Avoids Big Upfront Design 19. New Requirements! 20. Requested ChangesThe Bowling game is becoming service oriented! New Requirement: Post rolls in real-time 21. Collaborator 22. Test Doubles Dummy Stubs Fake Mocks Spy 23. NullPointerException! We need a defaultimplementation. 24. Contact UsSam Brownsamuel.brown@excella.com Cute Baby Arrival@SamuelBrownIV 12/20/2012https://github.com/samueltbrown J. Michael McGarr jmcgarr@gmail.com @jmichaelmcgarr http://earlyandoften.wordpress.com DC CI Meetup - http://bit.ly/YRnrwx