You are on page 1of 23

Unified

Modeling
Language

Rajeev Kumar
CSE, IIT-Kgp
PART I

Rajeev Kumar, CSE, IIT - Kgp 2


Systems, Models, and
Views

Š A model is an abstraction
describing a system or a subset
of a system
Š A view depicts selected aspects of
a model
Š A notation is a set of graphical
or textual rules for representing
views

Rajeev Kumar, CSE, IIT - Kgp 3


Systems, Models and
Views
( UML )
* *
System Model View

described by depicted by

airplane:System

scaleModel:Model flightSimulator:Model

blueprints:ViewfuelSystem:View
electricalWiring:Vie
Rajeev Kumar, CSE, IIT - Kgp 4
What is UML?

UML is a Language for...

• Visualizing
• Specifying
• Constructing
• Documenting

Rajeev Kumar, CSE, IIT - Kgp 5


System Architecture
Class

Design View
Object

Use Case View Use Case

Process View Sequential

Collaboration

State

Activity

Implementation View Component

Deployment View Deployment


Rajeev Kumar, CSE, IIT - Kgp 6
Class

Name
Š A Class
represents a
Concept Attributes
Š Represents a set
of objects that Surface
have the same
Texture
Attributes,
Operations,
Relationships increaseTex()
descreaseTex()
and Semantics.
returnTex()
Š Can be mapped
directly to many
programming
languages Operations
Rajeev Kumar, CSE, IIT - Kgp 7
Class
Singleton

2 or more
instances

Surface [2..*]
Instance
scope (
+ Tex : Texture auto )
+ Col : Colour 1
# Dim : Dimension

Class
scope
Public + changeCol() ( static )
+ increaseTex()
+ decreaseTex()
Private - queryTex()
# findSibling()
Protected

Rajeev Kumar, CSE, IIT - Kgp 8


Class - Templates

Template class Name


Name
Polygon

+ rotateLeft() Template
+ rotateRight() parameters
+ enlarge()

Implicit Binding <<bind>> ( Square )

Polygon< Square >


MySquare

Rajeev Kumar, CSE, IIT - Kgp 9


Relations

A Relation is a Connection
between things (e.g.: Classes).
The three types or relations
are:

• Dependency
• Generalization
• Association

Rajeev Kumar, CSE, IIT - Kgp 10


Relations - Dependency

A dependency states that changing


the thing A may effect the thing B.

Dependency

FindRecord ReadBlock

B A

B depends on A
Rajeev Kumar, CSE, IIT - Kgp 11
Relations -
Generalization
generalized
Button

specialized
specialized

Ok Button Cancel Button

Š Generalization relationships
denote inheritance between
classes.
Š The children classes inherit the
attributes and operations of the
parent class.

Rajeev Kumar, CSE, IIT - Kgp 12


Relations - Association

Multiplicity

1 Is made of 1..*
House Bricks

Association

•An association denotes the relationship


between classes.
•the multiplicity of an association end
denotes how many objects the source
object can reference.
Rajeev Kumar, CSE, IIT - Kgp 13
Relations - Association

parent / aggregate
House

aggregation

12 1..* children

Windows Bricks

•An aggregation is a special case of


association denoting a “consists of”
hierarchy.
•The aggregate is the parent class, the
components are the children class.
Rajeev Kumar, CSE, IIT - Kgp 14
Relations - Association

parent / aggregate Clock

aggregation

1 1 children

Small hand Big hand

A solid diamond denote composition, a


strong form of aggregation where
components cannot exist without the
aggregate.
Rajeev Kumar, CSE, IIT - Kgp 15
Relations - Realization

A Realization is:

• A contract
• Used to model an Interface

Rajeev Kumar, CSE, IIT - Kgp 16


Relations - Realization

processRec
record seekRecord

getNewData()
updateRec()

realization

A Realization relation...

Rajeev Kumar, CSE, IIT - Kgp 17


Class Diagrams
A Class Diagram consists
of the following things:

• Classes
• Interfaces
• Collaborations
• Dependency / generalization
/ association

Rajeev Kumar, CSE, IIT - Kgp 18


Class Diagrams
Class

Cardinality
WristWatch Association
11 1 1 1

2 1 2 1

LCDDisplay Battery Buttons Strap

Blink charge state color

getBlink() getChrge() push() fix()


setBlink() setWarn() release() release()

Operations
Attributes
Rajeev Kumar, CSE, IIT - Kgp 19
Objects

An Object is a
physical instantiation of a class.

blueprint gives us house

class gives us object

abstract concrete
Rajeev Kumar, CSE, IIT - Kgp 20
Objects

Named Instance
op : Operations

anonymous instance : Operations

op : orphan instance

underlined op : Operations

object with state res : Result = True

Rajeev Kumar, CSE, IIT - Kgp 21


Object Diagrams

An Object Diagram:

• is a snapshot of a dynamic process


• is an instance of a class diagram
• shows set objects and their relation at
a point in time

An Object Diagram consists of:

• objects
• links
• attribute value

Rajeev Kumar, CSE, IIT - Kgp 22


Object Diagrams

c : Company Object

d1 : Department d2 : Department

e1 : Employee links e1 : Employee

e2 : Employee e2 : Employee

Attribute
e3 : Employee value

c :- Contact
name = “Satish” Rajeev Kumar, CSE, IIT Kgp 23

You might also like