Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

5 Uml

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

INTRODUCTION TO UML

Contents
UNIFIED MODELLING LANGUAGE (UML) ............................................................................................... 2
BUILDING BLOCKS OF UML ................................................................................................................... 2
(1)THINGS ................................................................................................................................................ 2
 Structural things:.............................................................................................................................. 2
 Behavioral things: ............................................................................................................................ 3
 Grouping things: .............................................................................................................................. 4
 Annotational things: ........................................................................................................................ 4
Note: ........................................................................................................................................................... 4
(2) Relationship :............................................................................................................................................ 4
Dependency: .............................................................................................................................................. 4
Association:................................................................................................................................................ 5
Generalization: ........................................................................................................................................... 5
Realization: ................................................................................................................................................ 5
(3) UML Diagrams: ....................................................................................................................................... 5
COMMON MECHANISMS IN UML .......................................................................................................... 6
1. Specifications ............................................................................................................................................. 6
2. Common Divisions .................................................................................................................................... 6
3. Adornments ................................................................................................................................................ 6
4. Extensibility Mechanisms .......................................................................................................................... 7
Stereotypes ..................................................................................................................................................... 7
Tagged Values ............................................................................................................................................... 7
Constraints ..................................................................................................................................................... 8

PREPARED BY: PRAMOD MATHEW JACOB 1


INTRODUCTION TO UML

5. UNIFIED MODELLING LANGUAGE (UML)


 UML is a standard language for specifying, visualizing, constructing, and documenting the artefacts
of software systems.
 UML was created by Object Management Group (OMG) and UML 1.0 specification draft was
proposed to the OMG in January 1997.
 UML is a modelling language used to model software and non- software systems.
 Although UML is used for non- software systems the emphasis is on modelling object oriented
software applications. Most of the UML diagrams discussed so far are used to model different aspects
like static, dynamic etc.

BUILDING BLOCKS OF UML

 The building blocks of UML can be defined as:

 Things
 Relationships
 Diagrams

(1)THINGS

Things are the most important building blocks of UML. Things can be:

 Structural
 Behavioral
 Grouping
 Annotational

 Structural things:

The Structural things define the static part of the model. They represent physical and conceptual
elements. Following are the brief descriptions of the structural things.

Class: Class represents set of objects having similar responsibilities.

PREPARED BY: PRAMOD MATHEW JACOB 2


INTRODUCTION TO UML

Interface: Interface defines a set of operations which specify the responsibility of a class.

or IInterface

Collaboration: Collaboration defines interaction between elements.

Chain of
or responsibilites

Use case: Use case represents a set of actions performed by a system for a specific goal.

Component: Component describes any physical or replaceable part of a system.

Node: A node can be defined as a physical element that exists at run time which possess a limited
memory and processing capability

 Behavioral things:

A behavioral thing consists of the dynamic parts of UML models. Following are the behavioral
things:

Interaction:Interaction is defined as a behavior that consists of a group of messages exchanged


among elements to accomplish a specific task.

PREPARED BY: PRAMOD MATHEW JACOB 3


INTRODUCTION TO UML

State machine: State machine is useful when the state of an object in its life cycle is important. It
defines the sequence of states an object goes through in response to events. Events are external factors
responsible for state change.

 Grouping things:

Grouping things can be defined as a mechanism to group elements of a UML model together. There
is only one grouping thing available:

Package:Package is the only one grouping thing available for gathering structural and behavioural
things.

 Annotational things:

Annotational things can be defined as a mechanism to capture remarks, descriptions, and comments
of UML model elements. Note is the only one Annotational thing available.

Note: A note is used to render comments, constraints etc. of an UML element.

(2) Relationship :

Relationship is another most important building block of UML. It shows how elements are associated with
each other and this association describes the functionality of an application.

There are four kinds of relationships available.

Dependency:
Dependency is a relationship between two things in which change in one element also affects the other one.

PREPARED BY: PRAMOD MATHEW JACOB 4


INTRODUCTION TO UML

Association:
Association is basically a set of links that connects elements of an UML model. It also describes how many
objects are taking part in that relationship.

Generalization:
Generalization can be defined as a relationship which connects a specialized element with a generalized
element. It basically describes inheritance relationship in the world of objects.

Realization:
Realization can be defined as a relationship in which two elements are connected. One element describes some
responsibility which is not implemented and the other one implements them. This relationship exists in case
of interfaces.

(3) UML Diagrams:

 UML diagrams are the ultimate output of the entire discussion. All the elements, relationships are
used to make a complete UML diagram and the diagram represents a system.
 The visual effect of the UML diagram is the most important part of the entire process. All the other
elements are used to make it a complete one.
 Various diagrams in UML are listed below:

1. Class diagram – A class diagram shows a set of classes, interfaces and collaborations and their
relationships.
2. Object diagram – An object diagram shows a set of objects and their relationships.
3. Use case diagram – A use-case diagram shows a set of use cases and actors and their relationships
4. Sequence diagram – A sequence diagram is an interaction diagram that emphasizes the time –ordering
of messages.
5. Collaboration diagram – A collaboration diagram is an interaction diagram that emphasizes the
structural organisation of the objects that send and receive messages.
6. Activity diagram – An activity diagram is a special kind of state-chart diagram that shows the flow
from activity to activity within a system.
7. State-chart diagram – A state-chart diagram shows a state machine, consisting of states, transitions,
events and activities.
8. Deployment diagram – A deployment diagram shows the configuration of run time processing nodes
and the components that live on them.
9. Component diagram – A component diagram shows the organisation and dependencies among a set
of components.

PREPARED BY: PRAMOD MATHEW JACOB 5


INTRODUCTION TO UML

COMMON MECHANISMS IN UML


 The UML is made simpler by the presence of four common mechanisms that apply throughout the
language: specifications, adornments, common divisions, and extensibility mechanisms.

1. Specifications
 By using a specification, we can easily specify something in a bit more detail so that the role and
meaning of the term being specified is presented to us in a more clear and concise manner.
 For example, we can give a class a rich specification by defining a full set of attributes, operations,
full signatures, and behaviours. The developer will then have a clearer notion of what the capabilities
and limitations of that class are.
 Specifications can be included in the class, or specified separately.

2. Common Divisions
 Common divisions are used in order to distinguish between two things that might appear to be quite
similar, or closely related to one another. There exist two main common divisions: abstraction vs.
manifestation and interface vs. implementation.
 The distinction between a class and an object is an example of common division in UML, where the
class is an abstraction and the object is a clear manifestation of that class. Most UML building blocks
have this kind of class/object distinction, e.g. use case, use case instance etc.
 In the second common division – interface vs. implementation – we say that an interface declares
some kind of contract, or agreement, whereas an implementation represents one concrete realisation
of that contract. The implementation is then responsible for carrying out the interface.

3. Adornments
 Adornments are textual or graphical items, which can be added to the basic notation of a UML
building block in order to visualise some details from that element’s specification.
 For example an abstract class consist of a public, private and protected operations, then it can be
represented as follows: + denotes public, # denotes protected and – denotes private.

 For example, let us consider association, which in its most simple notation consists of one single
line. Now, this can be adorned with some additional details, such as the role and the multiplicity of
each end as shown below.
0.1 *
Employer employee

PREPARED BY: PRAMOD MATHEW JACOB 6


INTRODUCTION TO UML

4. Extensibility Mechanisms
 The extensibility mechanisms allow you to customize and extend the UML by adding new building
blocks, creating new properties, and specifying new semantics in order to make the language suitable
for your specific problem domain. There are three common extensibility mechanisms that are
defined by the UML: stereotypes, tagged values, and constraints.

Stereotypes
 Stereotypes allow you to extend the vocabulary of the UML so that you can create new model
elements, derived from existing ones, but that have specific properties that are suitable for your
problem domain.
 They are used for classifying or marking the UML building blocks in order to introduce new building
blocks that speak the language of your domain and that look like primitive, or basic, model elements.
 For example, when modelling a network you might need to have symbols for representing routers
and hubs. By using stereotyped nodes you can make these things appear as primitive building blocks.
 As another example, let us consider exception classes in Java or C++, which you might sometimes
have to model. Ideally you would only want to allow them to be thrown and caught, nothing else.
Now, by marking them with a suitable stereotype you can make these classes into first class citizens
in your model; in other words, you make them appear as basic building blocks.
 Stereotypes also allow you to introduce new graphical symbols for providing visual cues to the
models that speak the vocabulary of your specific domain (see fig 4).
 Graphically, a stereotype is rendered as a name enclosed by guillemots and placed above the name
of another element (see fig 3). Alternatively, you can render the stereotyped element by using a new
icon associated with that stereotype (see fig 4).

<<metaclass>>
Model Element
<<exceptions>>
Underflow
Fig 3. Named stereotype Fig 4. Named stereotype Fig 5. Stereotyped element
with icon as icon

Tagged Values
 Tagged values are properties for specifying keyword-value pairs of model elements, where the
keywords are attributes. They allow you to extend the properties of a UML building block so that
you create new information in the specification of that element.

PREPARED BY: PRAMOD MATHEW JACOB 7


INTRODUCTION TO UML

 Tagged values can be defined for existing model elements, or for individual stereotypes, so that
everything with that stereotype has that tagged value.
 It is important to mention that a tagged value is not equal to a class attribute. Instead, you can regard
a tagged value as being a metadata, since its value applies to the element itself and not to its
instances.
 One of the most common uses of a tagged value is to specify properties that are relevant to code
generation or configuration management. So, for example, you can make use of a tagged value in
order to specify the programming language to which you map a particular class, or you can use it to
denote the author and the version of a component.
 As another example of where tagged values can be useful, consider the release team of a project,
which is responsible for assembling, testing, and deploying releases. In such a case it might be
feasible to keep track of the version number and test results for each main subsystem, and so one
way of adding this information to the models is to use tagged values.
 Graphically, a tagged value is rendered as a string enclosed by brackets, which is placed below the
name of another model element. The string consists of a name (the tag), a separator (the symbol =),
and a value (of the tag) (see fig 6).

Server
{processors=3}

Fig 6. Tagged Value


Constraints
 Constraints are properties for specifying semantics and/or conditions that must be held true at all
times for the elements of a model. They allow you to extend the semantics of a UML building block
by adding new rules, or modifying existing ones.
 For example, when modelling hard real time systems it could be useful to adorn the models with
some additional information, such as time budgets and deadlines. By making use of constraints these
timing requirements can easily be captured.
 Graphically, a constraint is rendered as a string enclosed by brackets, which is placed near the
associated element(s), or connected to the element(s) by dependency relationships. This notation
can also be used to adorn a model element’s basic notation, in order to visualise parts of an element’s
specification that have no graphical cue.

PREPARED BY: PRAMOD MATHEW JACOB 8

You might also like