Comment Driven Development

So on a reading trip about testing, I read about how certain parts of the aerospace industry practice TDD on the order of 4-to-1. Meaning 4 tests for every part of the system.

This got me thinking. We should start using Comment Driven Development*. How many lines of comment could we get in for each line of code. Just imagine how clear our code would be.

Example

Take this example:

jonny.go_to_store

Now, sure that is clear, but it could be better. Here it is with 100% CDD Coverage:

#Send jonny to the store
jonny.go_to_store

Even better is 200% CDD Coverage:

#Send jonny to the store, three blocks north and one block tothe left.
#he should get eggs, bacon and milk while he is there.
jonny.go_to_store.

Continue Reading »