Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Add TDD to your Toolbox: an introduction to TDD

Introduction to TDD, test-driven development. Not included is a live coding demonstration of TDD in practice. Look at the link on the last slide for videos of other people doing TDD.

  • Login to see the comments

Add TDD to your Toolbox: an introduction to TDD

  1. 1. Add TDD to your toolbox an introduction for beginners Audrey Troutt @auditty
  2. 2. What is TDD? Test-Driven Development Audrey Troutt @auditty
  3. 3. Audrey Troutt @auditty Three conditions to achieve a flow state: 1. clear set of goals and progress 2. clear and immediate feedback 3. confidence in one's ability Csikszentmihalyi, M.; Abuhamdeh, S. & Nakamura, J. (2005), "Flow", in Elliot, A., Handbook of Competence and Motivation
  4. 4. “TDD is dead. Long live testing.” -David Heinemeier Hansson Read more: Audrey Troutt @auditty
  5. 5. Materials needed: Source code Unit testing framework Understanding of requirements Audrey Troutt @auditty
  6. 6. Simple Case: There’s a bug Audrey Troutt @auditty
  7. 7. Use Case: From the Ground Up Audrey Troutt @auditty
  8. 8. “As the tests get more specific, the code gets more generic.” -Uncle Bob Martin Read more: Audrey Troutt @auditty
  9. 9. ● ({}–>nil) no code at all->code that employs nil ● (nil->constant) ● (constant->constant+) a simple constant to a more complex constant ● (constant->scalar) replacing a constant with a variable or an argument ● (statement->statements) adding more unconditional statements. ● (unconditional->if) splitting the execution path ● (scalar->array) ● (array->container) ● (statement->recursion) ● … and so on Read more: Audrey Troutt @auditty
  10. 10. Pros: ● More tests ● More testable code ● Discover missing requirements sooner ● Uncover novel designs ● Increased quality ● Refactor/add on with confidence ● Doesn’t generally take more time ● May start conversations Cons: ● First time setup of test framework takes extra time ● Not always practical (if requirements are not well defined) ● Makes changing object model harder ● May start conversations Audrey Troutt @auditty
  11. 11. “I credit TDD for teaching me how to test, and I still get huge benefits when I TDD. It’s not perfect, but no one technique is the key to magically producing better code.” -Justin Weiss Read more: Audrey Troutt @auditty
  12. 12. Practice Learn from others Audrey Troutt @auditty