Test Driven Development: Part 2 - Presentation Transcript
CodeAndroid meetup Test Driven Development
Objectives Brief history of TDD Do a very basic test
Apologies upfront: Easily excited Talk fast Australian accent Large area to explain Questions, Slow down
“ The fundamental problem with program maintenance is that fixing a defect has a substantial (20-50 %) chance of introducing another defect.” Mythical Man Month
Today: Test Driven Development
Test Driven Development History
Toyota Production System by Taiichi Ohno
Competing with US companies was difficult. Smaller production runs of more models Waste when production runs finished and there were left over parts
Ohno reverse engineered the production line and created “Just in time” manufacturing
How is making cars anything like making software ?
Complex processes
Unable to be “explained” to the layman
Like Ohno, we have waste
Time
Money
Energy
Traditional model: Implementation Requirements Design Verification Maintenance
Unsurprisingly...
As a programmer, you will be caught in the waterfall model.
Your manager/your client will have provided the specs, and you now need to “follow the process”
You are a cog in the machine.
Manufacturing & construction industries Software has requirements that are never in spec. Requirements evolve over time Software developers are rarely domain experts BDUF meant changes later on were costly Waterfall model is based on “Physical Design”
Manufacturing & construction industries BDUF meant changes later on were costly Software is difficult to change in maintenance Two teams same project.
How do you do it ?
The rules of fight club.
1. Write new code only if an automated test has failed.
2. Eliminate duplication.
“ These are two simple rules, but they generate complex individual and group behavior with technical implications” Kent Beck
Unsurprisingly...
As a programmer, you will be caught in the waterfall model.
Your manager/your client will have provided the specs, and you now need to “follow the process”
You are a cog in the machine.
FAIL FAIL
Writing massive amounts of tests up front is “time expensive”, so with a goal in mind you can follow this flow chart. (Everyone loves flow charts)
Add a test Run the tests Change Run the tests
Tests shouldn't take long to write. Tests shouldn't take long to run. The drive the “development” of the application. Write what it takes to make the test pass, and that is all. YNGNIA
Live programming demo
Useful URLs: android-sdk/platforms/android-1.5/samples/ApiDemos My life with android (mylifewithandroid.blogspot.com) Diego Torres Milano's blog (dtmilano.blogspot.com)
“ The fundamental problem with program maintenance is that fixing a defect has a substantial (20-50 %) chance of introducing another defect.” Mythical Man Month
CodeAndroid.org
Android Developer/User Group
Grassroots effort by developers
Promote Android development around this region (SEA, Oceania)
You can join us on Facebook, Twitter (codeandroid), IRC (#codeandroid @ irc.freenode.net)
0 comments
Post a comment