Pragmatic approach to TDD

698 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
698
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Pragmatic approach to TDD

  1. 1. Pragmatic approach to TDD 13/11/2010, Agile Saturday, Tallinn
  2. 2. Look, who’s talking!?  Name: Dmitry Lebedev  Experience: since 1997, developer, tester, team- lead, architect, dev-manager  Current company: Idea Port Riga  Current hobby: non-profitable org DevExperts, whish is responsible for Agile Latvia and JUG Latvia
  3. 3. What is TDD
  4. 4. So what?!  Force to write tests  Simplify your code  Code becomes less coupled  Tests become your safety net for changes
  5. 5. Ways to failure with TDD  Advanced algorithms implementation  math  multithreading  A lot of integrations  May lead to tests overload with mocking  Not everything could be mocked (java.net.URL)  Might be hard to imitate real 3rd party components  Keep your coding habits  Fear of writing tests  Long methods  Avoidance of refactoring
  6. 6. Ways to succeed with TDD  Start from the scratch  Setup your infrastructure first  Build scripts  Continuous integration  Version control  Define coding conventions  Choose a platform which have built-in:  Architectural patterns  Test support  Revise your coding habits
  7. 7. Design?!  What is design?  a specification of an object, manifested by an agent, intended to accomplish goals, in a particular environment, using a set of primitive components, satisfying a set of requirements, subject to constraints;  Purpose of design  Specify how goals could be accomplished  Make fundamental statements on which to base decisions  Describe how separate pieces could be assembled into whole
  8. 8. CRC Cards Class : Web Browser Responsibility: display toolbars and page content Collaboration: Toolbar, Web Page
  9. 9. Agile Model Driven Development  Iteration 0  Initial Requirements Envisioning  Initial Architectural Envisioning  Iteration 1..n  Iteration Modeling  Model Storming  Test Driven Development  http://www.agilemodeling.com/essays/amdd.htm
  10. 10. How to adopt TDD for ongoing projects  Worst case  Creepy Design  No Unit Tests  Better case  Design is clear  Some UT are present  Threats  New code made by TDD may break old design  Writing tests which affect already existing code might be tricky  You may need not only re-factor, but re-design
  11. 11. My experience with TDD and legacy project  Make a prototype in code  State results (CRC cards, Whiteboard, Free form text)  Erase prototype  Start doing TDD
  12. 12. Questions?!

×