Specify before you represent

A team is building an abstract data type that other programmers will use. They want client code to depend only on the type's behaviour, so that the internal representation can later be replaced without breaking any client. Each stage below uses the result of the stage before it. Arrange the stages in the order the team should carry them out.

  1. 1.

    Run specification-based tests against the finished implementation.

  2. 2.

    Implement each operation on that representation.

  3. 3.

    Choose a concrete representation and state the invariant it must maintain.

  4. 4.

    Agree on each operation's name, parameters and return type.

  5. 5.

    Write each operation's precondition and postcondition in terms of the abstract values.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Abstract Data Types (ADTs) Questions: