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)
-
Fill in example state values that are mapped by the abstraction function.
(What is a "state"?)
-
Identify representation states that should not be mapped.
-
Try to capture these states with a rule (that is, a rep-invariant).
-
Devise a representation that is suitable for a mutable version of Poly.
-
Develop a rep-invariant for that representation.
-
What is the relationship between the rep-invariant and the abstraction function?