Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Â
why-tdd
1. AMIR BARYLKO
WHY TDD?
WPG RUBY UG 2011
Amir Barylko - TDD MavenThought Inc.
2. INTRO
Why projects fail?
Reality Check
No more excuses
Why TDD?
Amir Barylko - TDD MavenThought Inc.
3. WHY PROJECTS FAIL?
⢠Delivering late or over budget
⢠Delivering the wrong thing
⢠Unstable in production
⢠Costly to maintain
Amir Barylko - TDD MavenThought Inc.
4. REALITY CHECK
⢠It is impossible to gather all the requirements at
the beginning of a project.
⢠Whatever requirements you do gather are
guaranteed to change.
⢠There will always be more to do than time and
money will allow.
Amir Barylko - TDD MavenThought Inc.
5. NO MORE EXCUSES
⢠It works on my computer! ⢠We need a satellite
connection in order to
⢠Itwas like that when I got run it!
here!
⢠We canât reproduce the
⢠The previous developer error!
didnât know XXXX!
⢠We canât test that!
Amir Barylko - TDD Workshop PRDC 2011 MavenThought Inc.
6. WHY TDD?
⢠Prove that your code ⢠Regression tests as
works byproduct
⢠Avoid waste ⢠Makechanges with
(debugging) conďŹdence
⢠Increment code quality ⢠Bring
back the joy of
coding!
⢠Better design
Amir Barylko - TDD Workshop PRDC 2011 MavenThought Inc.
7. APPLYING TDD
Iteration 0 .. N
Quality as a Driver
Red - Green - Refactor
Amir Barylko - TDD MavenThought Inc.
8. ITERATION 0
⢠Flush out architecture.
⢠Setup Testing harness for TDD and BDD.
⢠Setup continuous integration.
⢠Setup scripts to build, deploy, etc.
⢠Setup visual communication tools.
Amir Barylko - TDD MavenThought Inc.
9. ITERATION 1.. N
⢠Start by Story Planning
⢠Pair programming (switching often) Every day!
⢠Daily Scrum
⢠End with Retrospective
Amir Barylko - TDD MavenThought Inc.
10. QUALITY AS A DRIVER
Red
BDD
Red
Refactor Refactor TDD Green Green
Amir Barylko - TDD MavenThought Inc.
11. RED
â˘Write a test that fails
â˘Relax, is ok if it compiles
Amir Barylko - TDD MavenThought Inc.
12. GREEN
⢠Try to make the test pass
⢠Do a simple solution
⢠Use default values (not throwing exceptions)
⢠Donât worry if the code âsmellsâ
Amir Barylko - TDD MavenThought Inc.
13. REFACTOR
⢠Avoid repeating code
⢠Avoid hardcoding dependencies
⢠Avoid âwrite onlyâ code
⢠Refactor with conďŹdence!
⢠Run all tests if possible
Amir Barylko - TDD MavenThought Inc.
14. DEMO
MediaLibrary
Add
Top10
Amir Barylko - TDD MavenThought Inc.
15. SUMMARY
Limits
BeneďŹts
Challenges
Adoption
Amir Barylko - TDD MavenThought Inc.
16. LIMITS OF TDD
⢠Unit test
⢠Integration test
⢠Acceptance test
Amir Barylko - TDD MavenThought Inc.
17. BENEFITS
⢠Let the methodology drive
⢠It will save your bacon!
⢠High quality the whole way!
⢠Very few bugs!
⢠Do your duty as developer!
Amir Barylko - TDD MavenThought Inc.
18. CHALLENGES
⢠Very different from conventional testing
⢠Many developers ďŹnd it complex to learn at ďŹrst
⢠Hard to start without a Mentor
⢠Management buy in
⢠DifďŹcult to keep under deadline pressure
⢠Beware of code coverage!
Amir Barylko - TDD MavenThought Inc.
19. ADOPTION
⢠Find Mentor/Couch/Trainer
⢠Small iterations
⢠Have metrics ready (velocity, etc)
⢠Do whatever works for you
⢠Find out which tools will beneďŹt you
⢠Automate, automate, automate!
Amir Barylko - TDD MavenThought Inc.