Good Contract programming idiom?

bearophile bearophileHUGS at lycos.com
Wed Mar 3 13:00:31 PST 2010


Norbert Nemec:
> No! No! No! Design-by-contract means that it is the application's duty 
> to make sure that argument values are correct. If the program is 
> correct, the library can trust that the argument values are correct and 
> does not need to do checks. This is exactly the same situation that 
> assertions are for: Double-checking something to catch potential bugs.
> 
> Exceptions are a very different issue and should never be used for this 
> purpose.
> 
> A library interface simply is something different than a user interface.

The page is modified according to your words and ideas, with just a bit of warning from the real world:
http://en.wikipedia.org/wiki/Class_invariant#D

Thank you, bye,
bearophile



More information about the Digitalmars-d mailing list