EFFECTIVE AND PRAGMATIC TEST DRIVEN DEVELOPMENTANDREW RENDELL, PRINCIPAL CONSULTANT
INTRODUCTION IS TDD REALLY UBIQUITOUS? EVALUATION OF THE APPLICATION OF TDD ON A REAL WORLD PROJECT IMPEDIMENTS AND THEIR ...
PROJECT CONTEXT T-MOBILE MOBILE INTERNET PORTAL WEBNWALK3 PERSONALISED EXPERIENCE GO LIVE DATE INVARIANT
DEVELOPMENT DYNAMIC STRONG CUSTOMER FOCUS   COMMITMENT TO ERROR FREE USER EXPERIENCE   CARRIER GRADE SOFTWARE QUALITY PRES...
“VALTECH BELIEVESTHAT AGILE, AND INPARTICULAR TESTDRIVEN DEVELOPMENTCAN HELP THESECOMPANIES DELIVERQUICKLY AND SAFELY.”
MAKING A PROJECT TEST DRIVEN
MAKING A PROJECT TEST DRIVEN WHERE WE STARTED HOW THE INTENT WAS COMMUNICATED STRUCTURING THE APPLICATION TO STRUCTURE DEV...
MAKING A PROJECT TEST DRIVEN                               DEVELOPERS EXPERIENCE                               ONE OR TWO ...
MAKING A PROJECT TEST DRIVEN                               MANAGEMENT EXPERIENCE                               EXPERTS IN ...
MAKING A PROJECT TEST DRIVEN                               AT INCEPTION                               NO INTENT TO USE    ...
COMMUNICATING THE INTENT MOST IMPORTANT INTERACTIVE SESSIONS TEAM WAS INEXPERIENED ACCEPTED INEVITABILITY OF MAKING MISTAKES
TDD THROUGH APPLICATION STRUCTURE WEBNWALK IS A STANDARD MVC APPLICATION INDENTIFIED INTEGRATION PAIN POINT  PRESENTATION ...
EmailWidgetService     XXXEmailContract                     +customerNotAuthenticatedWithPartner() : EmailWidgetModel     ...
TOP DOWN DEVELOPMENT                               Tests         EmailAcceptanceTest           EmailWidgetService         ...
RESPECT // EMPOWERMENT // AVOID DOGMA // IN RETROSPECT, TOOMUCH FLEXIBILITY ALLOWED, ESPECIALLY FOR LESS EXPERIENCEDDEVELO...
IMPEDIMENTS AND PITFALLSDISILLUSINMENT // DOGMATIC APPROACH
DISILLUSIONMENT PATTERN SEEN ON SEVERAL PROJECTS COMMON AMONGST NEW PRACTITIONERS EVERYONE WENT THROUGH SOME OF THE STAGES
DISILLUSIONMENT TOO FOCUSED ON TDD AS AN OBJECTIVE RATHER THAN AS A VEHICLE VELOCITY BEING MEASURED FOR FIRST TIME HIGHLIG...
DOGMATIC APPLICATION ALL NEWCOMERS TO TDD AFFECTED, NOT JUST THOSE LESS EXPERIENCED IN TOOLSET TOO FOCUSED ON THE APPLICAT...
DOGMATIC APPLICATION BEST DEVELOPERS FOCUSED ON WHY TESTS WERE BEING WRITTEN WROTE AND REWROTE CLASSES TO EXPEDITE TESTING...
TRIVIAL EXAMPLE     AverageDurationAnalyserImpl.java     /**      * Obtains the current time.      * protected so can be o...
MEASURABLE BENEFITS
MEASURABLE BENEFITSIMPROVED CODESTRUCTURE //LESS REDUNDANTEFFORT//VIRTUOUS CIRCLE
IMPROVED COHESION STRONG COHESION IS ONE OF THE MOST IMPORTANT ATTRIBUTES OF WELL STRUCTURED CODE TDD NATURALLY ENCOURAGES...
LOW COHESIONLogic for implementation of transformation                                           Http Clientimplemented pi...
HIGH COHESION                       All data transformation logic encapsulated in                       Xml Adaptor. All t...
A COMMON PROBLEM // TDD ENCOURAGES FOCUS ON WHAT ISREQUIRED // DISCOURAGES SPECULATION SEEMS PARTICULARLY TRUEFOR COMMON I...
VIRTUOUS CIRCLE OF AGILITY
VIRTUOUS CIRCLE OF AGILITY STAKEHOLDERS WERE INCLUDED IN TDD INCREASED CONFIDENCE IN CORRECTNESS COMPARED FAVOURABLY WITH ...
EXAMPLE IDENTIFICATION MODULE HIGH COMPLEXITY AND RISK ALL PARTIES INVOLVED IN ANALYSIS TESTS VERIFY IMPLEMENTATION HUMAN ...
CONCLUSIONS TEST DRIVEN DEVELOPMENT IS WIDELY KNOWN PRACTICAL EXPERIENCE IS RARER INTRODUCTION CAN BE DIFFICULT THE TECHNI...
Andrew.Rendell@valtech.co.ukhttp://twitter.com/anderewhttp://www.valtech.co.ukhttp://blog.valtech.co.ukhttp://twitter.com/...
Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech
Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech
Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech
Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech
Upcoming SlideShare
Loading in …5
×

Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech

1,311 views

Published on

Andrew Rendell's presentation on test driven developement.
The presentation will discuss if TDD is really ubiquitous
and evaluate the application of TDD on a real world project!

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

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

No notes for slide

Effective and pragmatic test driven development by Andrew Rendell, Principal Consultant at Valtech

  1. 1. EFFECTIVE AND PRAGMATIC TEST DRIVEN DEVELOPMENTANDREW RENDELL, PRINCIPAL CONSULTANT
  2. 2. INTRODUCTION IS TDD REALLY UBIQUITOUS? EVALUATION OF THE APPLICATION OF TDD ON A REAL WORLD PROJECT IMPEDIMENTS AND THEIR RESOLUTION TANGIBLE BENEFITS
  3. 3. PROJECT CONTEXT T-MOBILE MOBILE INTERNET PORTAL WEBNWALK3 PERSONALISED EXPERIENCE GO LIVE DATE INVARIANT
  4. 4. DEVELOPMENT DYNAMIC STRONG CUSTOMER FOCUS COMMITMENT TO ERROR FREE USER EXPERIENCE CARRIER GRADE SOFTWARE QUALITY PRESSURE TO DELIVER MARKETING DRIVEN HIGHLY COMPETITIVE CONFLICTING DRIVERS RISK ADVERSE CONSERVATIVE HIGHLY COMPETITIVE RAPID ADAPTABILITY
  5. 5. “VALTECH BELIEVESTHAT AGILE, AND INPARTICULAR TESTDRIVEN DEVELOPMENTCAN HELP THESECOMPANIES DELIVERQUICKLY AND SAFELY.”
  6. 6. MAKING A PROJECT TEST DRIVEN
  7. 7. MAKING A PROJECT TEST DRIVEN WHERE WE STARTED HOW THE INTENT WAS COMMUNICATED STRUCTURING THE APPLICATION TO STRUCTURE DEVELOPMENT ACTIVITIES HUMAN INTERACTION WITH DEVELOPERS
  8. 8. MAKING A PROJECT TEST DRIVEN DEVELOPERS EXPERIENCE ONE OR TWO WITH TDD EXPERIENCE // MOST HAD GOOD UNDERSTANDING OF TDD THEORY // ALMOST ALL HAD USED JUNIT // MOST HIGH CALIBRE JAVA DEVELOPERS
  9. 9. MAKING A PROJECT TEST DRIVEN MANAGEMENT EXPERIENCE EXPERTS IN MOBILE TELCO // GOOD UNDERSTANDING OF AGILE THEORY // READY TO EMBRACE NEW PRACTICES // LONG HISTORY OF WATERFALL, DOCUMENT CENTRIC
  10. 10. MAKING A PROJECT TEST DRIVEN AT INCEPTION NO INTENT TO USE TDD END OF INCEPTION SOME JUNIT TESTS // DECIDE TO USE TDD // MEASURE EXISTING COVERAGE // AUDIT EXISTING USE OF TESTS
  11. 11. COMMUNICATING THE INTENT MOST IMPORTANT INTERACTIVE SESSIONS TEAM WAS INEXPERIENED ACCEPTED INEVITABILITY OF MAKING MISTAKES
  12. 12. TDD THROUGH APPLICATION STRUCTURE WEBNWALK IS A STANDARD MVC APPLICATION INDENTIFIED INTEGRATION PAIN POINT PRESENTATION LAYER / SERVER SIDE DIFFERENT TEAMS, SKILLS, COMPLEXITY, TIMESCALES RIGOROUS DEFINITION OF INTERFACE THROUGH CONTRACT CONTRACT BECOMES STARTING POINT OF DEVELOPMENT
  13. 13. EmailWidgetService XXXEmailContract +customerNotAuthenticatedWithPartner() : EmailWidgetModel +oneReadOneUnreadEmail() : EmailWidgetModel +noUneadEmailFiveReadEmail() : EmailWidgetModel +noEmai() : EmailWidgetModel +manyEmails() : EmailWidgetModel +errorGettingEmails() : EmailWidgetModel XXXEmailAcceptanceTest JUnit4 Test XXXEmailWidgetService
  14. 14. TOP DOWN DEVELOPMENT Tests EmailAcceptanceTest EmailWidgetService Tests EmailWidgetServiceImplTest EmailWidgetServiceImpl Uses CustomerDAO Tests CustomerDAOImplTest CustomerDAOImpl
  15. 15. RESPECT // EMPOWERMENT // AVOID DOGMA // IN RETROSPECT, TOOMUCH FLEXIBILITY ALLOWED, ESPECIALLY FOR LESS EXPERIENCEDDEVELOPERSRESPECTING THEDEVELOPERS FREEDOM
  16. 16. IMPEDIMENTS AND PITFALLSDISILLUSINMENT // DOGMATIC APPROACH
  17. 17. DISILLUSIONMENT PATTERN SEEN ON SEVERAL PROJECTS COMMON AMONGST NEW PRACTITIONERS EVERYONE WENT THROUGH SOME OF THE STAGES
  18. 18. DISILLUSIONMENT TOO FOCUSED ON TDD AS AN OBJECTIVE RATHER THAN AS A VEHICLE VELOCITY BEING MEASURED FOR FIRST TIME HIGHLIGHTS SLIPPAGE TDD BLAMED
  19. 19. DOGMATIC APPLICATION ALL NEWCOMERS TO TDD AFFECTED, NOT JUST THOSE LESS EXPERIENCED IN TOOLSET TOO FOCUSED ON THE APPLICATION OF THE TECHNIQUE FAILURE TO PERCEIVE THE DIFFERENT IN VALUE OF DIFFERENT TESTS
  20. 20. DOGMATIC APPLICATION BEST DEVELOPERS FOCUSED ON WHY TESTS WERE BEING WRITTEN WROTE AND REWROTE CLASSES TO EXPEDITE TESTING VIEWED INCORRECTLY AS „FAILURE‟ BY NEW DEVELOPERS
  21. 21. TRIVIAL EXAMPLE AverageDurationAnalyserImpl.java /** * Obtains the current time. * protected so can be overridden in unit test */ protected long getCurrentTime() { return System.currentTimeMillis(); } AverageDurationAnalyserImplTest.java private static long RIGHT_NOW = 1000; @Before public void onSetup() { analyser = new AverageDurationAnalyserImpl(){ @Override protected long getCurrentTime() {return RIGHT_NOW ;}}; }
  22. 22. MEASURABLE BENEFITS
  23. 23. MEASURABLE BENEFITSIMPROVED CODESTRUCTURE //LESS REDUNDANTEFFORT//VIRTUOUS CIRCLE
  24. 24. IMPROVED COHESION STRONG COHESION IS ONE OF THE MOST IMPORTANT ATTRIBUTES OF WELL STRUCTURED CODE TDD NATURALLY ENCOURAGES COHESION TOP DOWN APPROACH MEANS RESPONSIBILITY IS WELL UNDERSTOOD BEFORE CODE IS BEGUN WRITING A TEST WHICH HAS MORE THAN ONE SET OF GOALS IS AN OBVIOUS BAD SMELL AND INDICATES TIME TO DELEGATE
  25. 25. LOW COHESIONLogic for implementation of transformation Http Clientimplemented piecemeal for several classesAuctionWidgetModel Tests WidgetService Worker HmlService Tests TestsAuctionWidgetModelTest Tests WorkerTest Tests+testSelling() +testCombineWatchingAndBuyingTotals() Tests Logic for testing data transformation HmlServiceTest Tests implemented in several different classes +testWatchingData()
  26. 26. HIGH COHESION All data transformation logic encapsulated in Xml Adaptor. All tests and test data in XmlAdaptorTest.WidgetService Worker HttpClient AuctionWidgetModel XmlAdaptor Tests XmlAdaptorTest
  27. 27. A COMMON PROBLEM // TDD ENCOURAGES FOCUS ON WHAT ISREQUIRED // DISCOURAGES SPECULATION SEEMS PARTICULARLY TRUEFOR COMMON INFRASTRUCTURE COMPONENTSYAGNI:YOU AIN‟T GOING TONEED IT
  28. 28. VIRTUOUS CIRCLE OF AGILITY
  29. 29. VIRTUOUS CIRCLE OF AGILITY STAKEHOLDERS WERE INCLUDED IN TDD INCREASED CONFIDENCE IN CORRECTNESS COMPARED FAVOURABLY WITH PREVIOUS EXPERIENCE
  30. 30. EXAMPLE IDENTIFICATION MODULE HIGH COMPLEXITY AND RISK ALL PARTIES INVOLVED IN ANALYSIS TESTS VERIFY IMPLEMENTATION HUMAN TESTER SIGNS OFF IMPLEMENTATION SUBSEQUENT CHANGES NOT BLOCKED BY MANAGEMENT CONFIDENCE HIGH
  31. 31. CONCLUSIONS TEST DRIVEN DEVELOPMENT IS WIDELY KNOWN PRACTICAL EXPERIENCE IS RARER INTRODUCTION CAN BE DIFFICULT THE TECHNIQUE BRINGS REWARDS REAL DIFFERENCE TO DELIVERY OF THE WEBNWALK PLATFORM
  32. 32. Andrew.Rendell@valtech.co.ukhttp://twitter.com/anderewhttp://www.valtech.co.ukhttp://blog.valtech.co.ukhttp://twitter.com/valtech

×