PHP Classes

Design By Contract

Recommend this page to a friend!

      PHP Classes blog  >  7 Reasons Why TDD Fai...  >  All threads  >  Design By Contract  >  (Un) Subscribe thread alerts  
Subject:Design By Contract
Summary:One area TDD helps is to ensure you have the right specification
Author:Cyril Ogana
Date:2014-06-11 16:21:36
Update:2014-06-12 00:21:51

  1. Design By Contract   Reply   Report abuse  
Picture of Cyril Ogana Cyril Ogana - 2014-06-11 20:33:14
There is a documentary I really like, called 'Engineering Connections' which tends to show that great designs came from picking the good bits and pieces of already existing designs to overcome engineering challenges.

I like this "TDD still makes sense in some cases, like for instance implementing standard protocols or specifications that will not change over time". I was kind of wondering, about also listing libraries as essential for TDD, since they should be pluggable in various projects, and must have a predictable interface. These may not implement protocols or specifications but may contain crucial low level functionality an example is the ezc components library, which has not been in very active maintenance for a couple of years now, but is of quite high quality.

Also, crucial for design by contract, is using the TDD to test the behaviour of these libraries, not the actual methods, and where we have used this in our projects we have found the results are much more predictable in various production sites

  2. Re: Design By Contract   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-06-12 00:21:51 - In reply to message 1 from Cyril Ogana
Right, contracts are as sort of specifications. So as long as contracts do not change, the tests may not need to change over time.