Anda di halaman 1dari 26

PART II

Rajeev Kumar
Rajeev Kumar, CSE, IIT - Kgp 1
Unified
Modeling
Language

Rajeev Kumar
CSE, IIT-Kgp
Use Case
A Use Case describes a set of sequences. Each
sequences indicates interaction of things
external to the system ( Actors ) with the
System.

A Use Case
• Is an interaction of Actors and Systems
• Executes tangible amount of work

Rajeev Kumar, CSE, IIT - Kgp 3


Use Case
collaboration
use case
Place Order

Order Management
realization

actor

Customer

generalization
Industrial Customer
Rajeev Kumar, CSE, IIT - Kgp 4
Use Case
<< include>> stereotypes:

the base use case incorporates the behaviour of the target use
case. The included use case cannot survive by itself.
target
base
<< include>>
SearchRecord ReadDataBase

base << include>>


UpdateData

Rajeev Kumar, CSE, IIT - Kgp 5


Use Case
<< extend>> stereotypes:

Implicitly incorporates the behaviour of the target use case.

base target
<< extend>>
EOF Processing Record Read

base
<< extend>>
Invalid Record Processing

Rajeev Kumar, CSE, IIT - Kgp 6


Use Case Diagrams

Use Case for a financial trading system

Update
Set Limits Accounts
Accounting
System
Trading Analyze Risk <<include>>
Manager
Price Deal <<include>>
Trader Valuation

Capture Deal
actor
<<extends>>
Salesperson
Limits
Exceeded
use case Rajeev Kumar, CSE, IIT - Kgp 7
Interaction

• model the flow of control within an operation,


class, component, use case or a system as a
whole.
• are used for modeling the dynamic aspects of a
system
• go beyond object diagrams to show messages
and signals exchanged between objects.

Rajeev Kumar, CSE, IIT - Kgp 8


Interaction
Components of Interaction

u : User Flow of Control

1 : login p : LoginProcess

2 : spawn process k : Kernel

Sequence number Message


Object
Rajeev Kumar, CSE, IIT - Kgp 9
Interaction
There are two equivalent types of Interaction Diagrams:

Interaction Diagrams

Sequence Diagram Collaboration Diagram

Rajeev Kumar, CSE, IIT - Kgp 10


Interaction
Sequence Diagrams -

• Shows an interaction arranged in time sequence


• Shows the explicit sequence of messages
• Is better for real-time specifications and for complex
scenarios

Collaboration Diagrams
• Shows the relationships among objects
• Is better for understanding all of the effects on a given
object and for procedural design
• Shows an interaction organized around the objects in the
interaction and their links to each other
• Does not show time as a separate dimension
Rajeev Kumar, CSE, IIT - Kgp 11
Sequence Diagram
objects

t : Terminal p : LoginProcess k : Kernel


request_terminal()

grant_terminal()
timee

login( name, passwd )


tim

validate_user()

fork_user()

Focus of control Life Line


Rajeev Kumar, CSE, IIT - Kgp 12
Collaboration Diagram

t : Terminal Message
2 : grant_terminal()

1 : request_terminal()

3 : login( name, passwd )


Link Object

p : LoginProcess k : Kernel
5 : fork_user()

4 : validate_user()
Sequence
Rajeev Kumar, CSE, IIT - Kgp 13
Statechart Diagrams
A Statechart Diagram :
• Is used to model the dynamic aspect of a
system
• Shows a state machine
• Shows the states an object / interaction goes
through during its life

It consists of:
• States
• Transitions
Rajeev Kumar, CSE, IIT - Kgp 14
Statechart Diagrams

Initial ( pseudo ) state numeric


transition
Wait for input char
event
a..z
alphanumeric char
Wait for input char

delimiter Final ( pseudo ) state

A simple statechart diagram to accept an alphanumeric string


beginning with an alphabet
Rajeev Kumar, CSE, IIT - Kgp 15
Statechart Diagrams
Action performed Name
on entering state

Action performed
ReadCharacter
before exiting state
entry / clearBuffer
Event NMI will exit / returnCharacter
trigger handleNMI NMI / handleNMI
do / waitForCharacter
While in this state do IRQ7 / defer
waitForCharacter

Event IRQ7 deferred State


until suitable state is
Rajeev Kumar, CSE, IIT - Kgp 16
achieved
Statechart Diagrams
Composite state
abort
Reading File substate

Reading Char
valid char
Idle
read opened eof

Opening Close

initial
Statechart diagram for reading CSE, IIT -Transition
a file
Rajeev Kumar, Kgp from substate 17
Statechart Diagrams
Power off
On

Bootup

RAM Test done

concurrent states

Initialize Devices Detect new devices

Concurrent substates...
Rajeev Kumar, CSE, IIT - Kgp 18
Component Diagrams
Components :

• Is a physical entity in a system


• Is replaceable
• Is part of a larger system - not stand-alone
• Is a physical implementation of logical elements
• Provides the realization of an interface

component
component name

Rajeev Kumar, CSE, IIT - Kgp 19


Component Diagrams

Os.dll
classes
component

FileSystem MemManager I/O Subsystem

Components can be used to implement the interface to


classes

Rajeev Kumar, CSE, IIT - Kgp 20


Component Diagrams
Interface

Component 1 Component 2

Dependency Realization

Component 1 uses Component 2 by accessing the interface


exported by Component 2.

Rajeev Kumar, CSE, IIT - Kgp 21


Deployment Diagrams
• Used to model the physical aspects of the system
• Design hardware artifacts
• Shows configuration of runtime processing nodes

Consists of :

•Nodes
•Dependency, Association & Relationship

Rajeev Kumar, CSE, IIT - Kgp 22


Deployment Diagrams
Database
Internet

Gateway
Cache Cache
Server Server
A Network
Deployment diagram

Local Area Network

Primary Primary
Server Client
Server
Rajeev Kumar, CSE, IIT - Kgp 23
Packages

• A Package is a grouping of model elements

• Each element can be directly owned by a single package,


so the package hierarchy is a strict tree.

• Packages can reference other packages, so the usage


net-work is a graph.

Rajeev Kumar, CSE, IIT - Kgp 24


Packages
Package
SimpleWatch

Actor
ReadTime

SetTime
WatchUser
WatchRepairPerson

Use case
ChangeBattery

A Package may consist of other modeling elements such


as use cases. Rajeev Kumar, CSE, IIT - Kgp 25
Packages
GUI
Window
EventHandler
MessageQueue
A Generalization
relation of packages...

WindowsGUI XGUI
GDI
DC XServer
HAL Widget

Rajeev Kumar, CSE, IIT - Kgp 26

Anda mungkin juga menyukai