Fake It Outside-In TDD
In the context of bigger systems classic emergent design can result in losing a lot of time by letting similar responsibilities emerge again and again. In contrast the London School of TDD works Outside-In using mocks. It shines whenever the objects' responsibilities are quite clear upfront. An alternative I’ve developed over the last year is "Fake It Outside-In TDD". Instead of mocks fake data originating from the test assertion become your primary design driver. On an incremental destructuring journey down the call stack the data morphs more and more into structure. Design develops "Outside-In" but on a "green bar" in the refactoring phase as opposed to London Style on a "red bar" when writing your tests. The remaining real "logic" is tackled with regular unit-test level TDD.
The approach hits the sweet spot
- when there is little complexity in the interactions,
- when the structure is complex or
- when design skills aren’t very sophisticated yet or when teachability of TDD is important.
The session starts by explaining the different TDD approaches including the "Fake It Outside-In" variant. In a pair-programming session we then try out the new approach, followed by a discussion of our observations and opinions regarding the approach. The session ends with a comparison of the respective TDD approaches’ strengths and weaknesses.
David Völkel works as a Senior IT Consultant for codecentric AG. An avid Software Craftsman, he loves to share his ideas as a conference speaker. He is also the co-organizer of the Munich “Softwerkskammer” Craftsmanship Meetup.