SWE 619 In Class Exercise Number 2B


Consider Liskov's Poly example. She implements Poly with two variables:

   private int deg;
   private int[] trms;


Abstract Poly State (c0 + c1x + c2x^2 + ...):
 AF
/|\
 |         
 |
 |
 |----------------------------------------------------------
 |
 |
 |
 |        
Representation State: (deg, trms)

             




  1. Fill in example state values that are mapped by the abstraction function. (What is a "state"?)
  2. Identify representation states that should not be mapped.
  3. Try to capture these states with a rule (that is, a rep-invariant).
  4. Devise a representation that is suitable for a mutable version of Poly.
  5. Develop a rep-invariant for that representation.
  6. What is the relationship between the rep-invariant and the abstraction function?