PART B -----CASE TOOLS- UML- LAB
INTRODUCTION:
USECASE DIAGRAM:
A behavioral diagram that shows a set of use cases and actors and their relation ships.
USECASE:
It is a description of set of sequence of actions that a system performs that yields an
observable result of value to a particular actor.
An use case is used to structure the behavioral things in a model and it is rendered as
an ellipse with solid line along with its name.
Actor:
It specifies a coherent set of roles that users of use cases play when interacting with these use
cases.
CLASS DIAGRAM:
A structural diagram that shows a set of classes, interfaces, collaborations, and their
relationships.
OBJECT DIAGRAM:
A structural diagram that shows a set of objects and their relationships.
SEQUENCE DIAGRAM:
A behavioral diagram that shows an interaction, emphasizing the time ordering of messages.
COLLABORATION DIAGRAM:
A behavioural diagram that shows an interaction, emphasizing the structural organization of
the objects that send and receive meassages.
STATECHART DIAGRAM:
A behavioural diagram that shows a state machine, emphasizing the event-ordered behavior
of an object.
ACTIVITY DIAGRAM :
An activity diagram represents the execution state of a mechanism as a sequence of steps
grouped sequentially as parallel conrol flow branches.It is a variant of state chart diagrams
organized according to actions and internal behavior of a method or a usecase.
Activity diagram s are used to model the dynamic aspects of system.
Swimlanes
Forking
Joining
COMPONENT DIAGRAM:
Component diagrams are basically used to model static view of the system. This can be
achieved by modeling various physical components like libraries, tables, files etc. which are
residing within a node.
Component diagrams are very essential for constructing executable systems. This can be done
using concepts of forward and reverse engineering. The graphical representation of a
component diagrams basically include collection of vertices and arcs.
DEPLOYMENT DIAGRAM:
Deployment is the stage of development that describes the configuration of the running
system in a real time environment.For deployment,decisions should be made about
configuration parameters,performece,resource allocation ,distribution and concurency.The
component develop or reused should be deployed on some set o f hardware for
execution.Nodes are used to model the topology of the hardware on which the system
executes.A node usually represents a processor or a device on which components can be
deployed
Case Study 1: Library Application
1. Problem Statement:
A lightweight set of features for the first version of the library application might look like
this:
It is a support system for a library. The library lends books and magazines to borrowers,
who are registered in the system, as are the books and magazines. The library handles the
purchase of new titles for the library. Popular titles are bought in multiple copies. Old
books and magazines are removed when they are out of date or in poor condition. The
librarian is an employee of the library who interacts with the customers (borrowers) and
whose work is supported by the system. A borrower can reserve a book or magazine that
is not currently available in the library, so that when its returned or purchased by the
library, that borrower is notified. The reservation is cancelled when the borrower checks
out the book or magazine or through an explicit canceling procedure. The librarian can
easily create, update, and delete information about the titles, borrowers, loans, and
reservations in the system.
The system can run on all popular Web browser platforms (Internet Explorer 5.1+,
Netscape 4.0+, and so on).The system is easy to extend with new functionality.
2. Identification of actors and use cases:
The use cases in the library system are as follows:
Login
Search
Browse
Make Reservation
Remove Reservation
Checkout Item
Return Item
Manage Titles
Manage Items
Manage Borrowers
Manage Librarians
Assume Identity of Borrower
The outline of the basic flow for the use case Checkout Item (which means that a Borrower
can check out an Item) is described as follows:
1. The borrower chooses to perform a Search for desired titles/
2. The system prompts the borrower to enter Search criteria.
3. The borrower specifies the search criteria and submits the search.
4. The system locates matching titles and displays them to the borrower.
5. The borrower selects a title to check out.
6. The system displays the details of the title, as well as whether or not there is an
available item to be checked out.
7. The borrower confirms that he or she wishes to checkout the item.
8. The system checks out the item.
9. Steps 1 to 8 can be repeated as often as desired by the borrower.
10. The borrower completes checkout.
11. The system notifies a librarian that the borrower has concluded the checkout item
session and displays instructions for the borrower to collect the contents.
3: Identification of actors and use cases:
Registered
User
Login
Librarian
Browse
Manage Borrowers
Manage Items
Remove reservation
Borrower
Make Reservation
Manage Titles
Assume Identity Of Borrower
Master
Librarian
Search
Checkout Item
Return Item
Manage Librarian
Fig: A use-case diagram for library system
Class diagram for library system:
Fig:
classes for the library system
librarian
+1
+1..*
L_VISITORS
v_name
time
refers()
+1
+0..*
visits
LIBRARY
lib_name
lib_add
+1
+1..*
associated with
timings()
+1
L_STAFF
sta_name
sta_desig
sta_id
lend()
maintain()
log()
+1..*
maintains
is member of
+0..*
L_MEMBER
mem_name
mem_add
no.books
take()
visit()
read()
+1..*
+1..*
uses
+1..*
L_BOOKS
bk_name
bk_id
no.copies
Reservation
makes
Borrower
can Borrow()
0..*
creationDate : Date = currentDate
0..*
references
checks out
Title
0..*
name : String
Loan
creationDate : Date = currentDate
getLendingTime()
1
Item
0..*
id : integer
Book Title
lendingTime : Days = 30
Magzine Title
lendingTime : Days = 10
classes for the library system.
Sequence diagram for use case Return Item:
:Return item
: Borrower
1: specify criteria()
2: search()
5: select title()
:Return item
Controller
:Title
:Borrower
:item
3: search(criteria)
4: get matching(criteria)
6: get item(title)
7: get item()
8: select item()
9: return()
10: return(item)
11: can return (item)
12: [barrower is allowed to return this item]
13: set status()
Fig: collaboration diagram for use case Return Item
11: can return (item)
12: [barrower is allowed to return this item]
:Return item
Controller
:Borrow
er
4: get matching(criteria)
7: get item()
:Title
13: set status()
:item
3: search(criteria)
6: get item(title)
10: return(item)
5: select title()
1:8:specify
selectcriteria()
item()
2:9:search()
return()
:Return
item
: Borrower
10
Sequence diagram for use cases:
Checkout Item:
: Borrower : CheckoutItemForm
:
CheckoutItemCont...
: Title
: Borrower
: Item
1: specify citeria()
2: search()
3: search(criteria)
5: select title()
6: get items(title)
4: get matching(criteria)
7: get items()
8: select item()
9: checkout()
10: checkout(item)
11: can checkout(item)
12: checkout(item)
13: set status()
11
1: Specify criteria()
2: Search()
5: select title()
8: select item()
9: checkout()
: Item
: :Borrower
: checkoutItemForm
3: search(criteria)
6: getitem(title)
10: checkout(item)
: Borrower
4: getmatching(criteria)
7: getitems()
:
checkoutItemController
: Title
Fig: collaboration diagram for Checkout Item
12
Sequence diagram for use case login:
13
: UserLocator
:EmployeeActor
: EmployeeLoginUI
: LoginWorkflow
: User
displayLoginForm()
submitName AndPassword()
validateLogin()
findbyName()
NULL( )
INVALID
displayErrorMessage()
14
9: displayErrorMessages( )
1: displayLoginForm( )
2: submitNameAndPassword( )
: EmployeeLoginUI
:
EmoloyeeActor
3: validateLogin( )
8: INVALID
7: INVALID
: User
6: validateLogin( )
5: USEROBJECT
: LoginWorkFlow
4: findByName( )
: UserLocator
Fig: collaboration diagram for login
15
Activity diagram for library application:
student
librarystaff
submit
Application
librarian
verify details
Issue cards
staff
submit
application
3 cards
Take cards
borrow
Renewal
take cards
check for
reference
non ref
ref
borrow
books
issue books
Return
Reference
search another
book
take the
book
Get the Book
update
database
search and
read books
type of
transaction
return books
search
books
update
members book
16
STATE MACHINE DIAGRAM FOR THE TITLE CLASS:
Available
entry/ Number of reservations = 0
Title reservation / Number of reservations ++
Reservation removed[ Number of reservations = 1 ] / Number of reservations -Title reservation / Number of reservations++
Reserved
Reservation removed[ Number of reservation = 1] / Number of reservation --
17
not reserved
Entry:reservation num=0
title reservation/reserved copies++
reserved
reservation removed/reserved copies--
STATE DIAGRAM FOR LIBRARY SYSTEM
Component diagram :
Component diagram for library application :
Figure1:
Student issue
register.java
librarian.j
ava
item.java
Figure2:
18
itemmjr.ja
va
itemDAO.
mysql.java
itemDAO
.java
itemDAOA
cess.java
Deployment diagram for library applications
Deployment usually refers to transfering the project to the required end
users along with the project documentation.Deployment diagrams are also
essential in each application since it narrates packaged scenario of
interaction following is a deployment diagram referring to unified library
application scenario
Figure 1:
19
student/staff
library
database
library
management
Figure 2:
<<processor>>
library system
<<processor>>
login server
<<processor>>
{book server}
<<processor>>
<<check out
Case Study 2: STUDENT INFORMATION SYSTEM:
Problem statement:-
20
To find the information regarding
students studying in a particular institute which include
attendence and marks
Usecase diagram
lecturer a
amend student
find student
add student
check grades
delete student
21
MAINTAIN STAFF INFO
<<include>>
maintain staff info
maintain attendence
<<uses>>
<<include>>
<<include>>
performence
maintain subjests info
maintain time table
register for course
student
write examinations
pay fee
22
MAINTAIN CURRICULUM
<<include>>
maintain curriculum
<<include>>
introduce new course
<<include>>
update syllabus
maintain in take details
23
maintain circulam
registrar
maintain stu info
maintain staff info
Class diagram:
24
+1..*
University
uni_name
uni_code
uni_clz
has
Department
dept_name
dept_id
con_class()
con_exam()
admissions()
schedule()
+1
<<aggregation>>
+1..*
+1
<<aggregation>>
assigned to
+*
attend_class()
listen()
write_exam()
head of
reffered
member
Student
stu_name
stu_id
stu_add
stu_ph
<<aggregation>>
+1..*
+1..*
attends
Course
cou_name
cou_id
cou_type
+*
teaches
+1..*
Staff
staff_name
staff_id
staff_add
staff_ph
+1
take_class()
evaluate()
Class diagram:
25
Department
name
number
Fax num
HOD
find()
Delete()
Amend()
law
Scot
Student b
Module
Name
Adress
Student number
Gender
code
Module leader
level
name
Find()
add()
Delete()
Amend()
+has
1..*
+canTake
1..*
Find()
select()
change()
Allocate()
Sequence diagram:
26
student
application
interview
admission
1:send
2:attend
3:[pass] admit
Collaboration:
1: 1:send
student
application
2: 2:attend
3: 3:[pass] admit
admission
interview
27
Sequence diagram:
Department
Module
student
: lecturer a
1: find()
2: add()
3: Select()
4: list()
Collaboration:
1: find()
Departm
ent
: lecturer a
3: Select()
2: add()
4: list()
Module
student
28
ACTIVITY DIAGRAMS
start
get the marks of
all the students
calculate
percentages
if%>=75
yes
A grade
no
if 60<=%<75
yes
B grade
no
if %<60
no
yes
C grade
stop process
29
STATE TRANSITION DIAGRAM FOR STUDENT INFORMATION
State chart diagram
Create
Probatio
nal
Sucessfully completed 6 months period
Permane
nt
On successful completion of 6 month period
Resigned
Left
30
initialization
Do:initialize batch
cancel
cancelled Do:notify
registered students
add student/set c=0
cancel
cancel
open
Entry:Register students
Exit: increment student
[c=n]
close Do:finalize
batch
STATE TRANSITION DIAGRAM FOR STUDENT INFORMATION
31
student state chart diagram
Initialization
do:initialize batch
cancel
cancelld do:notify
registered students
add student set c=0
Open
student
Entry:Register
Exit:Increment student
cancel
Grades
Do:> 75% 1st class
< 65% and > 50%2nd class < 50% & pass 3rd class
cancel
close
do:finalize batch
32
Component diagram
Departm
ent
Course
Student
Deployment diagram
Staff
Login
server
Studen
t
33
Case study 3:
Bank ATM SYSTEM:
Problem statement:-
S/w system is to be designed for supporting a computerized ATM banking
n/w.All the accounts maintained in the bank and also the transactions effected,including
ATM transactions ,are to be processed by the computers in the bank.
An ATM accepts a relevant cash card interacts with the user,communicates with
the central system to carry out the transaction,dispenses cash,and print receipts.
The system to be designed and implemented must include appropriiate record
keeping and security provisions.The system must handle concurrent accesses to the
same account.
34
USE CASE DIAGRAM:
changepin
session
customer
<<include>>
enquiry
Transaction
viewbal view a/c details viewtransHistory
<<include>> verifycheque
depositcheque
transfer
<<include>>
<<include>>
<<include>>
withdrawl
<<include>>
<<extend>>
<<include>>
<<include>>
Deposite amount
<<include>>
verifymindetail
<<include>>
report out of bal
<<include>>
verify a/c type
update trans histo
update balance
35
ATM CLASS DIAGRAM:
Bank server
customer
ATM card
card no : int
a/c no : int
card type : str
OWN
withdrawl()
deposit()
transfer()
view bal()
session
session id
a/c no
trans id
session()
a/c no : str
name : str
add : str
phone no : int
performs
bank server
operations
server_id : int
name : string
location : str
uses
valid pin()
change pin()
commit()
rollback()
create a/c()
delete a/c()
view details()
update details()
trans()
valid pin()
change pin()
Account
holds
Transaction()
no
trans_id
trans_type
amt
Acc_no : int
a/c_type : str
bal : float
commit()
rollback()
add()
commit()
add()
saving a/c
current a/c
36
37
customer
1: Insert card
: ATM
machine
: Bank
server
2: Obtain Pin
3: Enter Pin
4: Validate Pin
5: Valid Pin
6: Enter deposit amt
7: Deposit Amt
8: Open deposit slot
9: Insert Envelop amt slot
10: Envelop recived
SEQUENCE DIAGRAM
38
COLLABORATION
custome
r
1: Insert card
3: Enter Pin
7: Deposit Amt
: ATM
machine
2: Obtain Pin
6: Enter deposit amt
8: Open deposit slot
9: Insert Envelop amt slot
10: Envelop recived
5: Valid Pin
4: Validate Pin
: Bank
server
39
customer
: session
: Bank
server
1: Insert Card
2: Obtain Pin
3: Enter Pin
4: Send Pin
5: Request
6: Obtain types of enquiry
7: Type
8: Get a/c no's
9: seif
10: Bal enquiry
11: Current bal
12: Transaction history
13: Previous trans
14: View a/c details
15: Display(a/c no,bal,names)
40
SEQUENCE DIAGRAM
custome
r
1: Insert Card
7: Type
3: Enter Pin
5: Request
6: Obtain types of enquiry
9: seif
: session
11: Current bal
13: Previous trans
15: Display(a/c no,bal,names)
: Bank
server
2: Obtain Pin
4: Send Pin
8: Get a/c no's
10: Bal enquiry
12: Transaction history
14: View a/c details
Enquiry collaboration:
COLLABORATION
41
: ATM
machine
customer
: Bank
server
1: Insert Card
2: Validate Pin
3: Validate
4: Choose Transaction
5: Withdraw
6: Check Balance
7: Sufficiant Balance
8: Creadit cash
9: Insufficiant Balance
10: Low balance
Withdraw sequence diagram:
42
COLLABORATION
custome
r
1: Insert Card
4: Choose Transaction
5: Withdraw
8: Creadit cash
10: Low balance
: ATM
machine
3: Validate
7: Sufficiant Balance
9: Insufficiant Balance
2: Validate Pin
6: Check Balance
: Bank
server
43
ACTIVITIY FLOW
customer
ATM
bank serv er
insert card
enter PIN
select
transaction
receive cash
:receipt
print
start transaction
validate PIN
:validation
[success]
:transaction
withdraw
close
transaction
44
STATE CHART FOR ATM
idle
enter/pressed
ready
press [first digit>0]
next
number
enter/pressed
validate
invalid
valid
transactions
complete
cancel pressed
cancel
cancelled
45
ATM
Machine
customer
account
withdraw
checking
account
balance
enquiry
bank
manager
saving
account
COMPONENT Diagram:
Component diagram:A sample component files
46
index.html
Parallel
port.exe
iput32.dll
cmd.exe
Deployement diagram:
Atm machine
location -A
console
Atm machine
location b
bank
server
Case Study 4: cellular phone system
47
Problem statement:
The cellular network must place the phone call currently,and also
schedule the receiving and conference calls.
Usecase diagram:
Cellular
system
Isdn Call
<<Generalization>>
<<uses>>
Local Call
<<uses>>
<<Generalization>>
<<Generalization>>
STD Call
<<uses>>
<<uses>>
Call Connect
<<uses>>
Services
<<uses>>
Call is drop after it is connected
<<extend>>
Message Sevices
<<uses>>
Call Drop
Miscellaneos
<<uses>>
<<uses>>
<<uses>>
<<uses>>
MSG Delivery
MSG Sending
GPRS
WAP
Other
Class diagram:
48
telephone line
telephone no
subscriber
name
adrdress
1..n
1..n 0..n
make a call()
1
+1
operator
chek bill()
register new sub scriber()
0..n
individual
ID
Organization
business registration no.
call
callee number
date
start time
end time
call details()
sequence diagram
49
Subscriber :
SampleModel
Telephone line
call control
:call
lift telephone receiver
request number
dial number
dial number
start call
create
replace telephone receiver
end call
set end time
collaboration diagram
call
control
Telephone
line
4: dial number
5: start call
8: end call
6: create
9: set end time1: lift telephone receiver
2: request number
3: dial number
7: replace telephone receiver
:call
Subscriber :
SampleModel
50
STATE DIAGRAM
initial state
on hook
idle
dial
on hook
talk
ready to
dial
busy
busy
connecting
ringing
destination
altered
51
Timeout
<Dial digit>
<After 15 sec>
DialTone
Idle
<dial>
Dialing
<dial invalid>
<Start>
Invalid
<Dial Valid>
Connecting
Toling
<busy>
<Calle Hung up>
Toling2
<Available>
Busy
Ringing
52
Lift telephone
receiver
wait for dial tone
dial number
[answered]
[busy or no one answers]
talk
replace telephone
receiver
ACTIVITY diagram for elaboration of make a call
53
Component diagram
Telephone
billingGUI
call
controlor
Billing db
server
:OPERATORPC
:Telephone swith
InterfacePC
:ServerPC
DEPLOYMENT DIAGRAM
54
Case study 5: Trading System
Problem statement:
The trading system must take care of sales
information of the company and must analyze the
potential of the trade.
Usecase diagram:
Trading
System
Places Order
<<include>>
Center Delivery
<<uses>>
User
Order
Delivery
Operates Order
<<uses>>
<<Generalization>>
Home Delivery
<<include>>
<<Generalization>>
<<include>>
Check Password
<<include>>
Operator
Validation
Instant Order
<<include>>
<<include>>
Future Order
Check Availability
Place Order
Trace Order
55
Class diagram:
customer
number
name
address
places
1
1..n
request()
receive()
1..n
1
contains
1..n
orderline
number
quty
name
supplies
1..n
product
number
name
colour
unit price
order
number
date
type
for
1..n
1
1
stored in
1..n
ware house
city
phone number
add()
delete()
56
Sequence diagram:
customer
clerk
supplier
warehouse
place order()
chek product
request stock
product available()
deliver product
collaboration diagram
57
5: deliver product
clerk
customer
1: place order()
2: chek product
4: product available()
supplier
warehouse
3: request stock
ACTIVITY DIAGRAM FOR TRADING SYSTEM
customer sends an
order request
order request, system
confirms the receipt of ...
no
if order is
normal?
yes
confirm the
order
order is special?
yes
dispatch the
order
no
STATE TRANSITION DIAGRAM FOR TRADING SYSTEM
58
Idle
send order
request
normal quit
select normal or
special order
confirm event
failures
order
confirmation
complete transaction
diapatch
order
COMPONENT DIAGRAM
purchase
reorder
check
stock
balance
receive
order
place
order
DEPLOYMENT DIAGRAM:
59
ORDER
CUSTOMER
DATABASE
SERVER
60