7. Records
The record types in Ada is a composite construct and powerful to build structures which are most important concept for reusable components. The components of a record type consists of different types including a case construct, unlike an array type, this is an added advantage to build high level abstraction. See the following example of a record type with a variant part. It specifies alternative lists of components. Each variant defines the components for the corresponding value or values of the discriminant. This is an important facility to provide different choices of implementations for the reuser.
type Sort_algorithms is ( Quick, Recursive, Bsort, Bubble, Heap );
type Choices ( Actions : Sort_algorithms ) is
record
Size : Positive;
case Actions is
When Quick =>
-------
When Recursive => --------
When others => ----------
end case;
end record;
Guideline1 : Where neccessary for making choices, define record type with variant part using case construct to provide the reuser with different choices of implementations or any other alternatives.