Design by Contract is a methodology that was populated by Eiffel language. The DbC ideas have common aims with Test Driven Development (TDD). Both focus on software quality and tests written with code in parallel. The idea of DbC is based on contract - contract between client code and service. Each class is a service that provides set of methods (nothing new). Each method call is a client. Contract between them says that if the client satisfies some preconditions then service will ensure some postconditions. ......
I am big fun of Test Driven Development (TDD). I recently read quite good article about unit testing: Write Maintainable Unit Tests That Will Save You Time And Tears. Here is an extract of the article: Fail First (before you write piece of logic, write fail test first) - do not write any test, but simulate production environment that will use the logic so the test will remain as regression test of your logic. Requirements conflict (old UT fails when new funct. is introduced) - remove or enhance old ......