SlideShare a Scribd company logo
1 of 23
Download to read offline
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
What's TDD?


TDD is Test-Driven Development. The simple
description of TDD is:

Red-Green-Refactor-Repeat: write a test that
fails (red), write just enough code to make it pass
(green), then refactor to a good design (aka
"simple code"), and repeat.
Dreyfus Model

Dreyfus came up with a model of learning. He
named five levels:

          Novice
          Advanced Beginner
          Competent
          Proficient
          Expert
See http://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition
Novice

Completely new to the thing to be learned.

Wants recipes, rules, constraints

They don't know what "good" look likes yet, so
they want fast feedback.

Craves rules.
Advanced beginner

Knows the rules, but not all the contexts for
them, knows just enough to be "dangerous."

As a software developer, probably writing "big
balls of mud".

Better to have them learning in a safe
environment to learn from their mistakes.


                       5
Competent


Can do a task without needing instructions.

Identifies patterns and uses them, mostly in
appropriate contexts.

May be offended if you treat them like a Novice
or Advanced Beginner.
Proficient

Good, but now trying to become expert.

Lots of experience / practice.

Knows how to do stuff, but can't tell people how
to do it.

(Teaching has its own Novice to Expert levels)
Expert

Beyond rules.

Working on instinct.

Needs to compare notes with other experts.

Arguing about their subject refines their
understanding of it.
TDD seems so simple, so why
   is it hard to teach?
Teacher: it's red, green, refactor, repeat.

<long time later>

Student: ok, here's all my tests!

Teacher: where's the code?

Student: I haven't written it yet.

                            Teacher:
                       Photo by striatic
TDD seems so simple, so why
     is it hard to teach?

Teacher: it's red, green, refactor, repeat.

<long time later>

Student: here's my first test. [400 lines of code
in a single test.]




                               Photo by Marcin Wichary
TDD seems so simple, so why
   is it hard to teach?

Teacher: it's red, green, refactor, repeat.

Student: <Doesn't understand why the test
should fail before it is made to pass, so writes
code and tests so that the tests usually pass the
first time they are run.>

                   oops
TDD seems so simple, so why
   is it hard to teach?
Teacher: it's red, green, refactor, repeat.
Student: here's my tests and code.
Teacher: nice, but you've got a very large class, with a
very large method, and all
your tests are repeating lots
of code. Did you refactor?
Student: I thought we'd
refactor next month!
TDD seems so simple, so why
   is it hard to teach?
Because each of the steps of TDD require skills
in three main areas:

Writing tests.

Writing simple code.

Refactoring.
There's more,
     Refactoring Requires:
Recognizing symptoms of bad
design (code smells).

Making small transformations to
improve the design. (The actual
Refactorings.)

Recognizing good design (aka
"Simple Code")
"Simple Design"

Kent Beck's rules for simple design were:
 1. Runs all the tests.
 2.No duplication.
 3. Expresses the developer's
    intentions.
 4.Minimizes the number of classes
    and methods.


                                            Photo by GN
Getting back to Dreyfus...
We teach using web-base materials in live
training and via coaching.

Our web-based materials assume the student is
in the Novice stage of learning about TDD.

We also assume the student is at least in the
Competent stage as a programmer.

We encourage pairing of students — it makes a
large improvement in learning.
What Novices Want
A "novice" is completely new to a
subject.
They want rules, recipes,
formulas, step-by-step
how-to-do-it.
They don't know enough to
judge their own results, so
they need fast, frequent
feedback by coach or trainer.
                                    Photo by Steve Snodgrass
Breaking TDD
Skill-Sets into
 Novice-sized
    Pieces
Demo Video




Videos are usually short (around 5 minutes) and
  demonstrate a technique or make a point.
Demo Quizzes




   We have a variety of quiz types. Students can
comment on quiz answers or post questions and get a
   prompt response from Industrial Logic staff.
Demo: Exercises

        TDDing Big Bill's
         Billing System

Task 1: Calculate A Simple Phone Bill

Task 2: Calculate Excess Minutes

Task 3: etc.

Student writes the code, compares it with
solution(s).

Almost all solutions are demonstrated in
video 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.
Conclusion
Our web-based training with critiques provides
feedback that Novices and Advanced Beginners
need, and which would otherwise require one-to-one
coaching. This works for our live training as well as
purely 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

More Related Content

What's hot

SC17042012:ArseniyBurekhin-The Clean Coder
SC17042012:ArseniyBurekhin-The Clean CoderSC17042012:ArseniyBurekhin-The Clean Coder
SC17042012:ArseniyBurekhin-The Clean CoderCiklum Ukraine
 
TDD for the masses
TDD for the massesTDD for the masses
TDD for the massesJorge Ortiz
 
Workshop on programming contest
Workshop on programming contestWorkshop on programming contest
Workshop on programming contestAbir Khan
 
Intro to Unit Testing with test Driven Development
Intro to Unit Testing with test Driven DevelopmentIntro to Unit Testing with test Driven Development
Intro to Unit Testing with test Driven DevelopmentJoel Cochran
 
An introduction to Competitive Programming
An introduction to Competitive ProgrammingAn introduction to Competitive Programming
An introduction to Competitive ProgrammingGaurav Agarwal
 
2013 09-11 java zone - extreme programming live
2013 09-11 java zone - extreme programming live2013 09-11 java zone - extreme programming live
2013 09-11 java zone - extreme programming liveJohannes Brodwall
 
Robotics Syllabus 2016 2017
Robotics Syllabus 2016 2017Robotics Syllabus 2016 2017
Robotics Syllabus 2016 2017Justin Joslin
 
Determining The Barriers Faced By Novice Programmers
Determining The Barriers Faced By Novice ProgrammersDetermining The Barriers Faced By Novice Programmers
Determining The Barriers Faced By Novice ProgrammersWaqas Tariq
 
Programming the Programmer
Programming the ProgrammerProgramming the Programmer
Programming the Programmervipinkumar_n
 
Building software vs programming
Building software vs programmingBuilding software vs programming
Building software vs programmingMauricio Voto
 
Software testing _mod_9
Software testing _mod_9Software testing _mod_9
Software testing _mod_9hellosashi
 
Bcc exceed ste_cert
Bcc exceed ste_certBcc exceed ste_cert
Bcc exceed ste_certSusan L.
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated TestsTrisha Gee
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated TestsTrisha Gee
 
Preparing for a .Net Interview
Preparing for a .Net Interview Preparing for a .Net Interview
Preparing for a .Net Interview CareerBuilder
 
AS Coursework overall feedback
AS Coursework overall feedback AS Coursework overall feedback
AS Coursework overall feedback charlottielambert
 
Shuffle and learn: Unsupervised Learning using Temporal Order Verification (U...
Shuffle and learn: Unsupervised Learning using Temporal Order Verification (U...Shuffle and learn: Unsupervised Learning using Temporal Order Verification (U...
Shuffle and learn: Unsupervised Learning using Temporal Order Verification (U...Universitat Politècnica de Catalunya
 

What's hot (20)

SC17042012:ArseniyBurekhin-The Clean Coder
SC17042012:ArseniyBurekhin-The Clean CoderSC17042012:ArseniyBurekhin-The Clean Coder
SC17042012:ArseniyBurekhin-The Clean Coder
 
TDD for the masses
TDD for the massesTDD for the masses
TDD for the masses
 
Workshop on programming contest
Workshop on programming contestWorkshop on programming contest
Workshop on programming contest
 
Intro to Unit Testing with test Driven Development
Intro to Unit Testing with test Driven DevelopmentIntro to Unit Testing with test Driven Development
Intro to Unit Testing with test Driven Development
 
Tdd
TddTdd
Tdd
 
Pair Programming
Pair ProgrammingPair Programming
Pair Programming
 
An introduction to Competitive Programming
An introduction to Competitive ProgrammingAn introduction to Competitive Programming
An introduction to Competitive Programming
 
2013 09-11 java zone - extreme programming live
2013 09-11 java zone - extreme programming live2013 09-11 java zone - extreme programming live
2013 09-11 java zone - extreme programming live
 
Robotics Syllabus 2016 2017
Robotics Syllabus 2016 2017Robotics Syllabus 2016 2017
Robotics Syllabus 2016 2017
 
Determining The Barriers Faced By Novice Programmers
Determining The Barriers Faced By Novice ProgrammersDetermining The Barriers Faced By Novice Programmers
Determining The Barriers Faced By Novice Programmers
 
Programming the Programmer
Programming the ProgrammerProgramming the Programmer
Programming the Programmer
 
Building software vs programming
Building software vs programmingBuilding software vs programming
Building software vs programming
 
Software testing _mod_9
Software testing _mod_9Software testing _mod_9
Software testing _mod_9
 
Bcc exceed ste_cert
Bcc exceed ste_certBcc exceed ste_cert
Bcc exceed ste_cert
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
Preparing for a .Net Interview
Preparing for a .Net Interview Preparing for a .Net Interview
Preparing for a .Net Interview
 
AS Coursework overall feedback
AS Coursework overall feedback AS Coursework overall feedback
AS Coursework overall feedback
 
Caleb Richardson Resume
Caleb Richardson ResumeCaleb Richardson Resume
Caleb Richardson Resume
 
Shuffle and learn: Unsupervised Learning using Temporal Order Verification (U...
Shuffle and learn: Unsupervised Learning using Temporal Order Verification (U...Shuffle and learn: Unsupervised Learning using Temporal Order Verification (U...
Shuffle and learn: Unsupervised Learning using Temporal Order Verification (U...
 

Similar to How Do We Teach TDD Keith Ray

TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019Paulo Clavijo
 
Bdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propriBdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propriCommit University
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven DevelopmentMichael Denomy
 
Tdd and-design-draft
Tdd and-design-draftTdd and-design-draft
Tdd and-design-draftPrabudhGupta1
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Vijay Kumbhar
 
Introduction to TDD
Introduction to TDDIntroduction to TDD
Introduction to TDDAhmed Misbah
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Developmentbhochhi
 
Rapid usability testing
Rapid usability testingRapid usability testing
Rapid usability testinglisarex
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...mCloud
 
Hey You Got Your TDD in my SQL DB by Jeff McKenzie
Hey You Got Your TDD in my SQL DB by Jeff McKenzieHey You Got Your TDD in my SQL DB by Jeff McKenzie
Hey You Got Your TDD in my SQL DB by Jeff McKenzieQA or the Highway
 
Kata Your Way to SW Craftsmanship
Kata Your Way to SW CraftsmanshipKata Your Way to SW Craftsmanship
Kata Your Way to SW CraftsmanshipCamille Bell
 
Jdojo@Gbg Introduction
Jdojo@Gbg IntroductionJdojo@Gbg Introduction
Jdojo@Gbg IntroductionFredrik Wendt
 

Similar to How Do We Teach TDD Keith Ray (20)

TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
Bdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propriBdd - L'arte di non farsi i fatti propri
Bdd - L'arte di non farsi i fatti propri
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven Development
 
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
Ian Cooper webinar for DDD Iran: Kent beck style tdd   seven years afterIan Cooper webinar for DDD Iran: Kent beck style tdd   seven years after
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
 
Agile Practices
Agile PracticesAgile Practices
Agile Practices
 
TDD in Agile
TDD in AgileTDD in Agile
TDD in Agile
 
Tdd and-design-draft
Tdd and-design-draftTdd and-design-draft
Tdd and-design-draft
 
TDD & Refactoring
TDD & RefactoringTDD & Refactoring
TDD & Refactoring
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy
 
Introduction to TDD
Introduction to TDDIntroduction to TDD
Introduction to TDD
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Intro to TDD
Intro to TDDIntro to TDD
Intro to TDD
 
Rapid usability testing
Rapid usability testingRapid usability testing
Rapid usability testing
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
 
Hey You Got Your TDD in my SQL DB by Jeff McKenzie
Hey You Got Your TDD in my SQL DB by Jeff McKenzieHey You Got Your TDD in my SQL DB by Jeff McKenzie
Hey You Got Your TDD in my SQL DB by Jeff McKenzie
 
Kata Your Way to SW Craftsmanship
Kata Your Way to SW CraftsmanshipKata Your Way to SW Craftsmanship
Kata Your Way to SW Craftsmanship
 
Code Retreat
Code RetreatCode Retreat
Code Retreat
 
Jdojo@Gbg Introduction
Jdojo@Gbg IntroductionJdojo@Gbg Introduction
Jdojo@Gbg Introduction
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
S T U D A R T P R O J E C T
S T U D A R T  P R O J E C TS T U D A R T  P R O J E C T
S T U D A R T P R O J E C T
 

How Do We Teach TDD Keith Ray

  • 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. What's TDD? TDD is Test-Driven Development. The simple description of TDD is: Red-Green-Refactor-Repeat: write a test that fails (red), write just enough code to make it pass (green), then refactor to a good design (aka "simple code"), and repeat.
  • 3. Dreyfus Model Dreyfus came up with a model of learning. He named five levels: Novice Advanced Beginner Competent Proficient Expert See http://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition
  • 4. Novice Completely new to the thing to be learned. Wants recipes, rules, constraints They don't know what "good" look likes yet, so they want fast feedback. Craves rules.
  • 5. Advanced beginner Knows the rules, but not all the contexts for them, knows just enough to be "dangerous." As a software developer, probably writing "big balls of mud". Better to have them learning in a safe environment to learn from their mistakes. 5
  • 6. Competent Can do a task without needing instructions. Identifies patterns and uses them, mostly in appropriate contexts. May be offended if you treat them like a Novice or Advanced Beginner.
  • 7. Proficient Good, but now trying to become expert. Lots of experience / practice. Knows how to do stuff, but can't tell people how to do it. (Teaching has its own Novice to Expert levels)
  • 8. Expert Beyond rules. Working on instinct. Needs to compare notes with other experts. Arguing about their subject refines their understanding of it.
  • 9. TDD seems so simple, so why is it hard to teach? Teacher: it's red, green, refactor, repeat. <long time later> Student: ok, here's all my tests! Teacher: where's the code? Student: I haven't written it yet. Teacher: Photo by striatic
  • 10. TDD seems so simple, so why is it hard to teach? Teacher: it's red, green, refactor, repeat. <long time later> Student: here's my first test. [400 lines of code in a single test.] Photo by Marcin Wichary
  • 11. TDD seems so simple, so why is it hard to teach? Teacher: it's red, green, refactor, repeat. Student: <Doesn't understand why the test should fail before it is made to pass, so writes code and tests so that the tests usually pass the first time they are run.> oops
  • 12. TDD seems so simple, so why is it hard to teach? Teacher: it's red, green, refactor, repeat. Student: here's my tests and code. Teacher: nice, but you've got a very large class, with a very large method, and all your tests are repeating lots of code. Did you refactor? Student: I thought we'd refactor next month!
  • 13. TDD seems so simple, so why is it hard to teach? Because each of the steps of TDD require skills in three main areas: Writing tests. Writing simple code. Refactoring.
  • 14. There's more, Refactoring Requires: Recognizing symptoms of bad design (code smells). Making small transformations to improve the design. (The actual Refactorings.) Recognizing good design (aka "Simple Code")
  • 15. "Simple Design" Kent Beck's rules for simple design were: 1. Runs all the tests. 2.No duplication. 3. Expresses the developer's intentions. 4.Minimizes the number of classes and methods. Photo by GN
  • 16. Getting back to Dreyfus... We teach using web-base materials in live training and via coaching. Our web-based materials assume the student is in the Novice stage of learning about TDD. We also assume the student is at least in the Competent stage as a programmer. We encourage pairing of students — it makes a large improvement in learning.
  • 17. What Novices Want A "novice" is completely new to a subject. They want rules, recipes, formulas, step-by-step how-to-do-it. They don't know enough to judge their own results, so they need fast, frequent feedback by coach or trainer. Photo by Steve Snodgrass
  • 18. Breaking TDD Skill-Sets into Novice-sized Pieces
  • 19. Demo Video Videos are usually short (around 5 minutes) and demonstrate a technique or make a point.
  • 20. Demo Quizzes We have a variety of quiz types. Students can comment on quiz answers or post questions and get a prompt response from Industrial Logic staff.
  • 21. Demo: Exercises TDDing Big Bill's Billing System Task 1: Calculate A Simple Phone Bill Task 2: Calculate Excess Minutes Task 3: etc. Student writes the code, compares it with solution(s). Almost all solutions are demonstrated in video form and downloadable code.
  • 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. Conclusion Our web-based training with critiques provides feedback that Novices and Advanced Beginners need, and which would otherwise require one-to-one coaching. This works for our live training as well as purely 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