xp and tdd
play

XP and TDD Extreme Programming and Test Driven Development Bertrand - PowerPoint PPT Presentation

XP and TDD Extreme Programming and Test Driven Development Bertrand Meyer, Manuel Oriol Andreas Leitner Chair of Software Engineering ETH Zurich October 27, 2006 Chair of Software Engineering Outline Development Processes Overview Extreme


  1. XP and TDD Extreme Programming and Test Driven Development Bertrand Meyer, Manuel Oriol Andreas Leitner Chair of Software Engineering ETH Zurich October 27, 2006 Chair of Software Engineering

  2. Outline Development Processes Overview Extreme Programming Test Driven Development Chair of Software Engineering

  3. Outline Development Processes Overview Extreme Programming Test Driven Development Chair of Software Engineering

  4. Development Processes Overview ◮ Traditional Methods ◮ Waterfall model ◮ V model ◮ Spiral model ◮ Prototype model ◮ Agile Methods ◮ Extreme Programming ◮ Test Driven Development Chair of Software Engineering

  5. Waterfall model Chair of Figure from: Wikipedia Software Engineering

  6. V model Chair of Software Engineering

  7. Defect Cost Relative cost to correct a defect 70 60 50 40 30 20 10 0 Requirements Design Code Development Acceptance Operation Testing Testing Source: Barry W. Boehm, Software Engineering Economics, Prentice Hall, 1981 Chair of Software Engineering

  8. Spiral model Figure from: Ghezzi, Jazayeri, Mandrioli, Software Engineering, 2nd edition, Prentice Hall Chair of Software Engineering

  9. Project Management ◮ Programming competence varies greatly ◮ 1:10 in a single group (Sackman, Erikson, Grant) ◮ Who introduces more bugs? ◮ Experienced Developers ◮ Beginners Chair of Software Engineering

  10. Outline Development Processes Overview Extreme Programming Test Driven Development Chair of Software Engineering

  11. XP: Motivation ◮ Schedule slips ◮ Project canceled ◮ Systems go sour ◮ Defect rate ◮ Doesn’t solve actual problem ◮ Business changes ◮ False feature rich ◮ Staff turnover Chair of Software Engineering

  12. XP: Cost of Change Chair of Software Engineering

  13. XP: Rules ◮ The planning game ◮ Small Releases ◮ Metaphor ◮ Simple Design ◮ Testing ◮ Refactoring ◮ Pair programming ◮ Collective Ownership ◮ Continuous Integration ◮ 40h-Week ◮ On-Site Customer ◮ Coding Standards Chair of Software Engineering

  14. XP: Programming in the Wild ◮ Is XP like “programming in the wild”? Chair of Software Engineering

  15. XP: Kinds of Testing ◮ Unit testing ◮ Integration testing ◮ System testing ◮ Acceptance testing ◮ Regression testing Chair of Software Engineering

  16. XP: Unit testing 1/2 ◮ Tools ◮ SUnit – Smaltalk (first one) ◮ JUnit – Java (www.junit.org) ◮ cppunit – C++ ◮ PyUnit – Python ◮ ... Chair of Software Engineering

  17. Outline Development Processes Overview Extreme Programming Test Driven Development Chair of Software Engineering

  18. (from Neil McGovern) Chair of Software Engineering

  19. (from Neil McGovern) Chair of Software Engineering

  20. (from Neil McGovern) Chair of Software Engineering

  21. TDD: Overview ◮ Evolutionary approach to development ◮ Combines ◮ Test-first development ◮ Refactoring ◮ Primarily a method of software design ◮ Not just method of testing Chair of Software Engineering

  22. TDD: The Process Chair of Software Engineering

  23. TDD = TFD + Refactoring ◮ Apply test-first development ◮ Refactor whenever you see fit (before next functional modification) ◮ Kent Beck’s rule: ◮ Write new business code only when a test case fails ◮ Eliminate any duplication you find Chair of Software Engineering

  24. TDD and Extreme Programming ◮ Easy to give in and skip some test cases ◮ Pair-programming can help ◮ Writing testable code helps Chair of Software Engineering

  25. TDD: Consequences ◮ Incremental development ◮ Development environment must provide rapid response to small changes ◮ Components are designed highly cohesive, loosely coupled ◮ Developers learn to write good unit tests: ◮ Run fast ◮ Run in isolation ◮ Use data that makes test case easy to read ◮ Each test case is step towards overall goal Chair of Software Engineering

  26. TDD & Documentation ◮ Programmers often do not read documentation ◮ Instead, they look for examples and play with them ◮ Good unit tests can serve as ◮ Examples ◮ Documentation Chair of Software Engineering

  27. TDD: pros and cons ◮ Pros ◮ Reduce gap between decision and feedback ◮ Encourage developers to write code that is easily tested ◮ Creates a thorough test bed ◮ Drawbacks ◮ Time taken away from core development ◮ Some code is difficult to test Chair of Software Engineering

  28. References ◮ Kent Beck: Agile software development: principles, patterns, and practices. Addision Wesley, 2003 ◮ Astels: Test Driven Development: A Practical Guide, Prentice Hall, 2003 ◮ Kent Beck: Extreme Programming Explained, Addision Wesley, 2000 ◮ Bertrand Meyer: Practice to perfect: the quality first model, IEEE Computer, 30, 5, pages 102-103, 105-106, 1997 ◮ Andrew Hunt: The Pragmatic Programmer: from journeyman to master. Addision Wesley, 2000 ◮ Kent Beck: Extreme Programming explained. Addision Wesley, 2000 Chair of Software Engineering

Recommend


More recommend