Why You Need To Go Home RED

Test Driven Development (TDD) is driven by the RED => GREEN => REFACTOR cycle. You write a test, see it turn RED, add some code, run the test again and see it turn GREEN, then REFACTOR your code to DRY  it up (remove any duplication). One piece of advice that stood out to me about TDD is to go home RED.


Before I heard this advice, I really tried to go home GREEN. Why? Well, green feels good. When I tackle a challenging problem, I want to go home with that good feeling.

When thinking about the next day, though, RED is actually a better habit to get into. When you start working the next day, if all you were left with was GREEN from the previous day, you have to think really hard about what happened yesterday and what the next steps should be.

If you come in to work RED, then your last-night self (which was in the zone) already told you what to do next. This way, you start tackling the next problem right away, so it’s much easier to get into your code at the start of your work day.

Enjoy the article? Join over 17,500+ Swift developers and enthusiasts who get my weekly updates.

  • Natasha, tell us more about how you guys are learning Testing. Is it RSpec? Test Unit? What are some small projects you’re starting with that other new learners can use?

  • somehow going home red would be too tense for me.