Lecture overview -- Keyboard shortcut: 'u'  Previous page: The highly responsible program -- Keyboard shortcut: 'p'  Next page: 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 13 : 32
Object-oriented Programming in C#
Contracts and Assertions
Responsibility division by pre and postconditions

Preconditions and postconditions can be used to divide the responsibility between classes in an object-oriented program

  • Fulfillment of the precondition

    • The responsibility of the caller

    • The responsibility of the client in an object-oriented program

  • Fulfillment of the postcondition

    • The responsibility of the called operation

    • The responsibility of the server in an object-oriented program

Blame the caller if a precondition of an operation fails

Blame the called operation if the postcondition of an operation fails