5.3. Conversation Stereotypes and Scripts

Conversations can be described in several ways but it is most useful to describe a task using a conversation script. A script represents a stereotypical chunk of behaviour. It is an abstract textual description of such a conversation. As we will see, this provides a notion of generalized exception handling that does not seem to be available to users of the use case approach, where an exception (extends) path is often specific to the use case.

One word of warning is appropriate. This use of the term stereotype has absolutely nothing to do with the same word as used in UML; unfortunately there is no other sensible term for the idea that I want to capture here.

As an example, consider a script that describes the process of going to a restaurant. The idea is that one always does the same thing when visiting a restaurant. One always:

  1. Enters the restaurant.

  2. Attracts the attention of a waiter.

  3. Takes one's seat.

  4. Reads the menu.

  5. Chooses a meal.

  6. Eats it.

  7. Pays.

  8. Leaves.

This is certainly a good stereotype of the situations normally met with.

Note how the script defines the notion of a restaurant. Suppose I were to tell you that, yesterday, I did the following.

  1. Entered a building.

  2. Attracted someone's attention.

  3. Followed that person to a table.

  4. Read the items on a list given to me.

  5. Choose items from the list.

  6. Consumed those items.

  7. Paid money;

  8. Left the building.

Firstly, I think you would be able to tell me what I was doing very easily indeed.

Secondly, notice that ...

Get Requirements Modelling and Specification for Service Oriented Architecture now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.