title: What are the best practices for Design by Contract programming
body: <p>What are the best practices for Design by Contract programming.</p>
  
  <p>At college I learned the design by contract paradigma
  (in an OO environment)
  We've learned three ways to tackle the problem : </p>
  
  <p>1) Total Programming : Covers all possible exceptional cases in its
  effect (cf. Math)</p>
  
  <p>2) Nominal Programming : Only 'promises' the right effects when the preconditions are met. (otherwise effect is undefined)</p>
  
  <p>3) Defensive Programming : Use exceptions to signal illegal invocations of methods</p>
  
  <p>Now, we have focussed in different OO scenarios on the correct use in each situation, but we haven't learned WHEN to use WHICH...
  (Mostly the tactics where inforced by the exercice..)</p>
  
  <p>Now I think it's very very strange that I haven't asked my teacher (but then again, during lectures, noone has) </p>
  
  <p>Personally, I never use nominal now, and tend to replace preconditions with exceptions (so i rather use : throws IllegalDivisionByZero, than stating 'precondition : divider should differ from zero) and only program total what makes sense (so I wouldn't return a conventional value on division by zero), but this method is just based on personal findings and likes.</p>
  
  <p>so I am asking you guys : </p>
  
  <p>Are there any best practises?? </p>