Software development rules

by Michael F. Collins, III August 05, 2008 13:36

I recently came across a quote attributable to Robert C. Martin which stated three rules for test-driven development.  I'd like to share them with you:

  1. You are not allowed to write any production code unless it is to make a failing unit test pass.
  2. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
  3. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

I think that these are excellent rules that all programmers should consider strongly when developing code. I've waffled back-and-forth over the past few years on writing tests first, then writing code first and testing it later, and every other combination in-between.  I'm not a fan of writing the complete test up front because at times I'm not really sure what the full functionality is going to be, and after all, isn't that why we design while we code?

I think that these rules properly state the way that test-driven development is supposed to work.



Tags: ,

TDD | Testing Software

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen | Modified by Mooglegiant

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

What I'm reading now


Add to Technorati Favorites

Disclaimer

The views expressed on this website/blog are the opinions of Michael F. Collins, III, and do not necessarily reflect the views of my employer.