CSC/ECE 517 Fall 2011/ch6 6a pc

From Expertiza_Wiki
Jump to navigation Jump to search

6a (was 5c). Lecture 18, Programming by contract. My notes for Lecture 18 are largely taken from 20-year-old articles by Bertrand Meyer. The principles are timeless, but there are undoubtedly new embellishments that would provide better background to the topics discussed in the lecture. Write a narrative, generally following the lecture organization, that explains programming by contract in more detail.

Introduction

Software Reliability

A major concern in software design is Reliability, which depends on two factors: 1) Correctness - system's ability to perform its job according to the specification and 2) Robustness - handling abnormal conditions. Reliability is especially important in Object oriented software because of the additional complexity imposed by Reusability. Some of the common problems encountered when writing software include: 1) System failure -

Programming by contract

Contract and Inheritance

Terminology

Preconditions

Postconditions

Invariants

Assertions

Comparison with Defensive Programming

Languages with Native Support

Runtime Checking

Static Checking