Learning to test-first

If you didn’t learn it that way, test-first isn’t the easiest way to program.

But it can be learned.

  1. Write the code you’re going to write anyway.
  2. Test your just-written code thoroughly.
  3. Keep your tests and throw away all your code.
  4. Now rewrite your code.

It takes extra time, but only the first time.

Given you’re writing test code anyway, test-first will pay you back the second or third time you write the code.

If you’re not writing test code, move along, nothing to see here.