[an error occurred while processing this directive]

cs205 Friday 22 September 2006

Upcoming Schedule

Midterm Exam

The midterm exam will be handed out next Friday, 29 September, and due Monday, 2 October. It will cover material through class 15 (Monday, 25 September) including problem sets 1-3, chapters 1-5, 7, 9, and 10, and lectures 1-15. The exam is take home and open book, but you will not be permitted to use other humans or a Java compiler for the exam (unless you write your own).

You should not be surprised if the exam contains questions about specifying procedures, data abstraction, specifying data abstractions, implementing data abstractions (including choosing good representations, rep invariants and abstraction functions), testing, and subtyping.

Substitution Principle

B is a subtype of A means wherever an object of type A isexpected, we can use an object of type B instead.

For a function f (A), if f satisfies its specification when passed an object whose actual type is type A, f also satisfies its specification when passed an object whose actual type is B.

Signature Rule

Java's rule is stricter (novariant) — subtype signatures must match supertype signatures (except the subtype may throw fewer exceptions).

Methods Rule

Properties Rule

Subtype must preserve all properties in the supertype's overview specification.

class A {
   public RA m (PA p) ;
}
class B extends A {
   public RB m (PB a);
}
               Substitution Principle 
Parameters     PB >= PA	              
Preconditions  pre_A implies pre_B    

Result         RB <= RA               
Postconditions post_B implies post_A