How Do We Teach TDD Keith Ray
Upcoming SlideShare
Loading in...5
×
 

How Do We Teach TDD Keith Ray

on

  • 2,246 views

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

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

Statistics

Views

Total Views
2,246
Slideshare-icon Views on SlideShare
2,246
Embed Views
0

Actions

Likes
1
Downloads
27
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • This discussion is for people who teach Test Driven Development.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    How Do We Teach TDD Keith Ray How Do We Teach TDD Keith Ray Presentation Transcript

    • 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
    • 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.
    • 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
    • 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.
    • 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
    • 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.
    • 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)
    • ExpertBeyond rules.Working on instinct.Needs to compare notes with other experts.Arguing about their subject refines theirunderstanding of it.
    • 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
    • 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
    • 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
    • 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!
    • 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.
    • Theres more, Refactoring Requires:Recognizing symptoms of baddesign (code smells).Making small transformations toimprove the design. (The actualRefactorings.)Recognizing good design (aka"Simple Code")
    • "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
    • 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.
    • 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
    • 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 response from Industrial Logic staff.
    • 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.
    • 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.
    • 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