Anda di halaman 1dari 70

Unified Modeling Language

Rajthilak S

GO TO USER ROLES PAGE

Many Stakeholders , many views


Architecture may be many things to many different stakeholders

End user
Project Manager
System Engineer
Developer
Tester
Maintainer

Multidimensional Reality
Many Stakeholders

multiple views , multiple blueprints

GO TO USER ROLES PAGE

Models
Modeling is the designing of software applications before coding.
Models are the higher level of abstraction of the System.
A model plays the analogous role in software development that blueprints and

other plans (site maps, elevations, physical models) play in the building of a
skyscraper.
Modeling is the only way to visualize the design and check it against

requirements before one starts to code.


Models are also the vehicle for communication with various stake holders.

GO TO USER ROLES PAGE

What is UML?

General-purpose modeling language


Helps to specify, visualize, and document models of software systems
High Level abstraction of the system
Represents the system using Graphical Notations from various Perspectives
used for business modeling and modeling of other non-software systems too
UML 2.0

GO TO USER ROLES PAGE

Evolution of UML

Successor to the wave of Object Oriented Analysis and

Design(OOA&D).
unifies the notations used by three amigos(Grady Booch, Ivar

Jacobson and James Rumbaugh) in their OO methods.


OMG

GO TO USER ROLES PAGE

Different Perspectives of System

GO TO USER ROLES PAGE

Basic OO Terms
A model is an abstraction of the underlying problem.
The domain is the actual world from which the problem comes.
Models consist of objects that interact by sending each other messages.
Objects have things they know (attributes) and things they can do (behaviors

or operations).

The values of an object's attributes determine its state.


Classes are the "blueprints" for objects. A class wraps attributes (data) and

behaviors (methods or functions) into a single distinct entity. Objects are


instances of classes.

GO TO USER ROLES PAGE

The Unified Modelling Language 1.4


Structural Diagrams- class,object,component,deployment diagrams.
Behavioural Diagrams Use Case , Activity and State Chart diagrams.
Interaction Diagrams Sequence and Collaboration diagrams.

Use
Case
Use
Case
Sequence
Diagrams
Diagrams
Diagrams
Scenario
Scenario
Collaboration
Diagrams
Diagrams
Diagrams
Scenario
Scenario
Statechart
Diagrams
Diagrams
Diagrams

Use
Case
Use
UseCase
Case
Diagrams
Diagrams
Diagrams

State
State
Class
Diagrams
Diagrams
Diagrams

Models

Activity
Diagrams

State
State
Object
Diagrams
Diagrams
Diagrams
State
State
Component
Diagrams
Diagrams
Diagrams

Component
Component
Diagrams
Deployment
Diagrams

Diagrams

GO TO USER ROLES PAGE

USE CASE DIAGRAM


Outsider's view of a system.
Emphasizes on what a system does rather than how.
Use case diagrams are the collection of scenarios.
A scenario is an example of what happens when someone(Actor)

interacts with the system.

Scenarios together accomplishes a specific goal of the user.


Every use case diagram has actors, use cases, and communications.

GO TO USER ROLES PAGE

Use Case Modeling: Core Elements


10

Construct

Description

use case

A sequence of actions, including


variants, that a system (or other
entity) can perform, interacting with
actors of the system.
A coherent set of roles that users
of use cases play when interacting
with these use cases.

actor

system
boundary

Introduction to UML

Represents the boundary between


the physical system and the actors
who interact with the physical
system.

Syntax
U seC aseN am e

A c to rN a m e

GO TO USER ROLES PAGE

Use Case Modeling: Core Relationships


11

Construct

Description

The participation of an actor in a use


case. i.e., instance of an actor and
instances of a use case communicate
with each other.
extend
A relationship from an extension use
case to a base use case, specifying
how the behavior for the extension
use case can be inserted into the
behavior defined for the base use
case.
generalization A taxonomic relationship between a
more general use case and a more
specific use case.

Syntax

association

Introduction to UML

<<extend>>

GO TO USER ROLES PAGE

Use Case Modeling: Core Relationships (contd)


12

Construct

Description

include

An relationship from a base use case


to an inclusion use case, specifying
how the behavior for the inclusion use
case is inserted into the behavior
defined for the base use case.

Introduction to UML

Syntax
<<include>>

GO TO USER ROLES PAGE

Use Case Relationship

GO TO USER ROLES PAGE

Extend and Include Relationship


we can add extend relationships to a model to show the following situations:

A part of a use case that is optional system behavior


A subflow is executed only under certain conditions
A set of behavior segments that may be inserted in a base use case

Include Relationship

The behavior of the inclusion use case is common to two or more use cases.

The result of the behavior that the inclusion use case specifies, not the behavior itself,
is important to the base use case.

GO TO USER ROLES PAGE

Example :Use Case Diagram


15

Introduction to UML

GO TO USER ROLES PAGE

USE CASE DIAGRAM


Use case diagrams are helpful in three areas.
determining features (requirements).
New use cases often generate new requirements as the
system is analyzed and the design takes shape.
communicating with clients.
Their notational simplicity makes use case diagrams a good
way for developers to communicate with clients.
generating test cases.
The collection of scenarios for a use case may suggest a suite
of test cases for those scenarios.

GO TO USER ROLES PAGE

CLASS DIAGRAM
Structural overview of a system by showing its classes and the relationships

among them

Static diagrams

Static relations:

Associations

Subtypes
Static structure:

Attributes

Operations

Created along with use case diagrams


Transition from what? to How?

GO TO USER ROLES PAGE

CLASS DIAGRAM- Class


The illustration uses the following UML
conventions.
Static members are underlined. Instance
members are not.
The operations follow this form:
<access specifier> <name> ( <parameter list>) :
<return type>
The parameter list shows each parameter type
preceded by a colon.
Access specifiers appear in front of each
member.

GO TO USER ROLES PAGE

CLASS DIAGRAM

Class information: visibility and scope

Attributes and operations can be labeled according to access and


scope
Symbol
+
#

Access
public
private
protected

GO TO USER ROLES PAGE

Class Operations
An operation is the implementation of a service that can be requested from any

object of the class in order to affect behaviour.


Used to manipulate the attributes or to perform other actions.
Operations are normally called functions, but they are inside a class and can be

applied only to objects of that class.


Signature - return-type, a name and zero or more parameters.
The signature describes everything needed to use the operation.

GO TO USER ROLES PAGE

Example : Class Diagram

GO TO USER ROLES PAGE

Class-Association
Associations are structural relationships where instances (objects) of one class

are connected to instances (objects) of another class.

an employee works for a company


a company has a number of offices

An association is normally bidirectional, which means that if an object is

associated with another object, both objects are aware of each other (navigation
is bidirectional by default).
Binary association connects exactly two classes.
The most common association is just a connection between classes.

GO TO USER ROLES PAGE

Association adornments: name, role


The association has a name - the descriptive term, often a verb, for the

association.
Each association has two association ends; each end is attached to one of the
classes in the association. An end can be explicitly named with a label. This
label is called a role name (association ends are often called roles).

GO TO USER ROLES PAGE

Reflexive Associations
A class has an association to itself.

Example: A directory may contain other directories.


subdirectory
0..*

Directory

0..1
parent

0..*

File

GO TO USER ROLES PAGE

Class Navigability
A navigability arrow on an association shows which direction the association

can be traversed or queried.

GO TO USER ROLES PAGE

Class Associations: multiplicity


Multiplicity defines the number of

objects associated with an instance of


the association.

transports

Car

Person
passenger

Default of 1 (1: 1)

transports

Car

Person
passenger

0 or 1: 0..1
transports

Zero or more (0..infinite): *

Car

Person
passenger

transports

1 or more (1..infinite): 1..*


n..m; range from n to m inclusive

1..*

Car

Person
passenger

transports

2..5

Car

Person
passenger

GO TO USER ROLES PAGE

Class - Generalization
A specialization / generalization relationship, in which objects of the

specialized element (child) are substitutable for objects of the


generalized element (parent).

Superclass the generalization of another class, the child.


Subclass the specialization of another class, the parent.
Vehicle
venue

power
power

{overlapping}
WindPowered
Vehicle

Truck

venue

MotorPowered
Vehicle

Sailboat

{overlapping}
Land
Vehicle

Water
Vehicle

GO TO USER ROLES PAGE

Generalization - characteristics
Identify common features concerning behaviour and knowledge.

Define these common features on a higher level in the


inheritance hierarchy.

The aim is at behaviour more than knowledge when combining

classes.

Generalization is a bottom-up process.


A superclass includes all common properties of its subclasses.

GO TO USER ROLES PAGE

Specialization - characteristics

Define a new class which is a special appearance of an

existing class.

Specialization is a top-down process.


A subclass can have attributes and operations that are

specific for that sub-class.

A subclass may redefine operations of its super-class

GO TO USER ROLES PAGE

Class Diagram - Constraints

The basic constructs of association, attribute, and

generalization do much to specify important constraints.

They cannot indicate every constraint. These constraints

still need to be captured; the class diagram is a good place


to do that.

The UML allows you to use anything to describe

constraints. The only rule is that we put them inside braces


{ }.

GO TO USER ROLES PAGE

CONSTRAINTS

GO TO USER ROLES PAGE

Aggregation and Composition

Associations in which an object is part of a whole are aggregations.


Composition is a strong association in which the part can belong to
only one whole -- the part cannot exist without the whole. Composition
is denoted by a filled diamond at the whole end.

GO TO USER ROLES PAGE

Aggregation and Composition

GO TO USER ROLES PAGE

Alternative Notation for Composition

GO TO USER ROLES PAGE

Advanced Class Concepts : Abstract

An operation is abstract if it has no implementation.


A abstract class cannot have any direct instances.
Abstract classes only occur in the context of an inheritance

hierarchy.
Abstract operations and classes are specified by writing its

name in italics.

GO TO USER ROLES PAGE

Advanced Class Concepts : Abstract cont.

GO TO USER ROLES PAGE

Class Diagram with Interfaces

GO TO USER ROLES PAGE

Package Diagram
To simplify complex class diagrams, we can group classes into

packages. Packages.
Packages appear as rectangles with small tabs at the top.
The package name is on the tab or inside the rectangle.
The dotted arrows are dependencies.

GO TO USER ROLES PAGE

PACKAGE DIAGRAM

GO TO USER ROLES PAGE

Interaction : Sequence Diagram


Sequence diagrams and Collaboration diagrams
Class and object diagrams are static model views. Interaction

diagrams are dynamic. They describe how objects collaborate.

A sequence diagram is an interaction diagram that details how

operations are carried out -- what messages are sent and when.

Sequence diagrams are organized according to time. The time progresses

as we go down the page.

The Sequence diagram lists objects horizontally, and time vertically, and

models these messages over time.

GO TO USER ROLES PAGE

Sequence Diagram : Drawing Elements


Diagram Header Elements

Actor Represents an external person or entity that interacts with the system

Object Represents an object in the system or one of its components

Unit Represents a subsystem, component, unit, or other logical entity in the


system (may or may not be implemented by objects)

Separator Represents an interface or boundary between subsystems,


components or units (e.g., air interface, Internet, network)

Group Groups related header elements into subsystems or components being modeled and
are laid out horizontally at the top of the diagram.

GO TO USER ROLES PAGE

Sequence Diagram Body Elements


Message
Synchronous Message
Asynchronous Message
Create Message
Destroy Message
Action

GO TO USER ROLES PAGE

Sequence Diagram Body Elements

Block(Loop or Conditional)

Page Break
Return Message
Free Note
Flow Note
Diagram links

GO TO USER ROLES PAGE

Interaction : Sequence Diagram

GO TO USER ROLES PAGE

Sequence Diagram-Example

GO TO USER ROLES PAGE

GO TO USER ROLES PAGE

SEQUENCE DIAGRAM

GO TO USER ROLES PAGE

Usage of Sequence Diagram

Complex interactions between components

components are being developed in parallel by different teams

Supporting Robust interface covering multiple scenarios

Use case elaboration

can be used to flesh out the details of one or more use cases

GO TO USER ROLES PAGE

COLLABORATION DIAGRAM
Type of an interaction diagram.
Collaborates the static and dynamic relationship
Focus on Object Roles rather than timing.
Each message in a collaboration diagram has a sequence number.
The Collaboration diagram may be used to:

Describe a specific scenario by depicting the movement of messages between the objects

Show a spatial organization of objects and their interactions, rather than the sequence of
the interactions

GO TO USER ROLES PAGE

COLLABORATION DIAGRAM

GO TO USER ROLES PAGE

Sequence Diagram

Reserving a copy of book in Library

GO TO USER ROLES PAGE

Collaboration Diagram
Reserving a copy of book in Library

GO TO USER ROLES PAGE

STATE CHART DIAGRAM


Objects have behaviors and state.
The state of an object depends on its current activity or condition.
A statechart diagram shows the possible states of the object and the

transitions that cause a change in state.

Our example diagram models the login part of an online banking system.

Logging in consists of entering a valid social security number and personal id


number, then submitting the information for validation.

Logging in can be factored into four non-overlapping states: Getting SSN,

Getting PIN, Validating, and Rejecting. From each state comes a complete
set of transitions that determine the subsequent state.

GO TO USER ROLES PAGE

State Chart Diagram Dial Tone

GO TO USER ROLES PAGE

STATE CHART DIAGRAM - Login

GO TO USER ROLES PAGE

STATE CHART DIAGRAM


States are rounded rectangles.
Transitions are arrows from one state to another.
Events or conditions that trigger transitions are written

beside the arrows.

Uses
The life history of a given class, usecase, operation
The events that cause a transition from one state to another
The actions that result from a state change

GO TO USER ROLES PAGE

ACTIVITY DIAGRAM
An activity diagram is essentially a fancy flowchart.
Activity diagrams and statechart diagrams are related.
Statechart diagram focuses attention on an object

undergoing a process (or on a process as an object).

An activity diagram focuses on the flow of activities

involved in a single process. The activity diagram shows the


how those activities depend on one another.

Element and its description


Initial Activity: This shows the starting point or first activity of
the flow.
Activity: Represented by a rectangle with rounded (almost oval)
edges.

Decisions: Similar to flowcharts.


Signal: When an activity sends or receives a message, that activity
is called a signal. Signals are of two types: Input signal (Message
receiving activity) shown by a concave polygon and Output signal
(Message sending activity) shown by a convex polygon.
Concurrent Activities: Some activities occur simultaneously or
in parallel. Such activities are called concurrent activities. For
example, listening to the lecturer and looking at the blackboard is a
parallel activity. This is represented by a horizontal split (thick dark
line) and the two concurrent activities next to each other, and the
horizontal line again to show the end of the parallel activity.

Final Activity: The end of the Activity diagram is shown by a


bull's eye symbol, also called as a final activity.

Symbol
GO TO USER
ROLES PAGE

GO TO USER ROLES PAGE

ACTIVITY DIAGRAM

GO TO USER ROLES PAGE

Activity Diagram - Example

GO TO USER ROLES PAGE

Implementation diagrams

Show aspects of model implementation, including source

code structure and run-time implementation structure


Kinds
component diagram
deployment diagram

GO TO USER ROLES PAGE

Component Diagram
62

Shows the organizations and dependencies among software

components
Components include

source code components


binary code components
executable components

Introduction to UML

GO TO USER ROLES PAGE

Elements of component diagram


Element and its description

Component: The objects interacting with


each other in the system. Depicted by a
rectangle with the name of the object in it,
preceded by a colon and underlined.
Class/Interface/Object: Similar to the
notations used in class and object diagrams
Realization/Association: Similar to the
relation/association used in class diagrams

Symbol

GO TO USER ROLES PAGE

Component Diagram

Deployment Diagram

GO TO USER ROLES PAGE

65

Shows the configuration of run-time processing

elements and the software components, processes


and objects that live on them
Deployment diagrams may be used to show which

components may run on which nodes

Introduction to UML

GO TO USER ROLES PAGE

Deployment Diagram

GO TO USER ROLES PAGE

The Current Official UML Specification:

The current official version of UML and its associated specifications can be
downloaded from OMG Specifications Catalog page for Modeling and Metadata
Specifications at

http://www.omg.org/technology/documents/modeling_spec_catalo
g.htm#UML

GO TO USER ROLES PAGE

UML Certification

OCUP
OMG Certified UML Professional
Three Certification Levels:

OCUP Fundamental
OCUP Intermediate
OCUP Advanced

Link : http://www.omg.org/uml-certification/

GO TO USER ROLES PAGE

References
Web References :

http://www.uml.org/

http://dn.codegear.com/article/31863

http://www-128.ibm.com/developerworks/rational/library/3101.html

http://www.andrew.cmu.edu/course/90-754/umlucdfaq.html

Book References :

UML Distilled by Martin Fowler with kendall Scott, Pearson Education.

User Guide for UML by Grady Booch, Ivar Jacobson and James Rumbaugh

Thank You

Anda mungkin juga menyukai