software design modelling and analysis in uml
play

Software Design, Modelling and Analysis in UML Lecture 22: - PowerPoint PPT Presentation

Software Design, Modelling and Analysis in UML Lecture 22: Meta-Modelling, Inheritance III 2013-02-06 22 2013-02-06 main Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Albert-Ludwigs-Universit at Freiburg, Germany Contents


  1. Software Design, Modelling and Analysis in UML Lecture 22: Meta-Modelling, Inheritance III 2013-02-06 – 22 – 2013-02-06 – main – Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Albert-Ludwigs-Universit¨ at Freiburg, Germany

  2. Contents & Goals Last Lecture: • Inheritance in UML: desired semantics This Lecture: • Educational Objectives: Capabilities for following tasks/questions. • What’s the Liskov Substitution Principle? • What is late/early binding? • What is the subset, what the uplink semantics of inheritance? • What’s the effect of inheritance on LSCs, State Machines, System States? • What’s the idea of Meta-Modelling? • Content: • Meta-Modelling – 22 – 2013-02-06 – Sprelim – • Two approaches to obtain desired semantics 2 /63

  3. Meta-Modelling: Idea and Example – 22 – 2013-02-06 – main – 3 /63

  4. Meta-Modelling: Why and What • Meta-Modelling is one major prerequisite for understanding • the standard documents [OMG, 2007a, OMG, 2007b], and • the MDA ideas of the OMG. • The idea is simple : • if a modelling language is about modelling things , • and if UML models are and comprise things , • then why not model those in a modelling language? • In other words: Why not have a model M U such that • the set of legal instances of M U – 22 – 2013-02-06 – Smm – is • the set of well-formed (!) UML models. 4 /63

  5. Meta-Modelling: Example • For example, let’s consider a class. • A class has (on a superficial level) • a name , • any number of attributes , • any number of behavioural features . Each of the latter two has • a name and • a visibility . Behavioural features in addition have • a boolean attribute isQuery , • any number of parameters, – 22 – 2013-02-06 – Smm – • a return type. • Can we model this (in UML, for a start)? 5 /63

  6. UML Meta-Model: Extract � Comment Element NamedElement name visibility type Type TypedElement RedefElement redefdElem ∗ 0 .. 1 ∗ type Feature Namespace Classifier StructFeature BehavFeature – 22 – 2013-02-06 – Sumlmm – Property � Class � ∗ 0 .. 1 � Operation Parameter ∗ 0 .. 1 6 /63

  7. Classes [OMG, 2007b, 32] StructuralFeature Classifier Relationship Classifier � {subsets member, ordered} Property +memberEnd +association Association {redefines general} + /superClass 0..1 2..* Class isDerived : Boolean isDerived : Boolean * +subsettedProperty isReadOnly : Boolean * {subsets memberEnd, * isDerivedUnion : Boolean subsets feature, subsets {subsets association, subsets namespace, /default : String ownedMember, ordered} subsets featuringClassifier} +ownedEnd * aggregation : AggregationKind +owningAssociation /IsComposite : Boolean * 0..1 {subsets classifier, subsets namespace, {subsets attribute, subsets featuringClassifier} {subsets owner} subsets ownedMember, + class +navigableOwnedEnd ordered} +ownedAttribute 0..1 * * 0..1 * {subsets redefinedElement} + redefinedProperty {subsets owner} (subsets ownedElement} +owningProperty * +defaultValue ValueSpecification * 0..1 0..1 +/opposite 0..1 0..1 {subsets namespace, <<enumeration>> {subsets ownedMember, ordered} subsets redefinitionContext} +nestedClassifier AggregationKind +class Classifier – 22 – 2013-02-06 – Sumlmm – none * shared 0..1 composite {readOnly, odered} {subsets redefinitionContext, 1..* {subsets feature, subsets +/endType subsets namespace, ownedMember, ordered} subsets featuringClassifier} +ownedOperation +class Operation Type * 0..1 Figure 7.12 - Classes diagram of the Kernel package 7 /63

  8. Operations [OMG, 2007b, 31] – 22 – 2013-02-06 – Sumlmm – Figure 7.11 - Operations diagram of the Kernel package 8 /63

  9. Operations [OMG, 2007b, 30] – 22 – 2013-02-06 – Sumlmm – Figure 7.10 - Features diagram of the Kernel package 9 /63

  10. Classifiers [OMG, 2007b, 29] Figure 7.9 - Classifiers diagram of the Kernel package – 22 – 2013-02-06 – Sumlmm – 10 /63

  11. Namespaces [OMG, 2007b, 26] Element <<enumeration>> VisibilityKind NamedElement public Name : String [0..1] private visibility : VisibilityKind [0..1] protected /qualifiedName : String [0..1] package {readOnly, union} {readOnly, subsets member} +/member NamedElement Namespace +importedMember PackageableElement * * * +/ownedMember * {readOnly, union, visibility : VisibilityKind subsets owner} {readOnly, union, subsets +/namespace member, subsets ownedElement} DirectedRelationship 0..1 {subsets source, subsets owner} {subsets target} + importingNamespace + importedElement * ElementImport PackageableElement 1 1 +elementImport 1 visibility : VisibilityKind alias : String [0..1] {subsets – 22 – 2013-02-06 – Sumlmm – ownedElement} DirectedRelationship {subsets source, subsets owner} * {subsets target} +importingNamespace PackageImport + importedPackage 1 Package +packageImport visibility : VisibilityKind 1 * {subsets ownedElement} Figure 7.4 - Namespaces diagram of the Kernel package 11 /63

  12. Root Diagram [OMG, 2007b, 25] – 22 – 2013-02-06 – Sumlmm – Figure 7.3 - Root diagram of the Kernel package 12 /63

  13. Interesting: Declaration/Definition [OMG, 2007b, 424] – 22 – 2013-02-06 – Sumlmm – Figure 13.6 - Common Behavior 13 /63

  14. UML Architecture [OMG, 2003, 8] Class, Object Infrastructure Action, Filmstrip • Meta-modelling has already (with semantics) Package, Snapshot been used for UML 1.x. • For UML 2.0, the request Superstructure Class, State, (abstract syntax) Transition, for proposals (RFP) asked Flow, … for a separation of concerns: Infrastructure and Superstructure ClassBox, StateBox, (concrete syntax) Superstructure . TransitionLine, … • One reason : sharing with MOF (see Diagram Node, Edge… Interchange later) and, e.g., CWM. Figure 0-1 Overview of architecture – 22 – 2013-02-06 – Swhole – UML CWM Core MOF Profiles 14 /63

  15. UML Superstructure Packages [OMG, 2007a, 15] CommonBehaviors Classes StateMachines Interactions UseCases Activities CompositeStructures AuxiliaryConstructs Actions Components – 22 – 2013-02-06 – Swhole – Deployments Figure 7.5 - The top-level package structure of the UML 2.1.1 Superstructure 15 /63

  16. Meta-Modelling: Principle – 22 – 2013-02-06 – main – 16 /63

  17. Modelling vs. Meta-Modelling Class Property Type Meta- name : Str name : Str name : Str S = ( { Z } , Model (M2) D D � Σ S C { C } , { v } , :Class :Property :Type v : Z { C �→ v } ) , name = C name = v name = Z Model (M1) Instance instance-of ∈ (M0) – 22 – 2013-02-06 – Sprinciple – :C σ = { u �→ { v �→ 0 }} v = 0 17 /63

  18. Modelling vs. Meta-Modelling Class Property Type Meta- name : Str name : Str name : Str S = ( { Z } , Model (M2) D D � Σ S C { C } , { v } , :Class :Property :Type v : Z { C �→ v } ) , name = C name = v name = Z Model (M1) • So, if we have a meta model M U of UML, then the set Instance instance-of of UML models is the set of instances of M U . ∈ (M0) – 22 – 2013-02-06 – Sprinciple – • A UML model M can be represented as an object :C σ = { u �→ diagram (or system state) wrt. the meta-model M U . { v �→ 0 }} v = 0 • Other view : An object diagram wrt. meta-model M U can (alternatively) be rendered as the UML model M . 17 /63

  19. Well-Formedness as Constraints in the Meta-Model • The set of well-formed UML models can be defined as the set of object diagrams satisfying all constraints of the meta-model . For example, “[2] Generalization hierarchies must be directed and acyclical. A classifier cannot be both a transitively general and transitively specific classifier of the same classifier. not self . allParents () -> includes ( self ) ” [OMG, 2007b, 53] • The other way round: Given a UML model M , unfold it into an object diagram O 1 wrt. M U . – 22 – 2013-02-06 – Sprinciple – If O 1 is a valid object diagram of M U (i.e. satisfies all invariants from Inv ( M U ) ), then M is a well-formed UML model. That is, if we have an object diagram validity checker for of the meta-modelling language, then we have a well-formedness checker for UML models. 18 /63

Recommend


More recommend