The long way through Software Craftsmanship

Redesign as a new TDD phase

Apr 13, 2015 - 2 minute read - Comments - redesigntddtheory

In the last TDD workshop (experience report here), a conversation with Gary McLean Hall introduced to me this new concept of “Redesign” as a TDD phase.

Concept

As Gary introduced it to me1, it is a phase that might appear after refactor.

It is about changing the outside design without changing the expected behavior. I thought this was also included in the refactor phase.

How I do redesign

I usually do this “changing of the outside design” by applying a series of refactors 2 to the production code but not changing the test code; using a bridge / adapter to get to the new API from the old one. Later you can inline the scaffold and use the new API directly.

The same for the test code: when you want to change design in the test code, do not modify production code (a.k.a. model code).

Other thoughts

Merriam-Webster defines “redesign” as

to change the design of (something)

or

to revise in appearance, function, or content

an example:

The book’s cover has been redesigned for the new edition.

The Refactoring book (by Martin Fowler) describes “refactoring” as

Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure

Taken literally, the public API is not internal but external structure, so changing it, should belong to a phase that is not refactor (see definition), nor red (no failing tests), not green (making it pass). Maybe this phase is “redesign” or we have to take the refactoring phase less literally so it includes redesign. Any thoughts?

Other references

I’ve searched for redesign and refactor and this blog post came up. They cite redesign as a way of rewriting

This answer and the original question in StackOverflow is interesting

Redesign also appears cited in this blog post


  1. Excuse me if you explained it differently and I understand it wrong; you can always open a pull request to fix it here ↩︎

  2. thanks for the clarifying refactor vs refactoring here ↩︎