Testing Testing 123 (test driven development)
If you think about it, it makes complete sense. Assuming you are planning to write test cases anyway, it’s no more effort than writing them later. And the big advantage of writing them first?
If you know how you’re going to test it, you write the code to pass first time! Simple really. Simple but inspired.