test driven development
TRANSCRIPT
What is TDD
Developed (or rediscovered) by Kent Beck to encourage
simple design and inspire confidence.
Related to the test-first programming concepts of eXtrem
Programming
A software development process that relies on the
repetition of a very short development cicle
4
The golden rules
Never write model code
unless you have a test that
requires it
Write new code only if an
automated test has failed
Eliminate duplication
5
What's my motivation?
TDD<piè di
pagina><piè di
pagina><piè di
pagina><piè di
pagina>
6
COURAGE
Clean Code that works!!!
Managing fear
“I have a problem and I can't see the end from the beginning”
Fear says you to be carefull
7
Benefits
9
Programmers who wrote more tests tended to be more productive
Programmers using TDD rarely felt the need to invoke a debugger TDD offers validation of correctness and drives the design of a program
TDD offers the ability to take small steps Even if more code is required, the total code implementation time could be
shorter TDD can lead to more modularized, flexible and extensible code
Because no more code is written than necessary to pass a failing test case, tests tend to cover every code path.
Multi Currency Money
11
Bond portfolio management system.
Company Shares Price Total
Pippo SpA 1000 25 25000
Pluto srl 400 100 40000
Total 65000
Multy currency report
Company Shar
es
Price Total
Pippo SpA 1000 25 EUR 25000 EUR
Gastone SaS 400 100 USD 40000 USD
Total 65000 EUR
Rates
From To Rate
USD EUR 2
TDD Best Practices V.I
integrate your code every few unit test and never
leave broken tests
18
If you are working in a team...
Bibliography and references
Kent Beck – Test-Driven Development by Example, The Addison-Wesley Signature Series
Jason Gorma – Agile Java Development: Test-Driven Development using JUnit and Eclipse
WardsWiKi - http://c2.com/cgi/wiki?TestDrivenDevelopment
WardsWiKi - http://c2.com/cgi/wiki?DontRepeatYourself
www.testdriven.com
www.junit.com
www.bigthink.it/php/test-driven-development-prima-i-test-poi-il-codice
www.agiledata.org/essays/tdd.html
21