You are on page 1of 46

INTRODUCTION TO UML

WHAT IS UML?
The Unified Modeling Language (UML) is a standard language for writing software
blueprints. The UML is a language for
- Visualizing
- Specifying
- Constructing
- Documenting
the artifacts of a software-intensive system.
The UML is appropriate for modeling systems ranging from enterprise information
systems to distributed Web-based applications and even to hard real time embedded systems.

IMPORTANCE OF MODELING
1) If we want to build a dog house, with a little planning, we’ll likely end up with a dog
house that’s reasonably functional and we can do it with no one’s help.
2) If we want to build a house for a family, it’s going to take a lot longer. In this case we need
some detailed planning; we’ll need to draw some blueprints, before we lay the foundation. 3) If
we want to build a high-rise office building, we’ll have to do extensive planning; and we need all
sorts of blueprints and models to communicate with one another.

WHAT IS A MODEL
 A Model is a simplification of reality.
 We build models so that we can better understand the system we are developing.
 We build models of complex systems because we cannot comprehend such a system in its
entirety.
Through Modeling, we achieve four aims
1. Models help us to visualize a system as it is or as we want it to be.
2. Models permit us to specify the structure or behavior of a system.
3. Models give us a template that guides us in constructing a system.
4. Models document the decisions we have made.

1
ARCHITECTURE OF UML

Architecture is a set of decisions about


1) The organization of software system
2) The selection of structural elements
3) The behavior of these structural elements
4) The composition of these structural elements
5) The architectural style that guides the organization

Architecture of UML can be described using 5 views

1) Use case view:


It contains use cases that describe the behavior of the system as seen by the end user. The
static aspects of this view are captured in Use case diagrams.

2) Design view:
It contains classes, collaborations and interfaces. This view supports the functional
requirements of the system. The static aspects of this view are captured in Class diagrams and
Object diagrams.

2
3) Process view:
It contains threads and processes that form the systems concurrency and synchronization
mechanisms. This view focuses on the performance, scalability and throughput of the system.
The static aspects of this view are captured in Class diagrams and Object diagrams.
4) Implementation view:
It contains components and files that are used to assemble and release the physical
system. This view focuses on the configuration management of the system. The static aspects of
this view are captured in Component diagram.
5) Deployment view:
It contains the nodes that form the system hardware topology. This view focuses on
distribution, delivery and installation of the parts that make the physical system. The static
aspects of this view are captured in Deployment diagram.
The dynamic aspects of all the above mentioned vies are captured in Interaction, Activity
and State chart diagrams.
BASIC BUILDING BLOCKS
There are 3 kinds of basic building blocks
1. Things
2. Relationships
3. Diagrams
THINGS
There are 4 kinds of things in the UML
i. Structural Things
ii. Behavioral Things
iii. Annotational Things
iv. Grouping Things

Structural Things
Structural Things are nouns of UML models. There are 7 kinds of Structural things
Class: A class is a set of objects that share the same attributes, operations, relationships and
semantics.

3
Class Name
Attributes

Operations()

Interface: An Interface is a collection of operations that specify a service of a class or


component

ISpelling

Collaboration: Collaboration describes co-operative work of an element.

Use Case: Use Case describes set of sequence of actions that a system performs that yields an
observable result of value to a particular actor.

UseCase
Actor

Active Class: Active class is just like a class but its elements are connected to other class
elements.

Component: Component represents physical packaging of logical elements like classes,


interfaces and collaborations.

Component

Node: A Node is physical element that exists at run-time and having at least some memory and
processing capability.

4
Node

Behavioral Things
Behavioral Things are the verbs of UML representing behavior over time and space. There are 2
kinds of Behavioral things.
Interaction: Interaction is used to show communication between two objects.

State Machine: State Machine specifies sequence of states of an object.

Annotational Things

Annotational Things are explanatory parts of UML.


Note: Note is used to give comments to an element or collection of elements.
Note

Grouping Things

Grouping Things are the organizational parts of the model.


Package: Package is a general purpose mechanism for organizing elements or things into groups
or packages.

Package

RELATIONSHIPS

There are 4 kinds of Relationships in the UML:


Dependency: It is denoted by dashed line with an arrow.

5
Dependency is a relationship between two things in which a change to one thing (Independent
thing) may affect the other thing (Dependent thing).
MovieClip
name
Channel
Dependency
screen()
start()
stop()

Association: It is denoted by a solid line.


____________________
Association is a structural relationship that describes a set of links, a link being a connection
among objects. Aggregation is a special kind of association, representing a structural relationship
between a whole and its parts.

Generalization: It is denoted by a solid line with a hollow arrow head pointing to the parent

Generalization is a relationship in which the child will share the behavior of the parent.

Shape
origin : Integer

display()

Rectangle Circle
length : Integer radius : Integer
breadth : Integer

Realization: It is denoted by dashed lines with a hollow arrow head.

6
Realization is a relationship between classifiers, where one classifier specifies a contract that
another classifier guarantees to carry out

DIAGRAMS
There are 9 types of Diagrams in UML, which are classified into 2 types
Structural Diagrams (static diagrams)
These are of 4 types
Class Diagram: A Class diagram shows a set of classes, interfaces, and collaborations and their
relationships. A class consists of class name, attributes, operations and responsibilities.

College
Department
name : String
location : String D_name : String
D_code : Integer
collect fees()
recruit faculty()

Staff
S_name : String

7
Object Diagram: An Object diagram shows a set of objects and their relationships. They
represent snapshots of instances of the things found in class diagrams.

C: College
D: Department
name = "B.V.R.I.T"
location = "Narsapur" D_name = "CSE"
D_code : Integer = 05
collect fees()
recruit faculty()

S: Staff
S_name = "xyz"

Component Diagram: A Component diagram shows the organizations and dependencies among
a set of components.

Deployment Diagram: A Deployment diagram shows the configuration of run-time processing


nodes and the components that are present in them.

Component and Deployment diagrams are called as Physical Diagrams.


Behavioral Diagrams (Dynamic diagrams)
These are of 5 types
Use Case Diagram: A Use Case diagram shows a set of use cases and actors and their
relationships. An Actor can be a human or a system. The role of actor is written below.

8
Interaction Diagrams: An Interaction diagram shows an interaction, consisting of a set of
objects and their relationships, including the messages they exchange among them.
Two types of Interaction diagrams are:
Sequence Diagram: A Sequence diagram is an interaction diagram that emphasizes the time-
ordering of messages. To show interaction between objects we use 3 types of messages.
Simple Messages:

A Simple message shows how control is passed from one object to other without describing
communication in detail i.e. without indicating whether it is synchronous or asynchronous
message.
Synchronous Messages:

If sender object waits for a reply from receiver object from destination, such messages are called
Synchronous messages. Here, only one object can send a message at a given instance of time.
Asynchronous Messages:

If sender object continues executing while target is processing the message then such messages
are said to be Asynchronous messages. Here, multiple messages are executed at a time.
Object Lifeline: An Object life line is vertical dashed lines that represent the existence of an
object over a period of time.

9
Focus of Control: It is represented by rectangle that shows the period of time during which an
object performs some actions.

Collaboration Diagram: A Collaboration diagram is an interaction diagram that emphasizes the


structural organization of the objects that send and receive messages.

3: fill form 5: check form

1: Request form
4: submit
S: Student A: Admin

2: give form
6: eligible

State chart Diagram: A State chart diagram shows a state machine, consisting of states,
transitions, events, and activities.
Event: It refers to happening of an activity at a given time and place.

10
Activity Diagram: An activity diagram is a special kind of state chart diagram that shows the
flow from activity to activity within a system, which are connected by a triggerless transition.
We can check some conditions using decision box, which is denoted by a diamond.

Activity: It is a major task that must take place in order to fulfill an operation contract.
Initial Activity: This shows the starting point of the flow. It is denoted by solid circle.

11
Final Activity: This shows the end of the flow in the activity diagram. It is denoted by a solid
circle nested in a circle.
Decision Box: A point in an Activity diagram where a flow splits into several mutually exclusive
guarded flows. It has one incoming transition and two outgoing transitions.
Forking and Joining:-We use synchronization bar to specify the forking and joining of parallel
flows of control.
A synchronization bar is a thick horizontal or vertical line.
A Fork may have one incoming transition and two or more outgoing transitions, each of which
represents an independent flow of control.
A Join may have two or more incoming transitions and one outgoing transition.

Student

synchronization
Forking bar

Listen Watch

Joining

Success

Swimlanes: They are used to group related activities into one column.

12
Identifying & Analyzing Events:
Event: An event occurs at a specific time and place, can be described, and should be remembered
by the system events drive or trigger all processing that a system does, so listing events and
analyzing events makes sense when you need to define system requirements by identifying use
cases.

Event decomposition, is a technique that first focuses on the events a system needs to respond to
and then looks at how a system must respond the systems use cases.

Types of Events:

There are 3 types of events to consider:

 External Events
 Temporal Events
 State Events

External Events: It is an event that occurs outside the system usually initiated by an external
agent. An external agent is a person or organizational unit that supplies or receives data from the
system, not necessarily system user

Eg: Customer

13
Another type of external event occurs when external entities provide new information that the
system simply needs to store for later use

Eg: A regular customer reports a change in address, phone or employer.

Customer updates Account information

Temporal Event: A temporal event, an event that occurs as a result of reaching a point in time.
These events are different from external events in that the system should automatically produce
the required output without being told to do so.

In other words, no external agent is making demands, but the system is supposed to generate
need information or other outputs when they are needed.

Eg: Payroll systems that produce a pay check every two weeks (or each month).

Temporal events do not have to occur on a fixed date.

They can occur after a defined period of time has elapsed

Eg: A bill might be given to a customer when a sale has occurred. If the bill has not been paid
within 15 days, the system might send a late notice.

The temporal event, Time to send late notice, might be defined as a point 15 days after billing
date.

State Events: State event, an event that occurs when something happens inside the system that
triggers the need for processing.

Eg: If the sale of a product results in an adjustment to an inventory record and the inventory in
stock drops below a reorder point , it is necessary to reorder.

State events might be named reorder point reached.

Often state events occurs as a consequence of external events .

Sometimes they are similar to temporal events, except that the point in time can’t be defined. The
records event might be named time to reorder inventory, which sounds like a temporal event.

14
Identifying use cases:
A use case is an activity the system carries out, usually in response to a request by a user. In the
inception phase of any project, analysts identify many of the key use case. By the end of the
elaboration phase, they should have identified all the use cases and described them in detail.
Several techniques are recommended for identifying use cases.
One approach is to list all the users and think through what they need the system to do for their
jobs. By focusing on one type of user at a time, the analyst can systematically address the
problem of identifying use cases.
Another approach is to start with the existing system and list all system functions that are
currently included, adding any new functionality requested by users.
A third approach is to talk to all users to get them to describe their goals in using the system.
Use Cases for customer support system:
1. Customer looks for item availability.
2. Customer creates new order.
3. Customer updates order.
4. Customer look up for order status.
5. Manager records order fulfillment.
6. Manager records backorder if any.

15
7. Customer creates order return.
8. Manager provides catalog information.
9. Customer updates account information.
10. Manager distributes promotional package.
11. Manager creates and updates catalog.
Use cases for POS:
1. Customer arrives at POS checkout with goods and /or services to purchase.
2. Cashier starts a new sale.
3. Cashier enters item identifier.
4. System records sale line item and presents item description, price, and running total price
calculated from a set of price rules.Cashier repeats step 3-4 until indicates done.
5. System presents total with taxes calculated.
6. Cashier tells customer the total, and ask for payment.
7. Customer pays and system handles payment.
8. System logs completed sale and sends sale and payment information to the external
Accounting system (for accounting and commissions) and inventory system (to update
inventory).
9. System presents receipt.
10. Customer leaves with receipt and goods (if any).

Use cases for library management system:

1. Student / member enters into library and request for membership form.
2. Librarian gives membership form.
3. Student / member submit membership form to librarian.
4. Librarian approves and adds to library.
5. Acknowledges with library ID.
6. Student / member searches for book availability.
7. Student / member requests for book issue.
8. Librarian issues book with expiry date.
9. Student / member returns or request for renewal of the book.
10. If returned library clerk checks for any dues.

16
Event Table for Customer Support System:
EVENT TRIGGER SOURCE USECASE RESPONSE DESTINATIO
N
Customer wants Item enquiry Customer Lookup item Item availability Customer
availability details
to check
item availability
Customer places New order Customer Create new order Real time link Credit bureau
an order order conformation customer
order details shipping
transaction bank
Customer Order change Customer Update order Change Customer
changes confirmation shipping
or cancels order request order change bank
details
Transaction
Time to produce End of week, Produce order Order summary Management
order summary month,quarte summary reports reports
reports r
and year
Time to produce End of day Produce Transaction Accounting
transaction transaction summary reports

17
summary summary reports
reports
Customer or Order status Customer or Look up order Order status details Customer or
management enquiry management status management
wants to check
order status
Shipping fulfills Order Shipping Record order
order fulfillment fulfillment -
notice
Shipping Back order Shipping Record back Back order Customer
identifies notice order notification
back order
Customer Order return Customer Create order Return Customer
returns item notice return confirmation Bank
transaction
Time to produce End of week, Produce Fulfillment Management
fulfillment month,quarte fulfillment summary
summary r summary reports reports
reports and year
Prospective Catalog Prospective Provide catalog Catalog Prospective
customer request customer info customer
requests catalog
Time to produce End of month Produce Prospective Marketing
prospective prospective customer
customer customer activity reports
activity reports activity
reports
Customer Customer Customer Update customer
updates account
account update notice account
information
Marketing Promotion Marketing Distribute Promotional Customer and
wants package promotional package prospective
to send details package customer
promotional
materials to
customers
Management Customer Management Create customer Charge Customer
adjusts charge charge adjustment Bank
customer adjustment adjustment notification
charges transaction
Time to produce End of month Produce Customer Management
- customer adjustment
customer adjustment reports
adjustment/ reports
concession

18
reports
Merchandising Catalog Merchandisin Update catalog
updates update details g -
catalog
Merchandising Special Merchandisin Create special
creates promotion g promotion -
special product details
promotion
Merchandising New catalog Merchandisin Create new Catalog Customer and
creates details g catalog prospective
new catalog customer
Time to produce End of month Produce catalog Catalog activity Merchandising
- activity reports reports
catalogue
activity reports

Class Diagrams:

Class Diagram for Customer Support System

19
customer
cart
name product
phone number product name
product name
address product Id
product Id
*
order() getProductname()
enquiry()
getproductId()

shipping order Inventory


bank
shipping id order Id Inventory Id
account no
status item name
branch

transaction() tracking() cancel()


submit()

transaction tele booking web booking email booking


book name
branch

cash on delivary()
credit()
debit()
refund()

debit cash on delivary

Class Diagram for Point Of Sale

20
member
Id
name
product pwd
product id mobile no
product name address
price creditcard no
category
stock addmember()
update()
addproduct() createorder()
updatestock() 1
updateprice()
1

1..*
order_transaction
orderID payment
1..*
detail_order memberID paymentID
totalprice payment method
detailorderID
orderdate payment date
productID
order type payment status
quantity 1..* 1 1 1
add Transactio() add payment()
get member() update status()
create pay ment()

Class Diagram for Library Management System

21
library catalogue
name : string
total books : int
created by : string

library employment add book()


1 delete book()
name : string
display()
address : string * book
update book() 1
loginInfo : string
contactInfo : string * title : string
subject : string
library
author : string
name : string ISBN : int
location : string copie : int
*
librarian manage member() 1 add()
library Id manage book() delete()
manage EMP() update()
manage library() manage database()
allow membership() library clerk
delete membership() library Id

issue book()
return book() course book
reference book issue Id
add book() member
delete book() reference Id date of return
name : string
libId : void
address : string
DOB : int
contact no : int
name2
student emloyee
course name : string updateinfo() emp Id
student Id : void takemembership() dep name
removemembership()
checkbookdetail() issuebook() checkbookdetail()
returnbook()

CRUD Matrix(C: Create, R: Read, U: Update, D: Delete)

22
CRUD Matrix For Customer Support System
Usecases Domain Classes
Inventory Order Item Product Return
Catalog Customer Item Order Order Item Transaction Package Item Item Shipment Shipper
Look up item availabilty R
Create Netwok CRUD RU CR C C R R C R
Update Order UD RU RUD RUD RUD R R CRUD R
Look Up Order Status R R R R R R
Record Fullfillment RU RU
Record Back Order RU CRU
Create Order Return CRU RU C C
Provide Catalog information R R R R
Update Account Customer CRUD
Distribution Promotional Package R R R R R
Create Customer Change Adjustment RU CRUD
Update Catalog RU R RU R
Create Special Promotion R R R R
Create new Catalog C R R CRU R

23
Crud Matrix for Point of Sale

UseCases Domain Classes


Customer Cashier System Inventory Item Product Item Package Return Item Register
Arives at Check Point C
Creates New Sale C C,R C R,U R R R
BarCode Scanner R,U C,U R,U R R
Update Sale R,U,D R,U,D R
Calculate Tax C C
Calculate Price C,R C,R,U R R R
Payment C,R R,U U R,U R,U
Distribute Promotional Package R R R R R
Record U C
Return Product C R,U C,U U R C

CRUD MATRIX FOR LIBRARY MANAGEMENT SYSTEM


Usecases Domain Classes
Library LibrarianCatalog Issue book Return Book Manage Journals
Student enters into library R R
login/Request for membership form C C
submission of membership form C,R R
Book availability R R R R
Lend Books C,R C,R R,U C,R,U C,R
Return Books C,R,U R,U R,U C,R,U C,R
Resrve Books R,U R,U R,U R,U
Cancel Reservations C,R,U,D R,U,D R,U R,U
Manage Book Transfer C,R,U,D C,R,U,D R,U

24
Use case Diagrams:

Use case Diagram for Customer Support System

login

search item

customer manager
check availability

buy product

calculate price

update item

payment

shipment
shipper

25
Use case Diagram for Point of Sale

generates sales report


manager

supplier

reorder depleted inventory

inventory system
update inventory check inventory

check out cashier

customer

scan item

calculate total tax


payment

by cheque by deposit by cash by credit

26
Use case Diagram for Library Management System

add membership

delete membership
librarian
add book

clerk

req membership

delete book

member

enquire book

check availability

issue book

calculate over due change return book

27
Sequence Diagrams:

Sequence Diagram for Customer Support System

catalog catalog item order payment system shipment

1.item search()

2.select item()

3.create order()
4.item is available or not()

5.item is instock()

6.order confirmatio()

7.request for payment()


8.pays amount()
9.order id()

10.delivers the item

11.update catalog

28
Sequence Diagram for Point Of Sale

customer product catalogue sale product sales lineitem


specification

1.create() 2.create()

3.specification() 4.find()

item() 6.create()

7.add()

29
Sequence Diagram for Library Management System

member librarian library clerk library catalog book library

request membeshi[p

provide membership form

submit membership form

add in the library

assign library ID

acknowledge with libraryID

enquire for a book


search for a book

search result

ack book availability

request for issue update catalog

issue book

30
Collaboration Diagrams:

Collaboration Diagram for Customer Support System

1: 1.item search()

2: 2.select item()
catalog 3: 3.create order() item
7: 6.order confirmatio()

6: order

9: 8.pays amount()
8: 7.request for payment()
12: 11.update catalog 5: 5.item is instock()
11: 10.delivers the item

4: 4.item is available or not()

10: 9.order id()


payment shipment
system

31
Collaboration Diagram for Point Of Sale

product
3: 3.specification() catalogue

1: 1.create()
5: item()
customer
sale

4: 4.find()

2: 2.create()
6: 6.create()
7: 7.add()

product sales
specification lineitem

32
Collaboration Diagram for Library Management System

librarian

1: request membeshi[p library clerk


3: submit membership form

7: enquire for a book


11: request for issue

2: provide membership form


6: acknowledge with libraryID 4: add in the library
10: ack book availability
13: issue book

member 9: search result


5: assign library ID

8: search for a book


12: update catalog

library

library book
catalog

33
Component Diagrams:

Component Diagram for Customer Support System

Ordering Application Server

Login Order
Records Inventory Inventory
Updates Reports

DataBase
Transaction

Credit Check
Verification Verification

Authentication
Server

34
Component Diagram for Point Of Sale

Terminal Window
Application Server

Scanning Login

Inventory Inventory
Updation Reports

Authentication Transaction
Server

credit Billing
Verification

Data Base

35
Component Diagram for Library Management System

Book
Management Member Library EMP
Management management

Library
Catalog Library
System

36
State Chart Diagrams:

State Chart Diagram for Customer Support System

Idle Send Order Select normal or


Request special order

Order
confirmation

Dispatch
order

37
State Chart Diagram for Point of Sale

enter items

Waiting for Make New Sale Entering


sale Items

Authorized
End Sale
Make Cash Payment
Make Credit Payment
Authorizing Waiting for
Payment payment

Make Check Payment

38
State Chart Diagram for Library Management System

Request for issue


Request for return
Check
Availability
Return
Book

Validate
Member
Not Valid

Valid

Issue Book

39
Activity Diagrams:

Activity Diagram for Customer Support System

40
cust omer login

no
v alidat es

y es

search f or item

check av ailability
no

y es

order it em

c onf irm ation to


cust omer with pric e

c ust omer pay s


am ount

pay ment by cash on


card deliv ery

s hips item t o
cust omer

Activity Diagram for Point Of Sale

41
NewSwimlane

customer arrives at
checkpoint

cashier enters
itemid,name,price

cashier calculates
price with tax

customer
payment

pay by card pay by cash

transaction
completed

Activity Diagram for Library Management System

42
Book Search Validation Issue

Acknowledge about
Enquire about a
book availability
book

Issue Request
Enter ISBN

Issue Book

Check Check
availability Membership

Yes

Search Result Validate


Member

No
Message Box

Deployment Diagrams:

43
Deployment Diagram for Customer Support System

Client Tier Web Tier Application


Tier

Data Tier

Deployment Diagram for Point Of Sale

44
Printer

Application Server
Database

Terminal

Barcode
scanner

Deployment diagram for Library Management System

45
Client Application
Desktop Server

Database
Server

46

You might also like