Search code examples
adtadaadsroutines

An efficient and sensible Package Specification(ADS) structure in Ada


An abstract data type(ADT) is defined in a package. There must be some operations defined, be able to handle objects of ADT. I think that there is no rule telling us in which order routines of a ADT must be sorted. For example, should be first all inspectors (get routines) and then all modifiers (set routines) listed? Or should these routines by inspected or modified attribute sorted? Is there a rule to sort ADT routines in its package specification (ADS) file?

I want to make a sensible order starting out types of routines.


Solution

  • It’s a bit difficult talking about ADTs in the abstract, but I’d probably structure by use case, at a higher level than inspect and modify.

    As @trashgod suggests, the LRM is a good starter; for example, Ada.Text_IO. You may also find the Quality and Style Guide useful.