Basic Uml
Basic Uml
Contents
Why model ?
Principles of modeling
What is UML ? Conceptual Model of the UML Building Blocks Rules Common Mechanisms
Introduction to UML
Why Model ?
Analyse
the problem-domain simplify reality capture requirements visualize the system in its entirety specify the structure and/or behaviour of the system the solution document the solution - in terms of its structure, behaviour, etc.
Introduction to UML
3
Design
Principles of Modeling
Choose
impacts the analysis of the problem and the design of the solution.
Every
model may be expressed at different levels of precision - the same model can be scaled up (or down) to
different granularities.
The
Introduction to UML
What is UML ?
UML
UML
Fuses
Developed Accepted
More on UML...
UML is a modeling language for visualising, specifying, constructing and documenting the artifacts of software systems. Visualising - a picture is worth a thousand
words; a graphical notation articulates and unambiguously communicates the overall view of the system (problem-domain).
Introduction to UML
More on UML...
Specifying - UML provides the means to model
precisely, unambiguously and completely, the system in question.
Introduction to UML
More on UML...
Documenting - every software
project involves a lot of documentation from the inception phase to the deliverables. UML provides the notations for documenting some of these artifacts
Introduction to UML
Building Blocks
Things
Diagrams
Relationships
Class Diagram Object Diagram Use Case Diagram Behaviour Diagram Implementation Diagram
Introduction to UML
10
Structural Things
The nouns of UML models; usually the static parts of the system in question.
Class - an abstraction of a set of things in the problemdomain that have similar properties and/or functionality.
Notation:
customer
Introduction to UML
11
Introduction to UML
13
Notation:
Introduction to UML
14
Behavioral Things
The verbs of UML models; usually the dynamic parts of the system in question.
Introduction to UML
15
Introduction to UML
16
Grouping Things
The organisational part of the UML model; provides a higher level of abstraction (granularity).
Notation:
Accounts Department
Introduction to UML
17
Annotational Things
The explanatory part of the UML model; adds information/meaning to the model elements.
Notation:
Introduction to UML
18
Relationships
Articulates the meaning of the links between things.
Notation:
(arrow-head points to the independent thing)
Introduction to UML
19
Relationships (contd.)
Introduction to UML
20
Relationships (contd.)
Introduction to UML
21
Diagrams
The graphical presentation of the model. Represented as a connected graph - vertices (things) connected by arcs (relationships). UML includes nine diagrams - each capturing a different dimension of a software-system architecture.
Class Diagram Object Diagram Use Case Diagram Sequence Diagram Collaboration Diagram
Introduction to UML
22
More on Diagrams...
Introduction to UML
23
More on Diagrams...
Sequence Diagram - models the flow of control by timeordering; depicts the interaction between various objects by of messages passed, with a temporal dimension to it.
Introduction to UML
24
More on Diagrams...
Introduction to UML
25
Dimensions...
. . .of Software Architecture
Structural Implementation View View Class Diagrams Object Diagrams Component Diagrams
User View
Use Case Diagrams
Sequence Diagrams Deployment Diagrams Collaboration Diagrams Statechart Diagrams Activity Diagrams Behavioral Environment View View
CDAC (Formerly NCST)
Introduction to UML
26
Rules
Specify what a well-formed model should look like. The UML has semantic rules for Names Scope Visibility Integrity Execution
Introduction to UML
27
Common Mechanisms
Mechanisms/elements that apply consistently throughout the language: Specifications Adornments (Notes) Common Divisions Extensibility Mechanisms Stereotypes Tagged values Constraints
Introduction to UML
28
Specifications
The UML is more than just a graphical language. Rather, behind every part of its graphical notation there is a specification that provides a textual statement of the syntax and semantics of that building block. For example, behind a class icon is a specification that provides the full set of attributes, operations (including their full signatures), and behaviors that the class embodies; visually, that class icon might only show a small part of this specification. Furthermore, there might be another view of that class that presents a completely different set of parts yet is still consistent with the class's underlying specification. You use the UML's graphical notation to visualize a system; you use the UML's specification to state the system's details. Given this split, it's possible to build up a model incrementally by drawing diagrams and then adding semantics to the model's specifications, or directly by creating a specification, perhaps by reverse engineering an existing system, and then creating diagrams that are projections into those specifications. The UML's specifications provide a semantic backplane that contains all the parts of all the models of a system, each part related to one another in a consistent fashion. The UML's diagrams are thus simply visual projections into that backplane, each diagram revealing a specific interesting aspect of the system.
Introduction to UML
29
Adornments
Adorn the model - i.e., enhance the model. Adds to the meaning and/or semantics of the element to which it pertains. Notes are the mechanism provided by UML for adorning a model:
graphical symbol to render constraints, comments, etc. a note that renders only a comment has no semantic impact on the element it is adorning; at most adds meaning to it and/or provides guidelines for implementation.
Introduction to UML
30
Adornments
shows a class, adorned to indicate that it is an abstract class with two public, one protected, and one private operation.
Introduction to UML
31
Common Divisions
In modeling object-oriented systems, the world often gets divided in several ways. First, there is the division of class and object. A class is an abstraction; an object is one concrete manifestation of that abstraction. In the UML, you can model classes as well as objects, Graphically, the UML distinguishes an object by using the same symbol as its class and then simply underlying the object's name.
Introduction to UML
32
Common Divisions
In
this figure, there is one class, named Customer, together with three objects: Jan (which is marked explicitly as being a Customer object), :Customer (an anonymous Customer object), and Elyse (which in its specification is marked as being a kind of Customer object, although it's not shown explicitly here).
Introduction to UML
33
Stereotypes
Used to create new building blocks from existing blocks. New building blocks are domain-specific. A particular abstraction is marked as a stereotype and this stereotype is then used at other places in the model to denote the associated abstraction.
Notation: metaclass
Introduction to UML
34
Tagged Values
Used to add to the information of the element (not of its instances). Stereotypes help create new building blocks; tagged values help create new attributes.
Commonly used to specify information relevant to code generation, configuration management, etc.
Notation: {version=1.4}
Introduction to UML
35
Constraints
Rules that impact the semantics of the model, and specify conditions that must be met.
Can apply to any element in the model attributes of a class, relationship, etc.
Notation: { incomplete, disjoint }
Introduction to UML
36
Constraints
Introduction to UML
37
Summary
Modeling captures the system in its entirety, along with the different dimensions of its complexity. Facilitates quick and efficient analysis and design and helps communicate the overall system architecture unambiguously.
Principles of modeling lay down that: model must be chosen well model should encapsulate different granularities models can make simplifying assumptions, but not hide important facts no single model can capture all dimensions of the complexity
Introduction to UML
38
Summary
UML (Unified Modeling Language) is a language that helps analyse and design solutions for softwareintensive systems Developed by Booch, Rumbaugh and Jacobson at Rational Software; subsequently adopted as an open standard by the Object Management Group in 1997. UML is a modeling language for visualising, specifying, constructing and documenting the artifacts of a software system. It is a modeling language and not a methodology or a process.
Introduction to UML
39
Summary
The conceptual model of the UML comprises the Building Blocks of UML, its Rules and certain Common Mechanisms that are applicable across the entire language. The Building Blocks comprise Things, Relationships and Diagrams. Things are of grouped into 4 categories: structural things, behavioral things, grouping things and annotational things.
Introduction to UML
40
Summary
Structural things describe the static part of the model and are of seven types: class, interface, collaboration, use case, active class, component, node. Behavioral things describe the dynamic part of the model and are of two types: interaction and state machine.
Packages are included under Grouping things, and Notes under Annotational things
Relationships link things to each other and are of four types: Dependency, Association, Generalisation and Realization.
Introduction to UML
41
Summary
Diagrams are essentially connected graphs - a set of vertices (things) connected by arcs (relationships). There are several types of diagrams, each one capturing a different dimension of the systems complexity. Diagrams are of nine types: Class Diagram, Object Diagram, Use Case Diagram, Sequence Diagram, Collaboration Diagram, Statechart Diagram, Activity Diagram, Implementation Diagram, Deployment Diagram. The UML has semantic rules for Names of classifiers, Scope of these names, Visibility of these names, and the Integrity and Execution of the model.
Introduction to UML
42
Summary
Certain common mechanisms apply uniformly across the model. There are four such mechanisms: Specifications, Common Divisions, Adornments, Extensibility Mechanisms. Notes are the most common adornments used, that add to the meaning of a classifier. Extensibility mechanisms include Stereotypes, Tagged values and constraints.
Introduction to UML
43
References
The Unified Modeling Language User Guide
Grady Booch, James Rumbaugh, Ivar Jacobson Addison-Wesley (International Student Edition)
UML Distilled
Martin Fowler (with Kendall Scott) Addison-Wesley