Skip to content

Latest commit

 

History

History

tdd-vs-ip-and-lp

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

TDD vs? Interactive and Literate Programming?

Contrast these paradigms and discuss how the complement each other.

Intro

Observation:

  • Both TDD and IP/LP focus on immediate feedback to support the dev process
  • IP/LP is very natural in the sense that I can literally translate my thoughts into code and see what happens
  • TDD wants me to think one step ahead
    • In some domains, this can be really hard
    • Depends on level of abstraction
  • For me it is sometimes difficult to smoothly transition between these paradigms

Questions to discuss:

  • In what regards are TDD and IP/LP similar and different?
  • How can these styles complement each other?
  • In which scenarios would you follow which paradigm?
  • ...

Demo on IP and LP

We agree early on that it is not an either or question but rather about contrasting the approaches.

IP/LP

Use cases

  • Exploration
    • What to I want?
    • What is relevant?
    • What is it that I really want to implement (later)?
  • Support and document learning process

Observations

  • Always inside out
  • Possibly one-off product that we throw away later
  • IP/LP tools like notebooks offer interesting ways to understand source code and domains (using animations, sliders, ...)

TDD

Observations

  • Less interactive
  • Can use a red test to approximate the expected outcome (this bears some similarity to IP)
  • Tests can use documentation language to describe their purpose
  • Can be outside-in
  • Sometimes TDD is not possible, then
    • Regression test
    • Additional assertions on demand
    • Is it possible to derive properties that we can test against?

Documentation Language

We observe that documentation language, i.e. easy-to-understand explanations are a common theme in other tools as well because this is useful. Examples:

Claus' Procedure for "IP/LP to TDD"

Once exploration is over, I want to transition from IP/LP to TDD. This is how I do it:

  1. Derive trusted source code
  • We trust it because we sufficiently inspected and validated results
  1. Derive regression tests using artifacts generated by our code
  • Freeze behavior
  • Pave way for automated tests
  1. Refactor both source code and interactive inspection tools
  2. Continue

Links

Wiki

Tools

Recommended Talks by Bret Victor