1 devon m. simmonds the uml metamodel slides include some from tvarious sources including: (1)

55
1 Devon M. Simmonds The UML Metamodel DES include some from tvarious sources including: (1) http://www.econ.kuleuven.ac.be/public/ndbaa30/SWMGT/ (2) Object Modeling with OMG UML Tutorial Series - http://www.omg.org/technology/uml/uml_tutorial

Upload: beverley-merritt

Post on 22-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

1

Devon M. Simmonds

The UML

Metamodel

SLIDES include some from tvarious sources including: (1) http://www.econ.kuleuven.ac.be/public/ndbaa30/SWMGT/ (2) Object Modeling with OMG UML Tutorial Series - http://www.omg.org/technology/uml/uml_tutorial.htm

Page 2: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

2

Outline Introduction UML metamodel Class diagram metamodel Interaction diagram metamodel Benefits of metamodels UML extension mechanisms

Page 3: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

UML

The UML specification consists of two interrelated parts: UML Semantics. A metamodel that

specifies the abstract syntax and semantics of UML object modeling concepts.

UML Notation. A graphic notation for the visual representation of the UML semantics.

3

Page 4: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

UML The abstract syntax for the UML

Semantics is expressed using a small subset of the UML Notation.

The UML Notation describes the mapping of the graphic notation to the underlying semantics.

4

Page 5: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

UML The UML metamodel is described in a

semi-formal manner using three views: Abstract syntax Well-formedness rules Semantics

The abstract syntax is provided as a model described in a subset of UML, consisting of a UML class diagram and a supporting natural language description.

5

Page 6: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

UML The well-formedness rules are provided

using a formal language (Object Constraint Language) and natural language (English).

The semantics are described primarily in natural language, but may include some additional notation.

6

Page 7: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Advanced Modeling with UML 7

Meta-Models Models that describe other models

ClassClass AssociationAssociation

Objects

Model

Meta-Model

(M0)

(M1)

(M2)

CustomerOrderCustomerOrder

itemquantityitemquantity

CustomerCustomer

idid

b:CustomerOrder b:CustomerOrder Mike:Customer

Id= 12345

Mike:Customer

Id= 12345c:CustomerOrderItem=batterQuantity=<5 tons>

c:CustomerOrderItem=batterQuantity=<5 tons>

Page 8: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Advanced Modeling with UML 8

The UML Meta-Model A UML Model that describes

UML

GeneralizableElementGeneralizableElement

isRoot : BooleanisLeaf : BooleanisAbstract : Boolean

isRoot : BooleanisLeaf : BooleanisAbstract : Boolean

ClassClass

isActive : BooleanisActive : Boolean

ClassifierClassifier

FeatureFeature

visibility : {public, private,protected}visibility : {public, private,protected}

*

not self.isAbstract implies self.allOperations->forAll(op | self.allMethods->exists(m | m.specification includes (op)))

not self.isAbstract implies self.allOperations->forAll(op | self.allMethods->exists(m | m.specification includes (op)))

Well-formedness constraint (OCL)

Meta-ClassMeta-Class

Page 9: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

9

Four Layered ArchitectureLayer Description Example

Meta-metamodel Defines metamodel metaClass, metaAttribute, metaOperation

Metamodel An instance of meta-Metamodel. Defines model

Class, attribute operation, component

model Language for describing information domain. Defines a set of related objects that represent a concept.

Employee,

User object An instance of the model. An example information domain

sally

Page 10: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

OMG Modeling Infrastructure

10

M3

M2

M1

M0

Meta-Object Facility (MOF)

UML Metamodel

Modeling concepts

User Data

Instance_of

Instance_of

Instance_of

Page 11: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

MetaModels SWE 699 11

UML Metamodel Features

UML metamodel is managed by organizing it into packages.

Each package groups related metaclasses

Page 12: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Advanced Modeling with UML 12

«metamodel»UML

“StructuralElements”

“Behavioral Elements”

dependency

package

UML Metamodel Overview

Page 13: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Advanced Modeling with UML 13

“StructuralElements”

Composite Structures

Classes

UML Overview

Components

Deployments

<<imports>><<imports>>

<<imports>>

Page 14: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

14

Page 15: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

15

Page 16: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

16

Page 17: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

17

Page 18: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

18

Page 19: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

19

Slots are shown using similar notation to that of the corresponding structural features. Where a feature would be shown textually in a compartment, a slot for that feature can be shown textually as a feature name followed by an equal sign (‘=’) and a value specification. Other properties of the feature, such as its type, can optionally be shown.

Page 20: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Slots

20

A slot specifies that an entity modeled by an instance specification has a value or values for a specific structural feature.

Slots are shown using similar notation to that of the corresponding structural features. Where a feature would be shown textually in a compartment, a slot for that feature can be shown textually as a feature name followed by an equal sign (‘=’) and a value specification. Other properties of the feature, such as its type, can optionally be shown.

Page 21: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

21

A classifier is a classification of instances, it describes a set of instances that have features in common.

Page 22: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

22

Page 23: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

23

Page 24: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

24

Page 25: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

25

Example 1

PERSON

CAR

[0..1]

[0..*]

owns

Model Layer

Entity

AssociationAssociation

End

1

[0..*]

[2..*] 1

Cardinality range

Rolename

Name

Name

Meta Model Layer

A meta-model is a conceptual model of a modeling technique !

Page 26: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

26

Example 2

AssociationPropertyClass

RelationshipClassifier

2..* 0..1

0..1

0..1

x..y v..w

(A) (B)

Owned end

member end

0..10..*

Syntactically valid ?

Page 27: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

27

Page 28: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

28

Page 29: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

29

Page 30: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

30

Page 31: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

The Java Metamodel

31

Page 32: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Advanced Modeling with UML 32

Behavioral Elements of UML Metamodel

Page 33: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Interaction Diagram Metamodel

(see handout)

33

1. Can you derive the relationship between a message end and a lifeline?

2. Can you derive the relationship between a messageand an operation?2. Can you derive the relationship between a classand a lifeline?

Page 34: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

34

Navigating the “MetaMuddle”

NamedElement(from Kernel)

name:Stringvisibility:VisibilityKind

Lifeline

TypedElement(from Kernel)

Type(from Kernel)

ConnectableElement(from InternalStructures)

+type

0..1

+represents0..1

*

ConnectorEnd(from InternalStructures

Connector(from InternalStructures)

*

2..*

Message

/messageKind:MessageKindmessageSort:MessageSort

0..1

*

MessageEnd

+sendEvent+recieveEvent

0..1

0..1

0..1

0..1

OccurenceSpesificatoin

0..1

MessageOccurenceSpecification

*

ExecutionOccurenceSpecification

ExecutionSpecification

+/signatur

Operation(from Kernel)

Signal(from Communications)

ValueSpecification +argument

*

+start +finnish

Element(from Kernel)

+/owner

+/ownedelement

Comment(from Kernel)

0..1

*0..1

*

+/ownedComment

MessageEvent(from Communications)

*

SendSignalEvent

SendOperationEvent

1

*

*

1

1

Event(from Communications)

*

1

Can you derive the relationship between a message end and a lifeline?

?

Page 35: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Benefits of Metamodels Meta-models should enable the following

benefits: Share system information across applications & tools

during its life cycle Enable a multi-user integrated tools environment Enhance information sharing and communication Consolidate and eliminate redundant specifications Increase systems integrity Simplify systems maintenance/modification Enable combining tools from multiple vendors Simplify migrations and conversions ...

35

Page 36: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Benefits of Metamodels Provide a platform for integration of

tools Make sure that tools can work together on

the same software project - tool inter-operability.

Provide a means to manage software components in a shared application development environment. Make sure that people can work together on

the same software project – Basis for Software Configuration Management 36

Page 37: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Benefits of Metamodels Provide a “standard” documentation format for

describing methods and techniques for software development.

Define the semantics of a notation Compare methods and techniques on a uniform basis

Provide a platform for software reuse Reuse software by populating the meta-model

Provide a basis for knowledge sharing in Data Warehouses

Make sure that people (may) give the same meaning to shared data elements

37

Page 38: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

38

Metamodel Users?• TOOL vendor

The meta-model describes the capabilities of the tool...Tool vendors often extend standard metamodels or implement only a subset!

• Systems IntegratorA systems integrator may have to integrate multiple

modelingand other tools in a way that they appear like one tool. Themeta-model determines how the tools can “speak” to eachother...

• ModelerIn evaluating modeling tools functionality is important

(“thisone does code generation”), but the supported concepts

areeven more important, which is essentially evaluating the

meta-model

• Repository vendorA meta-model is a conceptual model for repositories, the

inte-grating technology for tools

Page 39: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

39

Metamodel EffortsMulti-vendor• The UML Meta-model (Object Management Group

OMG)• The MOF specification (OMG)• XMI (XML-based Interoperability of tools, OMG)• …

Single vendor• The Microsoft OPEN Information • The PTECH meta-model• The CAYENNE meta-model …

Page 40: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Architecture metamodelSoftware

Architecture

Software Architecture Description

Architectural view

is made of

is represented by

Architecture Design Process

produces

Form

Component

Connection

Architectural Pattern

is a

is made of

Software Architects

are actors in

Logical view

Process view

Implemen- tation view

Deployment view

Requirements

satisfies

Architectural style

has

has

has

is a

System architecture

is part of

Architecture Style guide

Constraints

constrains

constrains

Use case view

relates to

Architectural Blueprint

depicts

Page 41: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Extending UML?

41

Why is there a need to extend UML?

Page 42: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Advanced Modeling with UML, Selic et al. 42

Extensibility Mechanisms Extensibility Mechanisms

Allow Modelers to refine the semantics of UML for a specific domain

Extensions cannot violate the standard UML semantics Enforces a consistent core of

concepts and semantics for every variation

Prevents meta-model explosion (Using UML to model everything and anything)

Page 43: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

43

How UML Extensibility Works

The standard UML semantics can be viewed as defining a space of possible interpretations

Standard UML semanticsStandard UML semantics

refined semantics(valid)refined semantics(valid) different semantics

(NOT valid)different semantics(NOT valid)

Advanced Modeling with UML, Selic et al.

Page 44: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

44

The Basic Extensibility Mechanisms

Stereotypes used to refine meta-classes (or other

stereotypes) by defining supplemental semantics

Constraints predicates (e.g., OCL expressions) that

reduce semantic variation can be attached to any meta-class or

stereotype Tagged Values

individual modifiers with user-defined semantics

can be attached to any meta-class or stereotype

Advanced Modeling with UML, Selic et al.

Page 45: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

45

Stereotypes Used to define specialized model elements

based on a core UML model element Defined by:

Base metaclasses (or stereotype) What element is specialized?

Constraints: What is special about this stereotype?

required tags (0..*) What values does this stereotype need to know?

icon How should I appear in a model?

A model element can be stereotyped in multiple different ways

1.4

Advanced Modeling with UML, Selic et al.

Page 46: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

46

Example Capsule: A special type of concurrent

object used in modeling certain real-time systems

By definition, all classes of this type: are active (concurrent) have only features (attributes and

operations) with protected visibility have a special “language” characteristic

used for code generation purposes In essence, a constrained form of the

general UML Class conceptAdvanced Modeling with UML, Selic et al.

Page 47: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

47

Example: Stereotype Definition Using a tabular

form:Stereotype Base Class Tags Constraints

«capsule» Class language

isActive = true;

self.feature->select(f | f.oclIsKindOf(Operation))-> forAll(o | o.elementOwnership.visibility = #protected)

Tag Stereotype Type Multiplicity

language «capsule» String 0..1

1.4

Advanced Modeling with UML, Selic et al.

Page 48: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

48

Stereotype Notation

Several choices«capsule»aCapsuleClass

«capsule»aCapsuleClass aCapsuleClassaCapsuleClass

Stereotypeicon

Stereotypeicon

(a) with guillemets(“gwee-mays”)

(b) with icon

(c) iconified form

Advanced Modeling with UML, Selic et al.

Page 49: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

49

Extensibility Method Refinements are specified at the Model

(M1) level but apply to the Meta-Model level (M2) avoids need for “meta-modeling” CASE tools can be exchanged with models

«Capsule»«Capsule»(M1)

(M2)ClassClass AssociationAssociation

CustomerOrderCustomerOrder

itemquantityitemquantity

CustomerCustomer

idid

«capsule»aCapsuleClass

«capsule»aCapsuleClass

Advanced Modeling with UML, Selic et al.

Page 50: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

50

Graphical Definition Alternative to the tabular form

defined in a user (M1) model

«metaclass»Class

«stereotype»capsule

Tagslanguage : String

«stereotype»

1.4

Advanced Modeling with UML, Selic et al.

Page 51: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

51

Heuristic: Combining Stereotypes

Through multiple inheritance:

«stereotype»capsule

«stereotype»capsule

Tagslanguage : String

Tagslanguage : String

«metaclass»Package

«metaclass»Package

«stereotype»PackageCapsule

«stereotype»PackageCapsule

«stereotype»

1.4

Advanced Modeling with UML, Selic et al.

Page 52: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

52

When to Use Stereotypes? Why not use normal subclassing

instead? Use stereotypes when:

additional semantic constraints cannot be specified through standard M1-level modeling facilities

e.g. “all features have protected visibility” the additional semantics have significance

outside the scope of UML e.g. instructions to a code generator

“debugOn = true”Advanced Modeling with UML, Selic et al.

Page 53: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

53

Tagged Values Consist of a tag and value pair Typed with a standard data type or M1

class name Typically used to model stereotype

attributes Additional information that is

useful/required to implement/use the model May also be used independently of

stereotypes e.g., project management data

(“status = unit_tested”)

1.4

Advanced Modeling with UML, Selic et al.

Page 54: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

54

Constrains

Constraints formal or informal expressions must not contradict inherited base

semanticsATM_WithdrawalATM_Withdrawal

customer : idamount : Money{amount is multiple of $20}

customer : idamount : Money{amount is multiple of $20}

AccountAccount

customer : idbalance : Moneycustomer : idbalance : Money

«constraint»{ATM_Withdrawal.customer = Account.customer}

«constraint»{ATM_Withdrawal.customer = Account.customer}

Advanced Modeling with UML, Selic et al.

Page 55: 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

The End

CSC550, Devon M. Simmonds, Computer Science Department, University of North Carolina Wilmington

???????????????

…CSC550 …

Q u e s t i o n s ?