29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

OMT is a prescriptive method, it provides guid<strong>an</strong>ce on how the various models it generates should<br />

be constructed. In the remainder of this section we will consider the guidelines given.<br />

19.3.1 Use case <strong>an</strong>alysis<br />

The intention of the use case <strong>an</strong>alysis is to identify how the system is to be used <strong><strong>an</strong>d</strong> what the system is<br />

expected to do in response to this use. This involves identifying the external users of the system (hum<strong>an</strong><br />

or machine) <strong><strong>an</strong>d</strong> the required system functionality. The users of the system <strong><strong>an</strong>d</strong> the roles they play are<br />

referred to as actors while the functions requested <strong><strong>an</strong>d</strong> their sequence are called use cases . The<br />

combination of the actors <strong>an</strong> d the use cases are referred to as the use case model. Each of these will be<br />

considered in more detail below.<br />

19.3.1.1 Actors<br />

An actor c<strong>an</strong> be <strong>an</strong>ything which interacts with the system. This me<strong>an</strong>s they c<strong>an</strong> be hum<strong>an</strong> users, other<br />

computer systems, dumb terminals, senso rs, devices to be controlled etc. However, they not only<br />

represent the user, but also the role that the user plays at that point in time. For example, in a small<br />

comp<strong>an</strong>y the account<strong>an</strong>t might act as the data entry clerk at one time, the internal auditor at <strong>an</strong>other <strong><strong>an</strong>d</strong><br />

as the payroll administrator at yet <strong>an</strong>other time. Each of these roles would be represented by a different<br />

actor, even though they would all be performed by the same person. To stress the difference between<br />

actors <strong><strong>an</strong>d</strong> users [Jacobson et al 1992] says that they think of <strong>an</strong> actor as “a class, that is, a description of<br />

a behavior” while a user is described as playing “several roles” which are “m<strong>an</strong>y actors”.<br />

Identification of the actors in the system is not trivial <strong><strong>an</strong>d</strong> as [Jacobson et al 1992] point out “all<br />

actors are seldom found at once”. Jacobson goes on to state that a “good starting point is often to check<br />

why the system is to be designed?”. Having done this it should be possible to identify the main users of<br />

the system <strong><strong>an</strong>d</strong> what they will need t o do with that system. From these users <strong><strong>an</strong>d</strong> their needs, actors c<strong>an</strong><br />

be identified. Identification of such actors is usually relatively straight forward, but it is often much<br />

more difficult to identify non-hum<strong>an</strong> actors. In general, as the rest of the use case model develops, these<br />

actors “come out in the wash”.<br />

The notation used (in this book at least) for actors is based on that presented by the UML in the last<br />

chapter.<br />

For a simple b<strong>an</strong>k account system the actors may be the customer, the b<strong>an</strong>k clerk <strong><strong>an</strong>d</strong> the b<strong>an</strong>k<br />

m<strong>an</strong>ager.<br />

19.3.1.2 Use cases<br />

When <strong>an</strong> actor interacts with the system it is for a specified purpose. The achievement of this purpose<br />

involves following one or more steps. If there are multiple steps there may be a specific sequence to<br />

these steps in order to ac hieve the desired purpose. For example, if you are attempting to obtain money<br />

from a “hole in the wall machine” (cash dispenser/ATM) then you must first input your card, type in<br />

your PIN, select the type of tr<strong>an</strong>saction your require, specify the amount of c ase required, take the card<br />

<strong><strong>an</strong>d</strong> then take the money. If you attempt to ch<strong>an</strong>ge this sequence you will fail to obtain your money (e.g.<br />

you type in your PIN before inputting your card!). The combination of the purpose, <strong><strong>an</strong>d</strong> the specified<br />

sequence of steps, forms a use case.<br />

A use case c<strong>an</strong> be represented in a number of ways, the two most common are as natural l<strong>an</strong>guage<br />

<strong><strong>an</strong>d</strong> as state tr<strong>an</strong>sition diagrams. Whichever approach is adopted, the same information should be<br />

captured. The most appropriate form may depend on the availability of support tools for the state<br />

machine notation.<br />

The collection of all uses cases for a system defines the functionality of that system. The<br />

identification of uses cases is based on the identification of actors. Each actor will need to d o one or<br />

more things to the system, each of these uses will be a use case. That is, each actor must have at least<br />

one use case (<strong><strong>an</strong>d</strong> may be involved in m<strong>an</strong>y use cases). Whether each use case is unique (or merely a<br />

duplication of <strong>an</strong>other use case) may only b e determined once all the uses cases are identified <strong><strong>an</strong>d</strong><br />

defined. To help in identifying the uses cases, the following questions c<strong>an</strong> be asked [Jacobson et al<br />

1992]:<br />

• What are the main tasks of each actor?<br />

155

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!