Sei sulla pagina 1di 14

Chapter 8

BEHAVIORAL MODELING

Reporters:
Adtoon, Marah I.
Lanquino, Even Adrian
Solante, Jonathan

OBJECTIVES
 Understand the rules to and style guidelines for sequence and communication diagrams and behavioral state machines.
 Understand the processes used to create sequence and communication diagrams and behavioral state machines.
 Be able to create sequence and communication diagrams and behavioral machines.
 Understand the relationship between the behavioral models and the structural and functional models.

Behavioral Models
-describe the internal dynamic aspects of an information system that supports the business processes in an organization.
One of the primary purposes of behavioral models is to show how to underlying objects in the problem domain will collaborate to support
each of the use cases.
Creating behavioral models is an iterative process that not only iterates over the individual behavioral models.
Two types of Behavioral Models
 Behavioral models that are used to represent the underlying details of a business process portrayed by a use of case model.
 Behavioral models that is used to represent the changes that occur the underlying data.
Interaction Diagrams
-focus on the object level.
Object
-an instantiation of a class, that is an actual person, place, event, or thing about which we want to capture information.
Attributes
-describe information about the object such as a patient’s name, birth date, address, and phone number.
Operations
-is nothing more than an action that an object can perform.
Messages
-are information sent to objects to tell an object to execute one of its behavioral.
- is a function of procedure call from one object to another object.
Sequence Diagrams
-is a dynamic model that illustrates the classes that participate in a use case and messages that pass between them over time.
-can be a generic sequence diagram that shows all possible scenarios for a use case, but usually each analyst develops a set of instant
sequence diagrams, each of which depicts a single scenario within the use case.

Elements of a Sequence Diagram

Patients: List UnPaidBills:List Appointment List


aPatient aReceptionist
Request Appt()
LookUpPatient()
NewCancelChangeAppt()
[aPatientExist]LookUpBills()

ApptTimes()
MatchAppts()

CreateAppt() anAppt:Appointment

Figure 8-1 Example Sequence Diagrams


An Actor:
 Is a person or system that derives benefit from and is
external to the system.
 Participates in a sequence by sending and/or receiving
messages.
 Are placed across the top of the diagram. AnActor
 Is depicted as either a stick figure (default) or if a non- <<actor>>
human actor is involved, as a rectangle with<<actor>>in Actor/Role
it (alternative).
An Object:
 Participates in a sequence by sending and/or receiving
messages. An Object:aClass
 Are placed across the top of the diagram.
A Lifeline:
 Denotes the life of an object during a sequence.
 Contains an “X”at the point at which the class no longer
interacts.
An Execution Occurrence:
 Is a long narrow rectangle placed atop a lifeline.
 Denotes when an object is sending or receiving messages.

A Message: aMessage()
 Convey information from one object to another one.
 An operation call is labeled with the message being sent
and a solid arrow, while a return is labeled with the value Return Value
being returned and shown as a dashed arrow.
Object Destruction:
 An X is placed at the end of an object’s lifeline to X
show that is going out of existence.
A Frame: Context
 Indicates the context of the sequence diagram.
Figure 8-2 Sequence Diagram Syntax
Building a Sequence Diagram

Six-step process used to create a Sequence Diagram

1. Set the Context


2. Identify which objects will participate.
3. Set the lifeline for each object.
4. Layout the messages from the top to the bottom of the diagram based on the order in which they
are sent.
5. Add the execution occurrence to each objects lifeline.
6. Validate the sequence diagram.
Figure 8-3 Steps for Building Sequence Diagrams

Applying the Concepts at CD Selections

Normal Flow of Events:


1. Customer submits search request to the system.
2. The System provides the Customer a list of recommended CDs.
3. The customer chooses one of the CDs to find out additional information.
4. The System provides the Customer with basic information and reviews on the CD.
5. The Customer calls the Maintain Order use case.
6. The Customer iterates over 3 through 5 until done shopping.
7. The Customer executes the Checkout use case.
8. The Customer leaves the Web site.
Figure 8-4 Normal Flow of Events of the Places Order Use Case
Communication Diagrams
-is essentially an object diagram that shows message passing relationships instead of aggregation or generalization associations.
-are equivalent to sequence diagrams, but they emphasize the flow of messages through a set of objects, while the sequence diagrams focus
on the time ordering of the messages being passed.

CDs: CDList aCD:CD Ml:Mkt:Info aR:Review A:Artist:Info SC:SampleClip aSC:ShoppingCart


nfo
aCustomer
CreateSR()

FindCDs()

CreateCDL() aCDL:CDList

anOrder:Order
OOOrder
Figure 8-5 Sequence Diagram for the Places Order Use Case
Patient: List

1:RequestAppt ()
4: NewCancelChangeAppt?() UnPaidBills: List
5:ApptTimes?()

Appointment: List

aPatient aReceptionist
anAppt: Appointment

Figure 8-6 Example Communication Diagram


Association
-is shown between actors and objects with an undirected line.
An Actor:
 Is a person or system that derives benefit from and is
external to the system. AnActor
 Participates in collaboration by sending and/or <<actor>>
receiving messages.
An Object:
 Participates in collaboration by sending and/or anObject: aClass
receiving messages.
 Are placed across the top of the diagram.
An Association:
 Shows an association between actors and/or objects.
 Messages are sent over association.
A Message:
 Conveys information from one object to another one. 1:a Message ()
 Direction is shown using an arrowhead.
 Sequence is shown by a sequence number.
A Frame: Context
 Indicates the context of the communication diagram.
Figure 8-7 Communication Diagram Syntax
1. Set the Context.
2. Identify which objects (actors) and the associations between the objects participate in the collaboration.
3. Layout the communication diagram.
4. Add messages.
5. Validate the communication diagram.

Figure 8-8 Steps for Building Communication Diagrams


CD Mkt Artist Sample Clip Shopping
Customer SearchReq list CD Info Review Info Cart Order
Customer R U C
SearchReq CR
CDList
CD R
Mkt Info U U U
Sample Clip

Shopping Cart

Order

Figure 8-9 CRUD Matrixes for the Place Order Use Case
CDs:CD List
aSR:Search Request
aCDL:CDList
aR:Review

aCD:CD
aCD:CD
AL: Artist:Info
ML: Market Info
aCustomer

aSC:ShoppingCar
t SC:Sample:Clip

anOrder: Order

Figure 8-10 Communication Diagram for the Place Order Use Case

Behavioral State Machines


-is a dynamic model that shows the different states that a single class passes through during its life in response to events, along with
responses and actions.
State
-is defined by the value of its attributes and relationships with other objects at a particular point in time.
Event
-is something that takes place at a certain point in time and changes a value that describes an object, which in turn changes the objects state.

Transition
-is a relationship that represents the movement of an object from one state to another state.
Guard Condition
-is a Boolean expression that includes attribute values, which allows a transition to occur only if the condition is true.
Action
-is an atomic, no decomposable process than cannot be interrupted.
Activity
-is a non atomic decomposable process that can be interrupted.
Elements of a Behavioral State Machine
State
-is a set values that describes an object at a specific point in time, and represents a point in an objects life in which it satisfies some
condition, performs some action.
State Symbol
-which is a rectangle with rounded corners with a descriptive label that communicates a particular state.
Initial State
-Is shown using a small solid filled-in circle and objects.
Final State
-Is shown as a circle surrounding a small solid filled- in circle.
Enters Hospital Checks in [Diagnosis=Healthy] [>2 weeks]
Entering Admitted Released
RReleased

[Diagnosis =Unhealthy]
[Diagnosis=Healthy]
Under Observation

Figure 8-11 Examples Behavioral State Machine Diagram


A State:
 Is shown as a rectangle with rounded corners. aState
 Has a name that represents the state of an object.
An Initial State:
 Is shown as a small filled-in circle.
 Represents the point at which an object begins to exist.
A Final State:
 Is shown as a circle surrounding a small solid filled circle(bull’s-eye)
 Represents the completion of activity.
An Event:
 Is a noteworthy occurrence that triggers a change in state.
 Can be a designated condition becoming true, the receipt of an explicit signal from one object to anEvent
another, or the passage of a designated period of time
 Is used to label a transition.
A Transition:
 Indicates that an object in the first state will enter the second state.
 Is triggered by the occurrence of the event labeling the transition.
 Is shown as a solid arrow from one state to another, labeled by the event name.
A Frame:
 Indicates the context of the behavioral state machine. Context
Figure 8-12 Behavioral State Machine Diagram Syntax
1. Set the Context.
2. Identify the initial, final, and stable states of the object.
3. Determine the order in which the object will pass through the stable states.
4. Identify the events, actions, and guard conditions associated with the transitions.
5. Validate the behavioral state machine.

Figure 8-13 Steps for Building Behavioral State Machine

The customer creates an order on the Web.


1. The customer submits the order once he or she is finished.
2. The credit authorization needs to be approved for the order to be accepted.
3. If denied, the order is returned to the customer for changes or deletion.
4. If accepted, the order is placed.
5. The order is shipped to the customer.
6. The order is shipped to the customer.
7. The customer receives the order.
8. The order is closed.

Figure 8-14 The life of an Order


In Process Ordered Processing Placed Shipped Received

Denied

Figure8-15 Behavioral State Machine for the Order Class

Potrebbero piacerti anche