Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: UML 2 Metamodel Note to Instructor: The material in this slide set is not contained in the 3 rd edition of the text book. It is planned for the 4 th edition.
36
Embed
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: UML 2 Metamodel Note to Instructor: The material in this.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3 From Model Instances to Meta Models Canonical model-instance-relationship: aPerson is an instance of the class Person Thus the class Person is a model for aPerson And aPerson is a model (an abstraction) of a real person Can we generalize this idea? What is the model for the class Person?
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Usi
ng U
ML,
Pat
tern
s, an
d Ja
vaO
bjec
t-Orie
nted
Sof
twar
e En
gine
erin
gChapter 2,
Modeling with UML:UML 2 Metamodel
Note to Instructor:
The material in this slide set is not contained in the 3rd edition of the text book. It is planned for the 4th edition.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2
Outline for today• From model instances to meta models• MOF meta model hierarchy• How UML relates to MOF
• Example: Use case diagram meta model• Example: Class diagram meta model
• Different notations for the UML meta model describe the same language
• UML Profiles: Adding new members to the family
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3
From Model Instances to Meta Models
Canonical model-instance-relationship:
aPerson is an instance of the class Person• Thus the class Person is a model for aPerson• And aPerson is a model (an abstraction) of a real
person
PersonaPerson <<instanceOf>>
Can we generalize this idea? What is the model for the class Person?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4
From Model Instances to Meta ModelsCanonical model-instance-relationship:
• The instance aPerson and the class Person are on different levels of abstraction
• The class Person specifies features that characterize the structure and behavior of Persons
The model for the class Person must characterize the structure and behavior of classes
PersonaPerson <<instanceOf>>
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5
Person <<instanceOf>> <<metaclass>>Class
From Model Instances to Meta Models• Relationship between model and meta-model:
• The meta class Class is a model for the class Person• Since Person is a model (for the instance aPerson),
Class is a meta model (model for models)
PersonaPerson <<instanceOf>>
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6
From Model Instances to Meta Models• At first this might be confusing, so:
• Think about the different layers of abstraction:• Instances are concrete• Models are an abstract description of the instances• Meta models are an abstract description of models• Meta-meta models are an abstract description of
meta models….
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7
Meta: Where does the word come from?• The word comes from the Greek μετά
(metá, "after") • An editor in the first century assembled
Aristotles’ work• In the bookshelf, it was the book that came “after
physics” (meta physiká)• Aristotle did not use the term metaphysics,
instead he called these topics "first philosophy”.• A core topic of the metaphysics book is
ontology• Ontology: The philosophical study of nature. The
investigation of what types of things exist in the world and what relations these things have to each other.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8
Questions in Ontology• What is existence?• Is existence a property?• Which entities, if any, are fundamental?• How do the properties of an object relate to the object itself?• What features are the essential, as opposed to merely accidental,
attributes of a given object?• How many levels of existence or ontological levels are there?• What is a physical object? • Can one give an account of what it means to say that a physical
object exists?• Can one give an account of what it means to say that a non-
physical entity exists?• What constitutes the identity of an object?• When does an object go out of existence, as opposed to merely
changing?
Source: http://en.wikipedia.org/wiki/Ontology
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9
Another Branch from Philosophy: EpistomologyEpistomology
• Analysis of the nature of knowledge and how it relates to truth
• What do people know?• How do we know what we know?• Also deals with the tools for the production of
knowledge• In computer science and project management,
we call it knowledge management• What is knowledge?• How is knowledge acquired?• How is knowledge externalized?• ….
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10
A Taxonomy of Philosophy (UML Class Diagram)
Philosophy
Metaphysics Epistomology Ethics
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 11
Meta Models
Why do we need them?• Meta models can be used for instance to formalize UML
notations:• The UML is a Language, meta models are used to
describe the grammar• The UML meta model describes all models one can
create using UML• The meta model allows to talk about semantics.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12
Meta Models
OK, so meta models are cool, but how do I create a meta model?
To approach this problem, we will look at the history of UML’s meta model first.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13
The History of UML’s Meta Model
• UML 1.0 had a lot of semantic problems• The OMG tried to deal with these problems by
formalizing the language• Idea: Use meta modeling!
• The OMG realized that all that was needed to describe meta models was to use a subset of UML class diagram elements
• Insight: To describe any meta model, the UML class diagram notation itself can be used!
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14
Meta Object Facility (MOF)• In UML 2, the OMG introduced the Meta Object
Facility to create a common basis for meta modeling• MOF specification: http://www.omg.org/mof/• The specification describes how models can be
• exported from an application• imported into another model• transported across a network• stored and retrieved from a repository• rendered into different formats• used to generate application code
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15
Advantages of MOF Compliant Meta Models• MOF compliant models can easily be compared• MOF compliant models can be exchanged in a
standardized way • XMI (XML Metadata Interchange)
• OMG's XML-based standard format for model transmission and storage
• MOF compliant instances can live in the same metadata repository (data warehousing)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16
The Meta Object Facility (MOF)We have seen this modeling sequence
instance model meta model…• This sequence could be continued forever• 4 models seem to be enough for most modeling problems
• MOF defines a four-layer meta model hierarchy• Layer M0: Information layer (The Application)• Layer M1: Model layer (The UML model)• Layer M2: Meta model layer (The UML meta model)• Layer M3: Meta-meta model layer (The MOF model)
• MOF and UML are aligned• The UML infrastructure contains all the concepts needed for
the specification of UML and MOF• But MOF is not restricted to UML
• Any meta model which is defined by using MOF is called MOF compliant.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17
Meta model hierarchy of the MOF (UML-specific)
Layer M0: Run-time Instances• Real instances of the modelsLayer M0 contains concrete run-time instances
• Note that there is a difference between real instance and instance specification!
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18
Meta model hierarchy of the MOF (UML-specific)
Layer M1: UML-modelBy using any UML diagram, we instantiate the UML meta model from Layer 2 and obtain a UML model Layer M1 contains application-specific models
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19
Meta model hierarchy of the MOF (UML-specific)
Layer M2: UML meta model • Models the language UML, i.e., defines concepts like classes, attributes, associations
Layer M2 contains descriptions of elements that are used to describe the models on the model layer
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20
Meta model Hierarchy of the MOF (UML-specific)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21
Meta model hierarchy of the MOF (UML-specific)
Layer M3: MOF model• The UML meta model is an instance of a yet more abstract model, namely the MOF model