tdd
TRANSCRIPT
TDDTest Driven Development
Clean code that works
Two Rules
• Don’t write a single line of code unless you have a failing automated test
• Eliminate duplication
Write a little test
Make the test work (quick and dirty)
Eliminate all duplication (Refactor)
Red/Green/Refactor
Why this rocks..
• Reduces defect density
• Reduces risk
• Interaction between developers
• Shippable software === Agile
Fear
Cups of Coffee Per Cup Total
Starbucks 25 4 100
Total 100
Cups of Coffee Per Cup Total
Starbucks 25 S$ 4 S$ 100
Highlands 15 VND 25,000 VND 375,000
Total ???
Cups of Coffee Per Cup Total
Starbucks 25 S$ 4 S$ 100
Highlands 15 VND 25,000 VND 375,000
Total S$ 125
SGD/VND 15,000
7 USD +10 SGD = 14 USD(if SGD to USD = 0.7)
7 USD x 2 = 14 USDlet’s start small
7 USD x 2 = undefinedoh boy …
7 USD x 2 = 14 USDbut wait …
this.amount = 7 * 2dependency —> duplication