Question

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.

Was it helpful?

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.

OTHER TIPS

What about this structure, as an example (LIFO):

AbstractDataType Queue {
   1.Constructors:
      a.CreateQueue
   2.Destructors:
      a.DeleteQueue
   3.Inspectors: 
      a.EqualQueues
      b.EmptyQueue
      c.QueueSize
      d.QueueFront
      e.QueueRear
      f.PrintStack
   4.Modifiers:
      a.Enqueue
      b.Dequeue
      c.AssignQueues
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top