Team LiB
Previous Section Next Section

Using Sequence Diagrams to Determine Methods

Now that we've prepared a sequence diagram, how do we put the information that it contains to good use? In particular, how do we "harvest" information from such diagrams concerning the methods that the various classes need to implement?

The process is actually quite simple. We step through the diagram, one lifeline at a time, and study all arrows pointing into that line.

In looking at our sequence diagram for Scenario #1 from a few pages back, we note the arrows in Table 11-2.

Table 11-2: Determining the Methods Implied by Scenario #1

Arrow Labeled

Drawn Pointing into Class X

A New Request or a Response to a Previous Request?

Method to be Added to Class X

log on

Student

Request

(A method to reconstitute this object from persistent storage, such as a file or database; perhaps a special form of constructor—we'll discuss this in Part 3 of the book.)

request display of schedule

Schedule OfClasses

Request

void Display()

schedule displayed

Student

Response

N/A

request seat

Section

Request

bool Enroll(Student s)

verify plan of study

PlanOfStudy

Request

bool VerifyPlan(Course c)

plan of study verified

Section

Response

N/A

check prerequisite

Transcript

Request

bool VerifyCompletion (Course c)

prerequisite confirmed

Section

Response

N/A

confirm seat availability

Section

Request

bool ConfirmSeatAvailability() (perhaps a private housekeeping method)

add to course load

Student

Request

void AddSection(Section s)

display message confirming seat

(actor/user)

Response

N/A (will eventually involve calling upon some method of a user interface object—we'll worry about this in Part Three of the book)

Thus we have identified six new "standard" methods plus one constructor that will need to be added to our class diagram; we'll do so shortly.

Repeating this process of sequence diagram production and analysis for various other use case/scenario combinations will flush out most of the methods that we'll need to implement for the SRS. Despite our best efforts, however, a few methods may not surface until we've begun to program our classes; this is to be expected.


Team LiB
Previous Section Next Section