basic behavioral modeling chapter 3 of omd

33
Basic Behavioral Modeling

Upload: jayashri-kolekar

Post on 22-Mar-2017

74 views

Category:

Education


2 download

TRANSCRIPT

Page 1: Basic behavioral modeling chapter 3 of OMD

Basic Behavioral Modeling

Page 2: Basic behavioral modeling chapter 3 of OMD

2jaya kolekar

A use case diagram help system analyst to discover the requirements of the target system from the users perspective.

Provides functional description of a system & its major processes.

Provides graphic description of the users of a system & what kinds of interactions to exact within that system.

Displays the details of the processes that occur within the application area.

Used to design the test cases for testing the functionality of the system.

Use Case Diagram

2/15/2017

Page 3: Basic behavioral modeling chapter 3 of OMD

3jaya kolekar

Two types of elementsBusiness rolesBusiness processesActorsUse CaseSystem BoundaryAssociationRelationships in use cases

Elements of a Use Case Diagram

2/15/2017

Page 4: Basic behavioral modeling chapter 3 of OMD

4jaya kolekar

ActorsAn actor portrays any entity (or entities) that performs

certain roles in a given system. Actor can be users, organization and external system.Actors are responsible for giving input to the system. It is shown as a stick figure in a use case diagram

depicted “outside” the system boundary.Place an actor that initiates a use case on the left of the

use case & an actor receives the results of a use case appears on the right of the use case.

Elements of a Use Case Diagram

Actor Name

<<actor>>

Iconic Notation for actor member

<<actor>>member

Iconic Notation for actor

2/15/2017

Page 5: Basic behavioral modeling chapter 3 of OMD

5jaya kolekar

Types of actorsPrimary actors

The main users or entities for which the system is designed, deriving benefits from it directly.

They are completely outside the system & drive the system requirements.

Use the system to achieve an observable user goal.Secondary actors

Users or entities that supervise, operate or manage the system.

They play a supporting role to facilitate the primary actors to achieve their goals.

Often appears to be more inside the system than outside.They are usually allocated many system requirements that

are not drive directly from the statements of requirements.

Elements of a Use Case Diagram

2/15/2017

Page 6: Basic behavioral modeling chapter 3 of OMD

6jaya kolekar

Types of actorsPrimary actors

The main users or entities for which the system is designed, deriving benefits from it directly.

They are completely outside the system & drive the system requirements.

Use the system to achieve an observable user goal.Secondary actors

Users or entities that supervise, operate or manage the system.

They play a supporting role to facilitate the primary actors to achieve their goals.

Often appears to be more inside the system than outside.They are usually allocated many system requirements that

are not drive directly from the statements of requirements.

Elements of a Use Case Diagram

2/15/2017

Page 7: Basic behavioral modeling chapter 3 of OMD

7jaya kolekar

Use CaseUse case in a use case diagram is a visual

representation of a distinct business functionality in a system.

It is a sequence of transactions performed by the system that produces a major suit for the actor.

A use case is shown as an ellipse in a use case diagram.

It must have unique and textual (simple/qualified) name.

Elements of a Use Case Diagram

Use Case Request Book

LMS:Request Book

2/15/2017

Page 8: Basic behavioral modeling chapter 3 of OMD

8jaya kolekar

System BoundaryIt defines the scope of what a system will be.A system cannot have infinite functionality.Defines the limits of the system.It is shown as a rectangle spanning all the use

cases in the system.

Elements of a Use Case Diagram

Use case

Use case

Use case

Actor

Request book

Issue book

Return book

student

System boundary LM

S

2/15/2017

Page 9: Basic behavioral modeling chapter 3 of OMD

9jaya kolekar

Communication Lines / RelationshipsUse case diagram has communication lines or

links to show communication between its various components.

AssociationDependency

IncludeExtend

Use case generalization

Elements of a Use Case Diagram

2/15/2017

Page 10: Basic behavioral modeling chapter 3 of OMD

10jaya kolekar

AssociationIt is used to describe the relationships between

actors & the use cases they participate in.Association can be unidirectional &

bidirectional.It indicates either that the actor initiates the

use case, or receives the results of executing a use case.

The association is drawn as a solid line.

Elements of a Use Case Diagram

Use caseUse caseUse case

Actor

Association Request book

Issue book

Return book

student

LMS

2/15/2017

Page 11: Basic behavioral modeling chapter 3 of OMD

11jaya kolekar

DependencyA relationship between two use cases is

basically a dependency between two use cases.Include

Include is used when two or more use cases share some common portion in the flow of events.

It shows interaction between base use case & inclusion use case .Inclusion use case is consist of feature of base use case.

The stereotype <<include>> identifies the relationship include.

Elements of a Use Case Diagram

Issue Journal

Issue Book

Verify Library Card

<<include>>

<<include>> 2/15/2017

Page 12: Basic behavioral modeling chapter 3 of OMD

12jaya kolekar

DependencyExtend

In an extend relationship , the child use case adds to the existing functionality & characteristics of the parent use case

The stereotype <<Extend>> identifies the relationship Extend.

Elements of a Use Case Diagram

Excess money

Withdraw money

<<Extend>>

2/15/2017

Page 13: Basic behavioral modeling chapter 3 of OMD

13jaya kolekar

MultiplicityHow many instances of an actor interact with

how many instances of use case.By default we assume one instance of an actor

interacts with one instance of a use case.Multiplicity is indicated by number or with the

range separated by two periods(..) or special character .

Elements of a Use Case Diagram

Withdraw money

1 0..1

Customer2/15/2017

Page 14: Basic behavioral modeling chapter 3 of OMD

14jaya kolekar

Use Case GeneralizationA parent-child relationship between use cases.Child use case is the enhancement of the parent

use caseGeneralization is same as extend relationshipIn generalization parent use case can be replaced

by child but it s not possible with extend

Elements of a Use Case Diagram

Pay bill by post

Pay bill by

internet

Pay Bill

2/15/2017

Page 15: Basic behavioral modeling chapter 3 of OMD

15jaya kolekar

Use case diagram for online shopping of books

Buy Books

Pay Bill

Prepare Bill

Validate Customer

Search Books

Register Customer

Update Books

<<include>>

<<include>>

<<include>>

<<include>>

2/15/2017

Page 16: Basic behavioral modeling chapter 3 of OMD

16jaya kolekar

Sequence diagrams describe interaction among classes in terms of an exchange of messages over time.

Depicts the sequence of actions that occurs in a system.

The order of invocation of methods in each object is captured by sequence diagram.

Shows the dynamic behavior of a system.It is two-dimensional in nature.(horizontal axis

shows the life of the object & vertical axis shows the sequence of the creation or invocation of these objects.

Used to model usage scenarios, the logic of methods and the logic of services.

Sequence Diagram

2/15/2017

Page 17: Basic behavioral modeling chapter 3 of OMD

17jaya kolekar

Class RolesActorLifelinesMessagesActivationCreating objectsDeleting objectsSimple & Block IterationBranching

Elements of Sequence diagram

2/15/2017

Page 18: Basic behavioral modeling chapter 3 of OMD

18jaya kolekar

Class RolesClass roles describe the way an object will

behave in context. Use the UML object symbol to illustrate class

roles, but don’t list object attributes.

ActorAn external entity that interacts with the system.

Elements of Sequence diagram

Object Name : Class Name :Class Name

Actor 2/15/2017

Page 19: Basic behavioral modeling chapter 3 of OMD

19jaya kolekar

LifelinesVertical dashed lines that indicate the objects

presence over time.

Elements of Sequence diagram

Object : Class

Object : Class

Actor

C : Cashier B : Bill

Customer

Prepare bill <<create>>

Lifelines 2/15/2017

Page 20: Basic behavioral modeling chapter 3 of OMD

20jaya kolekar

MessagesMessages that arrows that represent communication between

objects.Each message sent to a class invokes a static method/operation on

that class.Each message sent to an object invokes an operation on that object.

Elements of Sequence diagram

Object : Class

Object : Class

Actor

C : Cashier B : Bill

Customer

Prepare bill <<create>>

message2/15/2017

Page 21: Basic behavioral modeling chapter 3 of OMD

21jaya kolekar

Elements of Sequence diagram

Arrow Message Type Description

Synchronous The sender sends message to receiver & wait for the procedure completion receiver.

Simple Messages with single thread of control. One object sends the message to the passive object.

Asynchronous The sender sends the message and immediately continues with the next step.

Return Return message from called procedure of the receiver to the sender.

Delayed message

The message will take significant time to arrive at the receiving object.

2/15/2017

Page 22: Basic behavioral modeling chapter 3 of OMD

22jaya kolekar

Messages

2/15/2017

Page 23: Basic behavioral modeling chapter 3 of OMD

23jaya kolekar

ActivationActivation boxes represent the time an object needs to complete a

task.The receiver object is active when it receivers the message from

sender.Each message sent to an object invokes an operation on that object.

Elements of Sequence diagram

Object : Class

Object : Class

Actor

C : Cashier B : Bill

Customer

Prepare bill <<create>>

Activation2/15/2017

Page 24: Basic behavioral modeling chapter 3 of OMD

24jaya kolekar

Creating objectsObjects can be created during interaction.An object dynamically create a new object by using

<<create>> message.New objects lifeline starts with the receipt of create message.

Elements of Sequence diagram

C : Cashier B : Bill

Customer

Prepare bill <<create>>

<<create>>

2/15/2017

Page 25: Basic behavioral modeling chapter 3 of OMD

25jaya kolekar

Deleting objectsObjects can be deleted on receiving a <<destroy>> message

from another object.A large Cross (X) is placed at the end of the objects lifeline to

indicate that the objects life has been terminated at that time.

Elements of Sequence diagram

:order

01:OrderLineAdditem(i)

new(i)

:Shopping cart

<<destroy>>

remove(i)

2/15/2017

Page 26: Basic behavioral modeling chapter 3 of OMD

26jaya kolekar

Structured controlA sequence of messages is fine for showing a single,

linear sequence, but often need to show conditionals & loops.

Shows concurrent execution of multiple sequences.A control operator is shown as a rectangular region

within the sequence diagram.Control operator has a tag a text label inside a small

pentagon in the upper left corner to tell what kind of a control operator it is.

Types of control in sequence diagramOptional ExecutionConditional ExecutionParallel ExecutionLoop(Iterative) Execution

Elements of Sequence diagram

2/15/2017

Page 27: Basic behavioral modeling chapter 3 of OMD

27jaya kolekar

Simple & block iterationSometimes a task is to be performed repeatedly, then in

sequence diagram such task is represented by a name preceded by an asterisk “ * “.

A repetition or loop within a sequence diagram is depicted as a rectangle.

Elements of Sequence diagram

C : Cashier B : Bill

Customer

Prepare bill <<create>>

B : Bill

Buy product

[all product added]

Get product details

Add product

Update quantity

Calculate total amount

Display total

loop

2/15/2017

Page 28: Basic behavioral modeling chapter 3 of OMD

28jaya kolekar

Structure controlConditional execution

Elements of Sequence diagram

2/15/2017

Page 29: Basic behavioral modeling chapter 3 of OMD

29jaya kolekar

break

2/15/2017

Page 30: Basic behavioral modeling chapter 3 of OMD

30jaya kolekar

Loop/parallel

2/15/2017

Page 31: Basic behavioral modeling chapter 3 of OMD

31jaya kolekar

optional

2/15/2017

Page 32: Basic behavioral modeling chapter 3 of OMD

32jaya kolekar

Structure control

2/15/2017

Page 33: Basic behavioral modeling chapter 3 of OMD

33jaya kolekar

Difference between sequence & collaboration

Sequence Diagram Collaboration Diagram

A sequence diagram is an interaction diagram which emphasizes on the time ordering of messages.

A collaboration Diagram is an interaction diagram which emphasizes the structural organization of the objects that send and receive messages.

Sequence diagrams are alternate representations of an interaction(Collaboration)

Collaboration diagrams are alternate representation of an interaction(sequence)

Sequence diagram describe the interaction among classes in terms of an exchange of message over time.

Collaboration diagram describe the interaction with numbered arrows which shows the movement of messages during the course of a scenario.

Sequence diagram shows the sequence of actions that occurs in system

Collaboration diagram shows the objects and their association with the other objects the system.

The elements of sequence diagram are class roles, activation, Message, lifeline, creating objects, destroying objects and loops.

The elements of Collaboration diagram are objects, Relation / Association, Message.

We can show simple branching in sequence diagram We can show more complex branching in collaboration diagram.

This type of diagram is best used during early analysis phases in design because they are simple and easy to comprehend

This type of diagram is best used for specific scenario.

Sequence diagrams are normally associated with use cases

Collaboration diagram are normally with sequence diagram

Any diagrammatic example explanation of sequence Any diagrammatic example of collaboration diagram

2/15/2017