Chapter 7 - E-learning Amikom

7
Chapter 7
The Object-Oriented
Approach to
Requirements
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
1
7
Objectives
 Develop
use case diagrams
 Develop
use case scenarios
 Develop
sequence diagrams
 Develop
collaboration diagrams
 Develop
statechart diagrams
 Explain
the way object-oriented diagrams
work together to provide functional
requirements
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
2
Requirements Diagrams: Traditional and OO
Figure 7-1
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
3
7
Class Diagram
 Provides
definition of system components
 Contains
important structural information
for the new system
 Provides
details describing database and
object-oriented program
 Consists
of problem domain classes and
implementation classes
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
4
7
Use Cases and Actors
 Use

Case
Single function performed by system for those
who use it
 Actors


Role played by user
Outside automation boundary
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
5
Simple Use Case with an Actor
Figure 7-2
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
6
7
Use Case Scenarios
 Shows
an actor interacting with a computer
system to carry out a business activity
 Scenario
details sequence of activities
within a use case
 May
have several scenarios
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
7
Use Case Diagram
 Graphical
models that summarize
information about actors and use cases
 Looks
at system as whole
 Identifies
major uses from event table
 Identifies
functions that must be supported
by the new system
 Organizes
use cases
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
8
Use Case Diagram with System Boundary
Figure 7-7
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
9
7
<<Includes>> Relationships
 Documents
situation where one use case
requires the services of another use case
 In
programming jargon, called a common
subroutine
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
10
Example of Order-Entry Subsystem with
<<Includes>> Use Cases
Figure 7-10
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
11
7
Use Case vs. Structured Techniques

Use case






Defines system scope like a context diagram
Individual use cases are like DFD fragments
Use case begins with automation boundary
Actor interacts with system
Does not indicate data flows
DFD


Ends with scope
External entity is data source
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
12
7
Development of a Use Case Diagram
1. Starting points


Use event table
Identify all actors
2. Develop a flow of activities as the starting
point for identifying the various scenarios
3. Common internal use cases can be
identified and separated into different use
cases
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
13
7
Object Interactions
 Collaboration


diagram
Emphasizes the objects that interact together to
support a use case diagram
May be used alone or with sequence diagram
 Sequence
diagram

Focuses on message details
Bottom-up approach
More complex

Used more frequently in industry


Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
14
7
Sequence Diagrams
 Shows
sequence of interactions between
objects that occurs during flow of events in
a single use case
 Consists
of four basic symbols
 Represents
a specific set of messages and
interactions between objects
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
15
Symbols of a Sequence Diagram
Figure 7-12
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
16
7
Actors and Objects
 Both

are “things”
External
 Actors
 Role
of Customer
 Physical person

Internal
 Objects
 Computer
 Both
artifacts
send and receive messages
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
17
7
Lifelines
 Vertical
line under object or actor: shows
passage of time
 If
dashed: creation and destruction of thing
is not important for scenario
 Long
narrow rectangles: activation lifelines
used to emphasize that an object is active
only during part of a scenario for a sequence
diagram
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
18
7
Messages
 Internal
events identified by the flow of
objects within a scenario
 Requests
from one actor or object to
another to do some action
 Invokes
a particular method
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
19
Partial Class Diagram for RMO
Figure 7-15
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
20
Sequence Diagram for
Look Up Item Availability
Figure 7-16
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
21
7
Sequence Diagram Development
1. Identify all objects and actors involved in
scenario
2. Identify each message required to carry
out scenario
3. Determine whether each message is
always sent or if only sent under certain
conditions
4. Sequence messages correctly and attach
to appropriate lifelines
5. Add formal syntax on messages
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
22
7
Collaboration Diagram
 Provides
a quick overview of all objects that
collaborate to support a given scenario
 Uses
same symbols as a sequence diagram
 Shows
relationships between two objects
(links)
 Cannot
easily describe concurrent
messages or creation/deletion of objects
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
23
7
Symbols of a Collaboration Diagram
Figure 7-20
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
24
RMO Collaboration Diagram for
Look up Item Availability
Figure 7-21
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
25
7
Object Behavior
 Final
piece of information needed for
describing functional requirements
 Description
of action the objects perform
 Defines
object responses to messages -object behavior
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
26
Relationships Among OO Models
Figure 7-23
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
27
7
Object States

Condition during an object’s life



Satisfies a criteria
Performs an action
Waits for an event

Semi-permanent conditions

External events cause object to move to a
new condition
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
28
7
Object State Naming Conventions
 May
‘off’
be a simple condition such as ‘on’ or
 May
be active names consisting of gerunds
or verb phrases
 An
action is an activity performed by an
object in a particular state
 Composite
states have other states nested
internally
A
concurrent object can be in more than one
state at a time
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
29
7
Object Transitions
 Mechanism
that causes an object to leave
one state and change to a new state
 Guard-condition
 Action-expression


Procedural statement describing action
performed
Executes when the transition fires
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
30
7
Statechart Diagram Development
1. Look at all sequence diagrams and list all
relevant input and output messages
2. Develop states and transitions
3. Identify completion transitions and
decision pseudostates
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
31
Statechart Diagram for an Order
Figure 7-31
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
32
7
Concurrent Behavior
 Object
can do multiple things in parallel
 Statechart
diagram represents concurrent
behavior with multiple paths called threads
 Vertical
bars indicate where concurrent
behavior begins or ends
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
33
RMO Customer Statechart
Diagram with Concurrent Threads
Figure 7-34
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
7
34
7
Statechart Development
1. Review class diagram and select
classes needing statecharts
2. Identify input messages across all
sequence diagrams for selected class
3. For each selected class in group, make a
list of all states
4. Build statechart fragments and sequence
fragments in correct order
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
35
7
Statechart Development
5. Review paths and look for independent
concurrent paths
6. Expand each transition with the
appropriate message event, guard
condition, and action expression
7. Review and test each statechart
Systems Analysis and Design in a Changing World, 2nd Edition, Satzinger, Jackson, & Burd
36