CS 477 Lecture Notes

Week Seven, Tuesday: Specification Phase, Continued

Semi-Formal Specification: Robo-Butler Example

Here we continue the Robo-Butler example using semi-formal specification methods.

Structured Systems Analysis

We first create a high-level data flow diagram (DFD):


Figure 1: First refinement of the data flow diagram.

Next we produce a second refinement of the DFD:


Figure 2: Second refinement of the data flow diagram.

The structured systems analysis will require several more iterations of DFD refinement. As you can see, the DFD will become quite large, so it is not shown here.

The next steps are to define the logic of the processes, define the data stores, define the physical resources, determine the I/O specifications, perform sizing of the system, and determine hardware requirements.

Entity-Relationship Modeling

Entity-relationship modeling was developed for database applications, but is also useful as the starting point for object oriented analysis, which is probably the best technique available to apply to the Robo-Butler problem.

We start by identifying the entities in the Robo-Butler scenarios:


Figure 3: Entities in the Robo-Butler scenarios.

Then we identify the relationships among the entities:


Figure 4: Entity-relationship diagram.

Next, we identify the attributes of the entities. A person, for example has a name, a location (X and Y coordinates), a direction he is facing (angle), an attitude (standing, walking, sitting, or lying down), and a reference image.

The entity-relationship model will be further developed into an object model by adding inheritance and methods (object oriented analysis), which is the subject of chapter 9.

Extended Finite State Machine

The Robo-Butler software will now be specified using an extended finite state machine. Note that all of the states defined below can be divided into substates.

Let Scanning(glass, ashtray) be the state where Robo-Butler is otherwise unoccupied, but is alert for abandoned drink containers and ashtrays in need of emptying.

Let g be a subset of the set of invited guests G and let p be a set of people outside the door of the house, a subset of the set of all people P. Note that G is also a subset of P.

Let AtDoor(p) denote the state in which a group of people has arrived at the door. Let AtDoor(g) denote the state in which Robo-Butler has determined that the group is made up entirely of invited guests, and let AtDoor(p, g) denote the state in which one or more of the people at the door is not recognized as an invited guest.

Let Door(open) denote the state in which the front door is open, and let InHouse(g) denote the state in which the front door is closed with the newly-arrived guests inside.

Let Store(possessions) denote the state in which Robo-Butler is storing the guests' possessions, and let Escort(g) denote the state in which Robo-Butler is escorting the guests to the owner.

Let Fetch(drink) denote the state in which Robo-Butler is fetching drinks for the guests, let Bus(glasses) denote the state in which Robo-Butler is carrying glasses to the kitchen, and let Empty(ashtray) denote the state in which Robo-Butler is emptying an ashtray.

Let Summon(owner) denote the state in which the Robo-Butler is summoning the owner. Then the high level state-transition diagram for the Robo-Butler software is:


Figure 5: STD for the Robo-Butler.

The finite state machine can also be used to solve the cannibals and missionaries problem, stated:

Three missionaries are traveling with three cannibals. They come to a river where there is a boat that holds only two people. If the number of cannibals is ever greater than the number of missionaries on either shore, the missionaries get eaten. How do they cross the river without the missionaries getting eaten?

To solve this problem, draw the start and goal states:






The three Xs in the elipses symbolize the cannibals, the three Os symbolize the missionaries, the vertical line symbolizes the river, and the boat symbol symbolizes the boat. The positions of the symbols (left or right of the river) denote the states.

Then starting with the start state, draw allowed states and connect them with arrows to denote the crossings of the river in the boat as transitions. Continue until the goal state is reached.

Petri Net

A Petri net is not fully suitable for specifying the Robo-Butler software because we need an initial higher level representation, but a portion of the Robo-Butler problem can be specified for illustrative purposes. Two of the functions of the Robo-Butler, ashtray emptying and drink fetching, have been used for the Petri net below in Figure 6:


Figure 6: Petri net for a portion of the Robo-Butler software specification.


This page established February 20, 1998; last updated January 17, 2000.