¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: "The design signals are weak"


 

On Mon, Jul 24, 2023 at 10:51?AM Olof Bjarnason <olof.bjarnason@...> wrote:
I have a couple of opinions/experiences I want to share on the?topic of design pressure and TDD.

TDD has three 'states' which I think of as animals or colors:

?BLUE/Owl: "add a test" (understand the problem / see the big picture)
?RED/Rabbit: "make it pass" (as quickly as possible / run for your life)
?GREEN/Cat: "make it right" (improve readability / enjoy life)

Cute. I love it.
?
I re-invented my own view of what good design is when I started out with TDD in 2006, and I think that requires an effort of curiosity?and time. It is not comfortable if you are stuck in your own ideas of what?good design is -- especially if that design isn't very testable. Prime example: letting go of patterns which makes testing harder, like the Singleton pattern from GoF.

This captures very well how I try to teach the technique: as a change in or a difference in values. The people who practise TDD _and stick with it_ tend to either change their values in the process or discover that TDD helps them live more authentically the values they already had. I think I was in the second category.

*GREEN/refactoring state of TDD does give you a chance to improve things, both in test code and production code. Especially for the 'internal' quality of the production code (implementation details). The API/external design is also possible to change, but at a higher cost than from writing the first test / API design. That is why I think the highest pressure is in BLUE rather than GREEN state.

I think it does more, and this seems to be a somewhat controversial point: it both gives you the opportunity and suggests options and reminds you to consider those options. That is a sense in which TDD leads (on average) to better designs (according to our revised notion of "good" that includes "adaptability" as a "good" property).
--
J. B. (Joe) Rainsberger :: ?:: ::

Replies from this account routinely take a few days, which allows me to reply thoughtfully. I reply more quickly to messages that clearly require answers urgently. If you need something from me and are on a deadline, then let me know how soon you need a reply so that I can better help you to get what you need. Thank you for your consideration.

--
J. B. (Joe) Rainsberger :: :: ::
Teaching evolutionary design and TDD since 2002

Join [email protected] to automatically receive all group messages.