Lecture overview -- Keyboard shortcut: 'u'  Previous page: Responsibility division by pre and postconditions -- Keyboard shortcut: 'p'  Next page: Everyday Contracts -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 14 : 32
Object-oriented Programming in C#
Contracts and Assertions
Contracts

The preconditions and the postconditions together form a contract between the client class and the server class

A contract expresses the mutual obligations in between parts of a program that cooperate about the solution of some problem

  • Violating the contract

    • A serious problem

    • An error relative to the specification

    • Should raise an exception

    • Most likely stops the program execution