Goals
- to practice writing precise specifications
- to use various specifications techniques on a single problem
- to write an algebraic specification for an abstract data type
Overview
For this assignment, you'll practice writing more precise specifications.
You'll consider the process of pre-registering for classes at Millersville
and apply various specifications techniques to describe that process.
You'll also write algebraic specifications for a queue.
You'll turn in paper for this assignment. The pictures and answers may be handwritten as long as they are legible. But it may be easier to correct and proofread if you type some parts.
Collaboration
This assignment is to be completed on your own or with ONE other person.
If you come talk to me, I may allow three people to work together,
but you need a good reason.
It is NOT a group assignment.
One of the goals here is to practice doing this. Absolutely do not divide up the parts. You should treat this as a pair programming assignment. Nothing should be done on this assignment without both people present and paying attention. These techniques will be on the test and practicing will help.
Details of the Pre-registration Portion
Consider the task of pre-registering for classes at Millersville.
This is something you have done many times.
To pre-register, you need to refer to and obtain various pieces of information.
Some actions must occur in a specific order.
There are timing dependencies.
Your task is to use many of the specification techniques we've studied to explain how to pre-register. Your intended audience is a new student who understands the specification techniques but not pre-registration. You are writing specifications of what not how. You should deliver:
Algebraic Specifications for Queue
(30 pts) Using the stack and set examples as references, give an algebraic specification for a queue of items of some type. Give both the syntax and the axioms. All items in a queue are the same type (sort). The stack was last-in-first-out, but a queue is first-in-first-out. The operations should be NEW, BACK (which places an item on the back of the queue), FRONT (which inquires about the front item but doesn't remove it), REMOVE (which returns a queue minus the front item), and EMPTY. Note that you might need to use an if-then-else approach to define some of the axioms for queue.
For example, if in the stack you wanted to define a REPLACE operation,
you might have
REPLACE(stk, itm) = if EMPTY(stk) then error else PUSH(POP(stk), itm)
Think of different ways of having the same result.
Consider the empty and error cases.
Draw pictures for yourself.