Red-Green-Refactor Test Driven Development hatI’ve achieved some notoriety with my Test Driven Development hat. Not so much when I wear itat AgileTechDC2011, but certainly when Uncle Bob does. So much so that he has received queries about acquiring or making them.

I never planned on making a profit from these hats. I only built one, to use as a prop when I’m describing Test Driven Development. Apparently there is more demand than I anticipated.

Since I don’t want to go into the hat business, I’ve decided to license the design under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. Basically that means that you acknowledge the design came from me, and that you don’t assert any proprietary rights over adaptations to the design. Other than that, you’re welcome to make them, give them away, put advertising on them, sell them, …. Have at it!

I got the red, green, and blue baseball caps on Amazon. You’ll find more detailed views below. I originally thought to unstitch the hats and restitch the front pieces together. That appeared to be too difficult, so I cut the red and green ones apart and stitched the front pieces onto the blue one. This left the size adjustment still working.

red side green side blue side underside


Categories: Uncategorized


22 Replies to “TDD Hat”

  1. Would you mind expanding on how this fits into your explanation of TDD? I’m guessing I’d use it when talking about the common practice of using a build status light to remind everyone of the status of the build, but I haven’t come up with patter that fits a hat seamlessly into the story.

    1. It’s about being mindful of the current state as you’re doing TDD, and only doing one thing at a time.

      If you’re in the green state, you can write a test and go to red. If you’re in a red state, you should only write code to return to green (or back out the test).

      When you refactor (starting only in the green state), you shouldn’t be doing anything else, either new tests or new functionality.

  2. Thank you for the great idea, I built one ! I think this will be a nice attraction at work, leading to an introduction to TDD to anyone who will feel curious about my hat (and who wouldn’t ?)

  3. Sou novato no TDD e estou a princípio satisfeito nessa nova ideia de criar cenário de testes. Fortemente recomendado.

  4. Great idea, but the TDD cycles are so short you would lose time readjusting it all the time. How about an IOT mechanized hat that is linked to your IDE and senses when to rotate itself? 🙂

  5. I love it, but how I did’nt have someone to sew, I buyit 3 hats with these colors, and I use it in right moment. 😀

  6. Hi George,
    I like your idea with the TDD hats so much that I would like to make and sell them.
    I haven’t found any shop yet which offers them.

    If I put a label “Designed by G. Dinwiddie” on them, is that enough for you?

    All the best,
    Michael Mirwaldt

  7. Hi George,
    I will add this notice to all hats:
    “Designed by George Dinwiddie,
    licensed CC BY-SA 3.0”
    Is that enough for you?

  8. When are you going to start selling these hats? For about the last 10 years I have been I’ve I’ve been dreaming of having it at my desk and wearing it during coding sessions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.