Contrast these paradigms and discuss how the complement each other.
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.
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, ...)
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?
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:
- http://fitnesse.org/
- BDD Test
Once exploration is over, I want to transition from IP/LP to TDD. This is how I do it:
- Derive trusted source code
- We trust it because we sufficiently inspected and validated results
- Derive regression tests using artifacts generated by our code
- Freeze behavior
- Pave way for automated tests
- Refactor both source code and interactive inspection tools
- Continue
Wiki
- https://en.wikipedia.org/wiki/Test-driven_development
- https://en.wikipedia.org/wiki/Interactive_programming
- https://en.wikipedia.org/wiki/Literate_programming
Tools
Recommended Talks by Bret Victor