0% found this document useful (0 votes)
61 views83 pages

Uml2 5

The document provides an overview of Object-Oriented Programming (OOP) concepts and the Unified Modeling Language (UML), detailing definitions of objects, classes, encapsulation, polymorphism, and various types of operations. It explains the structure and behavioral diagrams in UML, use case diagrams, and class diagrams, including elements like associations, properties, and operations. Additionally, it discusses the significance of metamodeling and the role of UML in modeling software applications.

Uploaded by

Kushner Serge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views83 pages

Uml2 5

The document provides an overview of Object-Oriented Programming (OOP) concepts and the Unified Modeling Language (UML), detailing definitions of objects, classes, encapsulation, polymorphism, and various types of operations. It explains the structure and behavioral diagrams in UML, use case diagrams, and class diagrams, including elements like associations, properties, and operations. Additionally, it discusses the significance of metamodeling and the role of UML in modeling software applications.

Uploaded by

Kushner Serge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 83

Unified Modeling UML

Language
Object Oriented Programming
Concepts

• Object definition
• Entity role defined in the system
• Characterized by: state, behavior and identity
• concrete/abstract
• an action can be undertaken
• can perform an action
Object Oriented Programming
Concepts

Object state Object behavior


• The actual values of object’s • Shows the way in which an
properties at a certain object reacts to events
moment in time • Shall be submitted by means
of operations that change its
status
Object Oriented Programming
Concepts

Operation • a simple action that an object a is running on another object to get an answer

Methods • all the operations an object can perform or be performed on that object,
implemented in a programming language

Identity • all objects have identity


• even if they have the same values of attributes, they denote different objects
Object Oriented Programming
Concepts

Classses
• a set of objects with common structure and behavior
• objects are classes instances

Encapsulation
• operations form the interface of a class
• through the interface, a class presents other classes its functionality without showing its structure
• hiding the details of implementation is called encapsulation:
• storage structure
• implementation of the operations (you know what, you do not know how)
Object Oriented Programming
Concepts

• Polymorphism
• the same message to more than one class of objects, generates different responses
with different meanings.
• Ex. redefine methods in derived classes
Object Oriented Programming
Concepts

• Types of operations
• Constructor - creates a new instance of the object, a new object of the class
• Destructor – destroys the object
• Getters –Retrieval - do not alter the status of the article; retrieving attribute values
• Setters - Update – alter the status of the object
Object Oriented Programming
Concepts

Links

• a connection between objects

Association

• description of a group of links with the same structure and semantics


• abstraction of links to associations, similar to abstract classes of objects
• links between objects are instances of association between two classes
Object Oriented Programming
Concepts

• Abstract classes
• Classes constructed specifically to be inherited
• Contain abstract operations, i.e. whose implementation is mandatory in child classes
• parents-Jacobson, Booch and Rumbaugh
• adopted as standard by the Object
Management Group (OMG)
• used for modeling object oriented systems,
Unified by means of a standard set of diagrams
and notation
Modeling • visual modeling language intended for
• View
Language - • The Specification Of
Introduction • Construction
• Documentation
• … of Systems in general and in this
particular case of software applications
Unified Modeling Language - Introduction
UML - Introduction

Structure Diagrams show: Behavioral Diagrams show:


• Static aspects • Dynamic aspects that change
• Time is irrelevant over time
• Components and how are they • Collaborations, flows, states
related • Components and how they
work
UML - Introduction

Model

• diagrams + documentation
• abstraction of phenomena in the real world (read software system)

Diagrams

• Structural
• static view: objects, attributes, operations, relationships
• Behavioral
• dynamic view; collaboration, changes in internal states
• Interaction diagrams
• subset of behavioral
• flow control and data
UML - Introduction

Metamodeling

• construction of a framework for modeling (model of a model)

Metalanguage

• UML standard is specified using UML language


UML – Use Case Diagram

provides means for specifying used to capture the show what a system is
required usages of a system. requirements of a system supposed to do.
Key Concepts

actors

UML –
Use Case use cases
Diagram
the Subject
• the system under consideration
to which the use cases apply.
UML – Use Case Diagram

any other systems obtain an useful


the users of the
that may interact result from the
system
with the system system

Actors
UML – Use Case Diagram

The required behavior of the subject is specified by one or more use cases, which are
defined according to the needs of actors.

Use case:
• Specifies the behavior of a part of the system
• Description of a set of actions that produce a result that is relevant to an actor
• For example: log in, update, view products, etc.
• refers to a use case type
• an instance of a use case refers to an occurrence of the behavior
UML – Use Case Diagram
Generic Use Case Diagram
Associations

Communicate association:
Shows the participation of an actor to a use case

UML –
Use Case
Diagram
Include association
necessarily, a case of use the behavior of the
must include the behavior included use case is
<<include> stereotype
of another use case inserted into the behavior
(always) of the including use case
Extends association
<<extends>> stereotype

Optionally, under certain conditions, a case of use must include


the behavior of another use case

the behavior of a use case may be extended by the behavior of


UML – Use another use case

Case extension takes place at one or more specific extension points


defined in the extended use case

Diagram shows the dependency between the extended and the


extending use case

the same extending use case can extend more than one use
case

If the condition of the extension is true then the behavior of the


extending use case will also be executed
UML – Use Case Diagram

• Extension point
• a point in the behavior of a use case where that behavior can be extended by the
behavior of some other (extending) use case, as specified by an extend relationship.
• A condition that is evaluated in the extended use case
UML – Use Case Diagram

Use case scenario


• An instance of a use case
• Text information on the events and the replies received to produce use case

Specifying a use-case scenario


• Requirements-what you need to obtain as a result of use
• Restrictions
• Basic Conditions
• Post - conditions
• Invariants
• Scenarios – formal descriptions of the sequence of events
UML – Use Case Diagram – Real Life Example
UML – Use Case Diagram – Real Life
Example
IMS Voice

MRF
CSCF/ Announcements
<<extend>>
IMS Core Localization
<<extend>> MNP
<<extend>>
update gsmSRF/
Voice CC assisting SSF
HLR <<include>>
Portability
<<extend>>
<<extend>>
<<include>> MNPDB
Camel Voice CC <<include>>
MNP cache
<<extend>> <<extend>>
VMSC/GMSC
VMAT Rerouting Credit Control/ MySql
Charging Gateway
<<include>> <<include>>

SMS CC <<include>> Online Charging


<<extend>>
<<extend>>

SMSC OCS
MMS CC Bypass

<<include>>

Offline Charging Mediation Zone


Mediation Zone/ Configuration
MMSC
Monitoring
O&M SLEE Facilities
Logging
OSS
Configuration

MySql MVNO
UML – Exercise 1

Use provided UML tool


Work in small teams
(Eclipse Papyrus) or similar

Create use case diagram Send diagram to:


for a system of choice [email protected]
UML – Class
Diagram
UML – Class
Diagram
• Elements building up the class diagram (as per
UML standard):
• Classes
• Properties
• Operations
• Associations
• Classes have (as we know from OOP):
• Attributes
• Operations
• participate in inheritance hierarchies
• Multiple inheritance is allowed.
• Class characteristics:
• The instances of a class are objects
• an abstract class cannot have any direct instances
• Any direct instance of a concrete class is also an
indirect instance of its class’ superclasses.

UML – Class • An object has a slot for each of its class’s direct
and inherited attributes.
• An object permits the invocation of operations
Diagram defined in its class and its class’superclasses
• The context of such an invocation is the invoked object.
• A class cannot access private features of another
class, or protected features on another class that
is not its supertype.
• When creating and deleting associations, at least
one end must allow access to the class.
UML – Class Diagram

• Class attributes:
• isAbstract : Boolean
• ownedAttribute : Property [*] the attributes owned by a class; these do not include the
inherited attributes. Attributes are represented by instances of Property. Property is also a
construct of UML meta description
• ownedOperation : Operation [*] - the operations owned by a class; these do not include
the inherited operations.
• superClass : Class[*] the immediate superclasses of a class, from which the class inherits.
UML – Class Diagram

Operation:
• is owned by a class and may be invoked in the context of objects that are instances of that class.
• It is a typed element and a multiplicity element

Operation attributes:
• class : Class [0..1] the class that owns the operation.
• ownedParameter : Parameter [*] {ordered, composite } the parameters to the operation.
• raisedException : Type [*] the exceptions that are declared as possible during an invocation of
the operation.
UML – Class Diagram

Operation representation is:


• [<visibility>] <name> ‘(‘ [<parameter-list>] ‘)’ [‘:’ [<return-type>] [‘[‘ <multiplicity> ‘]’]
• [‘{‘ <oper-property> [‘,’ <oper-property>]* ‘}’]]

where:
• <visibility> the visibility of the operation (+public, -private, #protected,~package)
• <name> the name of the operation.
• <return-type> is the type of the return result parameter if the operation has one defined.
• <multiplicity> is the multiplicity of the return type
• <oper-property> indicates the properties of the operation
UML – Class Diagram

<oper-property> ::= ‘redefines’ <oper-name> | ‘query’ | ‘ordered’ | ‘unique’ | <oper-constraint>

where:

• redefines <oper-name> means that the operation redefines an inherited operation identified by <oper-name>.
• query means that the operation does not change the state of the system.
• ordered means that the values of the return parameter are ordered.
• unique means that the values returned by the parameter have no duplicates.
• <oper-constraint> is a constraint that applies to the operation.

<parameter-list>

• list of parameters of the operation in the following format:


• <parameter-list> ::= <parameter> [‘,’<parameter>]*
UML – Class Diagram

<parameter> ::= [<direction>] <parameter-name> ‘:’ <type-expression>

[‘[‘<multiplicity>’]’] [‘=’ <default>] [‘{‘ <parm-property> [‘,’ <parm-property>]* ‘}’]


• where:
• <direction> ::= ‘in’ | ‘out’ | ‘inout’ (defaults to ‘in’ if omitted).
• <parameter-name> is the name of the parameter.
• <type-expression> is an expression that specifies the type of the parameter.
• <multiplicity> is the multiplicity of the parameter
• <default> is an expression that defines the value specification for the default value of the parameter.
• <parm-property> indicates additional property values that apply to the parameter.
UML – Class Diagram

• Operation call concurrency:


• Sequential – only one thread executes the operation at a time
• Guarded – multiple calls can be made from different threads but only one executes at
a time, others are waiting in queue
• Concurrent – many calls from different threads can occur simultaneously
UML – Class Diagram

Property
• An attribute of a classifier or an association end

Property attributes:
• class : Class [0..1] class that owns the property, and of which the property is an attribute.
• default : String [0..1] string that is evaluated to give a default value for the attribute when an object of the owning class is instantiated.
• isComposite : Boolean - If isComposite is true, the object containing the attribute is a container for the object or value contained in the
attribute. The default value is false.
• isDerived : Boolean - If isDerived is true, the value of the attribute is derived from information elsewhere. The default value is false.
• isReadOnly : Boolean - If isReadOnly is true, the attribute may not be written to after initialization. The default value is false.
• isID : Boolean - True indicates this property can be used to uniquely identify an instance of the containing Class. Default value is false.
UML – Class Diagram

• The properties and the operations inherit the feature property isStatic:
• true – scope at classifier level
• false – scope at instance level
UML – Class Diagram

• Properties representation is, in a shorter form:


• [visibility][multiplicity][:type][=default value][(properties)]
• Associations between classes:
• connections between classes
• Association characteristics:
• name of the association:
• verb denoting an action
• example: contains, uses, holds
• Multiplicity
• the number of instances of a class that can be related to an instance of the other class in the

UML – Class
association
• type, given by the number of participating classes:
• unary

Diagram
• binary
• ternary
• role
• a label for the class inside the association
• what the class signifies
• a class with more than one association can play different roles to each of the classes it is
associated to
• aggregation
• shared – the shared aggregation end classifier is needed in order to perform an action but
can be shared
• composite – the composite end classifier is part of the classifier
UML – Class Diagram

• An association with one end marked by a navigability arrow means that:


• the association is navigable in the direction of that end
• the marked association end is owned by the classifier
• the opposite (unmarked) association end is owned by the association.
UML – Class Diagram

• An association with neither end marked by navigability arrows means that:


• the association is navigable in both directions,
• each association end is owned by the classifier at the opposite end (i.e., neither end is
owned by the association).
UML – Class Diagram

• If no multiplicity is shown on an association end, it implies a multiplicity of exactly 1.


• If an association end is unlabeled, the default name for that end is the name of the class to
which the end is attached,with the first letter is a lowercase letter.
UML – Class Diagram

• Associations that are not explicitly named, are given names that are constructed according
to the following production rule:
• “A_” <association-end-name1> “_” <association-end-name2>
• where <association-end-name1> is the name of the first association end and
<association-end-name2> is the name of the second association end.
UML – Class
Diagram

• Generalization:
• Relationship between general and
specific classifiers
• Extraction of common properties and
operations from multiple classes and
their isolation in superclasses
• A<-B<-C is transitive; C “is an” A
UML – Class
Diagram

• Dependency
• Relationship showing that an element
(class but not restricted to) requires
another element in order to:
• Be defined
• Implement a certain behavior
• Mostly having the “ use “ meaning
UML – Class
Diagram

• Template classes
• An instance of a template class is a
concrete class.
UML – Class
Diagram

• Interfaces:
• set that groups together operations
defining a service of a component
(class)
• Do not have attributes
UML – Class Diagram
UML – Class Diagram – Mapping to
Java Classes
public class A1 extends B1 {
public class A3 {
public Object Attribute2;
public B3 b3;
public void Operation2() {
}
} public class B3 {
} }
public class B1 { public class B4 {
public Object Attribute1; }
public void Operation1() {
public class A5 {

} public B5[] b5;


} }
public class A2 { public class B5 {
private B2 b2; public A5 a5;
} }
public class B2 {
public A2 a2;
}
UML – Class Diagram
UML – Class Diagram
Keep the instances of the elements
contained in the class diagrams

Represents a snapshot of the system at a


UML – time

Object
Diagram Classes define the full semantics of
abstractions

helps the understanding of the


relationship between classes and
validation of the model
UML – Object
Diagram
UML – Package
Diagram

• In order to simplify complex diagrams, you can group classes in


packages.
UML – Package Diagram

• Package:
• A collection of elements in UML related from logical point of view
• Groups: classes, interfaces, components, nodes, use cases, the other packages
• It is recommended that a hierarchy on a small number of levels
• You can control the visibility of elements by attributes at package level
UML – Package
Diagram

• Relationships between packages:


• Dependencies – elements
from one package are used
by elements from other
package
• Generalization - Specialized
packages inherit public and
protected elements from
the more general package
UML – Sequence
Diagram

• Describes the interaction


between objects, ordered in
time
• Graphical representation of
scenarios use cases
Object lifeline - Shows how long an
object exists

UML –
Some objects may be destroyed
Sequence during the interaction
Diagram
Control points – Rectangles that
indicates the period of time as the
subject does an action
Lifeline:
• Represents an instance of the classifier involved in
the interaction
• Object name : class name
• Object name can be omitted – anonymous
UML – Gates:
Sequence • entry or exit points for messages going in or out the

Diagram modeled interaction

Types of messages:
• Synchronous calls
• Asynchronous calls
• Messages for object creation/deletion
• Returns
UML – Sequence
Diagram

• Combined fragments:
• Contain conditional
structures that affect the
flow of messages
UML – Sequence Diagram - Example
UML – Communication Diagram

• Collaboration diagrams/Communication diagrams


• contain the same information as sequence diag.
• focuses on the roles of objects and not when they interact
• graph with nodes-objects and edges-messages
UML – Communication Diagram
a collaboration diagram is easily obtained from the corresponding sequence diagram
UML – State Machine Diagram

• UML 2.4+ introduces State Machine Diagram, previously being State Diagram
• State Machine Diagram
• Describes the behavior of a modeled system/system part/component as a series of
states
• shows the status and the events that produce the changing status of an object
• a graph made up of nodes and edges
• a state machine is owned by a context; the context supports the triggers and
operations available for state machine activities
UML – State Machine Diagram

• Types:
• Behavioral State Machines:
• describes the behavior of a modeled element in terms of states
• Protocol State Machines:
• a specialization of behavioral state machines
• dedicated to showing how should a classifier be used throughout its lifecycle
• what operations can be called in which state (usage protocol)
• Nodes and edges:
• State
• a condition or situation in the life of an object when it
meets certain conditions, carries out certain tasks or
wait for certain events
• Behavioral State:
• Name

UML – State • Internal activities: Actions carried out at the


entrance/exit of a State, or do – throughout the

Machine
state
• Internal transitions – does not change the status
of ob.
Diagram • disjoint or competing substates
• Deferred events – list of candidate triggers; if
the current state is not able to handle the event
yet, it is postponed, until a state is able to handle
it
• Protocol State:
• Name
• Don’t have: entry, exit, do activity
• May have: submachine states, composites
UML – State Machine Diagram

Composite State: Initial state Final state


• Nested states that can be: • Pseudo state associated • State machine finished
• A list of sequential states with the creation of the execution
• Concurrent states state machine • State machine is
(orthogonal) – mutually • Single transitions to the terminated (objects
exclusive first default state destroyed)
• Grouped in regions
UML – State Machine Diagram

Choice • Branch based on condition


• Evaluates the guards of the outgoing triggers and chooses which should be fired

Fork • Split a transition into more transitions


• The branches are executed concurrently

Join • Merges parallel state machine executions when concurrent regions trigger
specified events
• Transition –
• Edge showing movement of an object from a source
state to a destination state
• Elements of a behavioral transition
• Source State
• trigger event: signals, calls, the passage of time,
without shutter (implicates)
UML – State • guard: Boolean expression that is evaluated
• behavior expression – action/atomic operation
Machine acting on the object or other objects visible
(operation calls, creating/destroying items,
Diagram sending a signal) executed on transition
• Destination state
• Protocol transition:
• Associated with operation call in the context that
depends on current state
• Pre-condition
• Trigger
• Post-condition
UML – State Machine Diagram
UML – State Machine Diagram
Protocol State Machine
INIT
/start_monitoring()

Session Testing
/analyze()

Analyzing CALL_DISALLOWED/release_call()
SM_FAILED/notify_sm_failed() SM_TIMER/check_session()
MALFORMED_REQUEST/abort()

CALL_ALLOWED[MO|MF]/check_portability()
Releasing Call

UML State
MNP_QUERY_FAILED[release]/
release_call()
CALL_ALLOWED[MT]
Checking portability

MNP_QUERY_SUCCESS | AUTHORIZATION_FAILED

Machine
MNP_QUERY_FAILED[continue] ANNOUNCEMENT_RELEASE_CALL |
/authorize() ANNOUNCEMENT_FAILURE | DISCONNECT

Authorizing
Playing
PLAY_ANNOUNCEMENT
Announcement

Diagram AUTHORIZATION_SUCCESSFUL/setup_call()

Establishing
wait_events()
ANNOUNCEMENT_CONTINUE/setup_call()
AUTHORIZATION_FAILED

SM_FINISH/stop_monitoring()

CALL_RELEASED/close()

Real life example


ANSWER
AUTHORIZATION_SUCCESSFUL/update_call()

Ongoing CHARGING_REPORT[callActive=true]/
Reauthorizing
reauthorize()
wait_events()

DISCONNECT | CHARGING_REPORT[callActive=false]/close()

BUSY|NO_ANSWER|ABANDON
ROUTE_SELECT_FAILURE/close() Closing
UML – Activity Diagram

• Describes behavior in term of flow of actions


• Flowchart like
• Shows control flows
Activity diagram elements:

Swimlanes for each classifier


Activity partitions: group activities under the responsibility of the
classifier

Actions produced a single transition to the next action

UML – Control flow Transition from an action to another

Activity A transition can branch out into 2 or more mutually exclusive

Diagram transitions

Fork - an alternative way of Boolean condition-based

Join – when there are competing streams join

Decision nodes
UML –
Activity
Diagram
UML – Components Diagram

• Components diagram
• Describes system
components and their
relationship.
• Shows how the
components connect
with each other via
interfaces
Physical or logical components of the
system

Components Components are classifiers therefore


static description applies to them:
attributes, operations, dependencies,
etc.

A communication gateway with other


Ports components

UML –
Componen Connectors Show strong coupling between
connected elements

ts Diagram
Parts Reusable elements

Provided
Required
Interfaces Another implementation exposing or
consuming the interface may replace
the existing one
UML – Components Diagram
UML - Deployment Diagram

• Shows static aspects related to the deployment of artifacts on nodes.


• Node (device):
• Hardware: physical server
• Execution environment
• Software: e.g. JBoss container
• Artifact:
• Output of the development process
• Binary packages, configuration files, etc.
• Manifestation of components (e.g. log, statistics etc.)
UML - Deployment Diagram
UML – Composite Structure Diagram

Shows Contains
• whole – part relationship • Classes
between classifiers • Collaborations
• internal structure • Connectors
• collaborations between • Ports
elements
UML – Composite Structure Diagram
UML - Exercise 2
UML – Exercise 1

Use provided UML tool (Eclipse


Work in small teams
Papyrus) or similar

Detail one of the use cases


identified in Exercise 1 using the Send diagram to:
behavioral diagram that you [email protected]
consider most fit for the purpose

You might also like