Why You Need To Go Home RED

4 Jul

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.

Advertisements

3 Responses to “Why You Need To Go Home RED”

  1. brian ball (@brianball) July 5, 2012 at 11:49 am #

    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?

  2. softwaretrading July 8, 2012 at 4:03 am #

    somehow going home red would be too tense for me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s