1
vote
2answers
466 views

Assertions vs Exceptions - is my understanding of the differences between the two correct? [duplicate]

Design By Contract uses preconditions and postconditions of the public methods in a class together to form a contract between the class and its clients. a) In code we implement preconditions ...
13
votes
4answers
709 views

Using assertions versus throwing exceptions?

Often when I write a functions I want to make sure the inputs to it are valid in order to detect such errors as early as possible (I believe these are called preconditions). When a precondition fails, ...