How Do We Teach TDD?Considering the Dreyfus  Model of Learning                  C. Keith Ray  Coach, Trainer, Developer at...
Whats TDD?TDD is Test-Driven Development. The simpledescription of TDD is:Red-Green-Refactor-Repeat: write a test thatfail...
Dreyfus ModelDreyfus came up with a model of learning. Henamed five levels:          Novice          Advanced Beginner     ...
NoviceCompletely new to the thing to be learned.Wants recipes, rules, constraintsThey dont know what "good" look likes yet...
Advanced beginnerKnows the rules, but not all the contexts forthem, knows just enough to be "dangerous."As a software deve...
CompetentCan do a task without needing instructions.Identifies patterns and uses them, mostly inappropriate contexts.May be...
ProficientGood, but now trying to become expert.Lots of experience / practice.Knows how to do stuff, but cant tell people ho...
ExpertBeyond rules.Working on instinct.Needs to compare notes with other experts.Arguing about their subject refines theiru...
TDD seems so simple, so why   is it hard to teach?Teacher: its red, green, refactor, repeat.<long time later>Student: ok, ...
TDD seems so simple, so why     is it hard to teach?Teacher: its red, green, refactor, repeat.<long time later>Student: he...
TDD seems so simple, so why   is it hard to teach?Teacher: its red, green, refactor, repeat.Student: <Doesnt understand wh...
TDD seems so simple, so why   is it hard to teach?Teacher: its red, green, refactor, repeat.Student: heres my tests and co...
TDD seems so simple, so why   is it hard to teach?Because each of the steps of TDD require skillsin three main areas:Writi...
Theres more,     Refactoring Requires:Recognizing symptoms of baddesign (code smells).Making small transformations toimpro...
"Simple Design"Kent Becks rules for simple design were: 1. Runs all the tests. 2.No duplication. 3. Expresses the develope...
Getting back to Dreyfus...We teach using web-base materials in livetraining and via coaching.Our web-based materials assum...
What Novices WantA "novice" is completely new to asubject.They want rules, recipes,formulas, step-by-stephow-to-do-it.They...
Breaking TDDSkill-Sets into Novice-sized    Pieces
Demo VideoVideos are usually short (around 5 minutes) and  demonstrate a technique or make a point.
Demo Quizzes   We have a variety of quiz types. Students cancomment on quiz answers or post questions and get a   prompt r...
Demo: Exercises        TDDing Big Bills         Billing SystemTask 1: Calculate A Simple Phone BillTask 2: Calculate Exces...
Demo: Critiques                                 Your score was 62% based on                                   our Automate...
ConclusionOur web-based training with critiques providesfeedback that Novices and Advanced Beginnersneed, and which would ...
Upcoming SlideShare
Loading in...5
×

How Do We Teach TDD Keith Ray

2,096

Published on

Slides from Keith Ray's talk on "How do we teach TDD? Considering the Dreyfus Model of Learning" Presented at SFPSD Monthly Meetup, 2011-03-29

1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
2,096
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
30
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

How Do We Teach TDD Keith Ray

  1. 1. How Do We Teach TDD?Considering the Dreyfus Model of Learning C. Keith Ray Coach, Trainer, Developer at Industrial Logic, Inc. keith@industriallogic.com twitter: @ckeithray http://industriallogic.com
  2. 2. Whats TDD?TDD is Test-Driven Development. The simpledescription of TDD is:Red-Green-Refactor-Repeat: write a test thatfails (red), write just enough code to make it pass(green), then refactor to a good design (aka"simple code"), and repeat.
  3. 3. Dreyfus ModelDreyfus came up with a model of learning. Henamed five levels: Novice Advanced Beginner Competent Proficient ExpertSee http://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition
  4. 4. NoviceCompletely new to the thing to be learned.Wants recipes, rules, constraintsThey dont know what "good" look likes yet, sothey want fast feedback.Craves rules.
  5. 5. Advanced beginnerKnows the rules, but not all the contexts forthem, knows just enough to be "dangerous."As a software developer, probably writing "bigballs of mud".Better to have them learning in a safeenvironment to learn from their mistakes. 5
  6. 6. CompetentCan do a task without needing instructions.Identifies patterns and uses them, mostly inappropriate contexts.May be offended if you treat them like a Noviceor Advanced Beginner.
  7. 7. ProficientGood, but now trying to become expert.Lots of experience / practice.Knows how to do stuff, but cant tell people howto do it.(Teaching has its own Novice to Expert levels)
  8. 8. ExpertBeyond rules.Working on instinct.Needs to compare notes with other experts.Arguing about their subject refines theirunderstanding of it.
  9. 9. TDD seems so simple, so why is it hard to teach?Teacher: its red, green, refactor, repeat.<long time later>Student: ok, heres all my tests!Teacher: wheres the code?Student: I havent written it yet. Teacher: Photo by striatic
  10. 10. TDD seems so simple, so why is it hard to teach?Teacher: its red, green, refactor, repeat.<long time later>Student: heres my first test. [400 lines of codein a single test.] Photo by Marcin Wichary
  11. 11. TDD seems so simple, so why is it hard to teach?Teacher: its red, green, refactor, repeat.Student: <Doesnt understand why the testshould fail before it is made to pass, so writescode and tests so that the tests usually pass thefirst time they are run.> oops
  12. 12. TDD seems so simple, so why is it hard to teach?Teacher: its red, green, refactor, repeat.Student: heres my tests and code.Teacher: nice, but youve got a very large class, with avery large method, and allyour tests are repeating lotsof code. Did you refactor?Student: I thought wedrefactor next month!
  13. 13. TDD seems so simple, so why is it hard to teach?Because each of the steps of TDD require skillsin three main areas:Writing tests.Writing simple code.Refactoring.
  14. 14. Theres more, Refactoring Requires:Recognizing symptoms of baddesign (code smells).Making small transformations toimprove the design. (The actualRefactorings.)Recognizing good design (aka"Simple Code")
  15. 15. "Simple Design"Kent Becks rules for simple design were: 1. Runs all the tests. 2.No duplication. 3. Expresses the developers intentions. 4.Minimizes the number of classes and methods. Photo by GN
  16. 16. Getting back to Dreyfus...We teach using web-base materials in livetraining and via coaching.Our web-based materials assume the student isin the Novice stage of learning about TDD.We also assume the student is at least in theCompetent stage as a programmer.We encourage pairing of students — it makes alarge improvement in learning.
  17. 17. What Novices WantA "novice" is completely new to asubject.They want rules, recipes,formulas, step-by-stephow-to-do-it.They dont know enough tojudge their own results, sothey need fast, frequentfeedback by coach or trainer. Photo by Steve Snodgrass
  18. 18. Breaking TDDSkill-Sets into Novice-sized Pieces
  19. 19. Demo VideoVideos are usually short (around 5 minutes) and demonstrate a technique or make a point.
  20. 20. Demo Quizzes We have a variety of quiz types. Students cancomment on quiz answers or post questions and get a prompt response from Industrial Logic staff.
  21. 21. Demo: Exercises TDDing Big Bills Billing SystemTask 1: Calculate A Simple Phone BillTask 2: Calculate Excess MinutesTask 3: etc.Student writes the code, compares it withsolution(s).Almost all solutions are demonstrated invideo form and downloadable code.
  22. 22. Demo: Critiques Your score was 62% based on our Automated Critique. This ranks you as Intermediate.A Graph of Your TDD Activity See several examples here.
  23. 23. ConclusionOur web-based training with critiques providesfeedback that Novices and Advanced Beginnersneed, and which would otherwise require one-to-onecoaching. This works for our live training as well aspurely web-based training.Try it out: http://elearning.industriallogic.com(PS: Competent, Proficient, and TDD Experts should try Sessions.)See also Dan North appling the Dreyfus model to a more general level of"best practices": http://www.infoq.com/articles/better-best-practices
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×