Sei sulla pagina 1di 5

Objectives

UML Extension Mechanisms  Briefly describe the UML


 Introduce the UML Extension
Mechanisms:
By Jasmine Farhad  Specifications
 Common Divisions
 Adornments
j.farhad@cs.ucl.ac.uk
 Extensibility Mechanism(we will focus
on this)
 Guidelines for use
1 2

What is UML? Is the UML enough?


 The Unified Modelling Language
 Well-defined language BUT…..
 General purpose, tool supported,
standardized modelling language for  Impossible to express ALL possible
writing software blueprints nuances of ALL models across ALL
 Used for specifying, visualizing, domains across ALL time, SO……
constructing and documenting the  Need to extend it to customize/tailor it
artifacts of a system intensive process to communicate YOUR intent
 Promotes a use case driven, architecture-  Must be done in a CONTROLLED way
centric, iterative and incremental process
that is object oriented and component  Solution: the UML Extension Mechanisms
based
 Applicable to different types of systems,
domains, methods and processes 3 4

UML Extension Mechanisms Specifications


 There are four common  Class implies a full set of attributes,
mechanisms that can be used operations, full signatures and
throughout the language: behaviours
 Specifications  Specifications can be included in the
 Common Divisions class, or specified separately
 Adornments
 Extensibility Mechanism

5 6

1
Common Divisions Adornments

 Abstraction vs. manifestation  Textual/graphical items added to the


 Class vs. object basic notation of an element
 Most UML building blocks have this  Used for visualizing details from the
kind of class/object distinction; e.g., element’s specification
use case, use case instance etc.  Example: The basic notation of
 Interface vs. implementation association is a line, but this could be
adorned with additional details, such as
 An interface declares a contract, and
the role and multiplicity0.1of each end. *
an implementation represents one Employer employee
concrete realization of that contract Association
 The most important kind of adornments
are notes
7 8

Notes Extensibility Mechanisms


 Graphical symbols used for adding  Allows you to extend the language
constraints or comments to an
element/group of elements
by adding new building blocks,
 Attach information to a model such as
creating new properties and
observations, requirements and specifying new semantics. Includes:
explanations  Stereotypes
 No semantic impact, ie its content does
not change the meaning of the model to
 Tagged values
which it is attached  Constraints
 Example: Return copy of
self
9 10

Stereotypes Stereotypes(cont’d)
 Example: If you are modelling a network
 Extend the vocabulary of the UML by you might want to have symbols for
creating new model elements routers and hubs.
derived from existing ones but that  Can make use of stereotyped nodes so
that they appear as primitive building
have specific properties suitable for
blocks
your domain/problem
 Another example: In Java, you sometimes
 Each stereotype defines a set of have to model classes such as exceptions
properties that are received by  Only want them to be thrown and caught
elements of that stereotype  Can make them first class citizens in your
model, ie treating them like basic
building blocks, by marking them with a
11 12
suitable stereotype

2
Stereotypes(cont’d) Stereotypes(cont’d)

 Graphically, a stereotype is rendered  Named stereotype


<<metaclass>>
as a name enclosed by guillemots Model Element
and placed above the name of  Named stereotype with icon
another element (eg, <<name>>)
<<exceptions>>
 Alternatively, you can render the Underflow
stereotyped element by using a new !
icon associated with that stereotype  Stereotyped element as icon

13 HumiditySensor 14

Tagged values Tagged values(cont’d)

 Properties for specifying key-value pairs  Not the same as a class attribute
of model elements, where keywords are  Can think of a tagged value as a
attributes metadata, since its value applies to the
 Extend the properties of a UML building element itself and not its instances
block, allowing you to create new  Example: In the release team of a project
information in that elements specification that is responsible for assembling,
 Can be defined for existing elements of testing and deploying releases, you
the UML might want to keep track of the version
 You can also define tags that apply to number and test results for each major
individual stereotypes . Then, everything subsystem
with that stereotype will have that tagged  Can use tagged values to add this
value 15 information to your models 16

Tagged values(cont’d) Tagged values(cont’d)

 Another example: One of the most  Graphically, a tagged value is


common uses of a tagged value is to rendered as a string enclosed by
specify properties that are relevant to brackets and placed below the name
code generation or configuration of another element
management.
 The string consists of a name (the
 So you can use tagged values to specify tag), a separator (the symbol =),
the programming language to which you and a value (of the tag)
map a particular class
 Example: value of tag
 Similarly, you can use them to specify the
<<library>>
author and version of a component tagged value Server trans.dll
{processors=3} {ServerOnly}
17 18

3
Constraints Constraints(cont’d)

 Properties for specifying semantics  Example: If you are modelling hard


or conditions that must be real-time systems, you might want
maintained as true for model to adorn your models with
elements information about time budgets and
 Extend the semantics of a UML dead-lines
building block, allowing you to add  Can use constraints to capture these
new rules, or modify existing ones timing requirements

19 20

Constraints(cont’d) Constraints

 Graphically, a constraint is rendered as a  For example, some properties of


string enclosed by brackets and placed
near the associated element(s) or
associations(order and
connected to that element(s) by changeability) are rendered using
dependency relationships constraint notation
 This notation is also used as an Portfolio Corporation
adornment to the basic notation of an constraint across multiple elements
{secure}
element to visualize parts of an element’s {or} Person
specification that have no graphical cue BankAccoun gender: { female, male } 0..1
 For example, some properties of t 0..1
wife

associations(order and changeability) are Formal constraint using OCL husband


rendered using constraint notation {self.wife.gender=female
21
And self.husband.gender=male} 22

Guidelines for use Summary

 Keep in mind that an extension deviates  Modelling is all about communication.


from the standard form of the UML and  UML already gives you all the tools you
may therefore lead to interoperability need to visualize, specify, construct and
problems document the artifacts of a software-
intensive system
 So when you find yourself in the situation
where you have to colour outside the
 However, sometimes you might have to
bend/extend the UML in order to tailor it
lines you should do so in controlled ways
to the specific needs of your domain and
 Carefully weigh benefits and costs before your development culture
using the extension mechanisms  That’s where the UML extension
mechanisms come in!
23 24

4
Summary(cont’d) References
 Four common mechanisms:  The Unified Modelling Language User
 Specifications Guide by Rumbaugh, Jacobson and Booch
 Common divisions [Addison-Wesley]
 Adornments  The Unified Modelling Language
 Notes Reference Manual by Rumbaugh,
 Extensibility mechanisms Jacobson and Booch [Addison-Wesley]
 Stereotypes  Using UML, Software Engineering with
 Tagged values Objects and Components by Perdita
 Constraints Stevens and Rob Pooley

25 26

Potrebbero piacerti anche