Lecture overview -- Keyboard shortcut: 'u'  Previous page: Design by Contract [Section] -- Keyboard shortcut: 'p'  Next page: DBC and Programming Languages  -- 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 28 : 32
Object-oriented Programming in C#
Contracts and Assertions
Design by Contract

Design by ContractTM (DBC) represents the idea of designing and specifying programs by means of assertions

  • Use of contracts in the phases and activities of software development

    • Design: A pragmatic approach to program specification

    • Documentation: Adds very important information to interface documentation of the classes

    • Implementation: Guides and constrains the actual programming

    • Verification: The program can be checked against the specification every time it is executed

    • Test:

      • Preconditions limit the testing work

      • The check of postconditions and class invariants do part of the testing work

    • End use: Trigger exception handling if assertions are violated