Contents of the Block “Design” Contents & Goals (i) Introduction and Vocabulary L 1: 20.4., Mo Introduction Last Lecture: T 1: 23.4., Do (ii) Principles of Design L 2: 27.4., Mo Development • Design basics and vocabulary: L 3: 30.4., Do a) modularity Process, Metrics Softwaretechnik / Software-Engineering modularity, separation of concerns, information hiding, data encapsulation, ADT, . . . L 4: 4.5., Mo b) separation of concerns T 2: 7.5., Do c) information hiding and data encapsulation L 5: 11.5., Mo This Lecture: d) abstract data types, object orientation - 14.5., Do Lecture 12: Structural Software Modelling L 6: 18.5., Mo • Educational Objectives: Capabilities for following tasks/questions. Requirements (iii) Software Modelling L 7: 21.5., Do Engineering - 25.5., Mo • What is the signature defined by this class diagram? a) views and viewpoints, the 4+1 view - 28.5., Do • Give a system state corresponding to this class diagram. T 3: 1.6., Mo b) model-driven/based software engineering - 4.6., Do c) Unified Modelling Language (UML) • Which system state is denoted by this object diagram? L 8: 8.6., Mo 2015-06-25 d) modelling structure L 9: 11.6., Do • To which value does this Proto-OCL formula evaluate on the given system state? L 10: 15.6., Mo 1. (simplified) class diagrams • Give system states such that the given formula evaluates to true/false/ ⊥ . T 4: 18.6., Do 2. (simplified) object diagrams L 11: 22.6., Mo 3. (simplified) object constraint logic (OCL) • Why is Proto-OCL a 3-valued logic? Architecture & – 12 – 2015-06-25 – Scontents – L 12: 25.6., Do Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Design, Software – 12 – 2015-06-25 – Sprelim – e) modelling behaviour L 13: 29.6., Mo – 12 – 2015-06-25 – main – Modelling L 14: 2.7., Do • Content: 1. communicating finite automata T 5: 6.7., Mo 2. Uppaal query language Albert-Ludwigs-Universit¨ at Freiburg, Germany L 15: 9.7., Do • Class Diagrams Quality Assurance 3. basic state-machines L 16: 13.7., Mo • Object Diagrams 4. an outlook on hierarchical state-machines Invited Talks L 17: 16.7., Do T 6: 20.7., Mo • Proto-OCL (iv) Design Patterns Wrap-Up L 18: 23.7., Do 2 /38 4 /38 Object System Signature Object System Signature Example S 0 = ( { Int } , { C, D } , { x : Int , p : C 0 , 1 , n : C ∗ } , { C �→ { p, n } , D �→ { p, x }} , Definition. An (Object System) Signature is a 6-tuple { f : Int → Bool , get x : Int } , { C �→ ∅ , D �→ { f, get x }} ) S = ( T , C , V, atr , F, mth ) where Class Diagrams • T is a set of (basic) types , • C is a finite set of classes , • V is a finite set of typed attributes , i.e., each v ∈ V has type • V is a finite set of typed attributes v : T , i.e., each v ∈ V has type T , • atr : C → 2 V maps each class to its set of attributes. • F is a finite set of typed behavioural features f : T 1 , . . . , T n → T , • mth : C → 2 F maps each class to its set of behavioural features. – 12 – 2015-06-25 – Sumlsig – – 12 – 2015-06-25 – Sumlsig – – 12 – 2015-06-25 – main – • A type can be a basic type τ ∈ T , or C 0 , 1 , or C ∗ , where C ∈ C . Note : Inspired by OCL 2.0 standard OMG (2006), Annex A. 5 /38 6 /38 7 /38
Object System Signature Example And The Other Way Round Shorthand Notation D D n n S 0 = ( { Int } , { C, D } , { x : Int , p : C 0 , 1 , n : C ∗ } , { C �→ { p, n } , D �→ { p, x }} , • • 0 .. 1 x : Int 0 .. 1 x : Int 0 .. ∗ • × 0 .. ∗ • × C C p f ( Int ) : Bool p f ( Int ) : Bool × × • × • × { f : Int → Bool , get x : Int } , { C �→ ∅ , D �→ { f, get x }} ) get x () : Int get x () : Int p p 0 .. 1 0 .. 1 D n 0 .. 1 x : Int 0 .. ∗ C p f ( Int ) : Bool p get x () : Int 0 .. 1 D n In particular: • 0 .. 1 x : Int • 0 .. ∗ × C p × f ( Int ) : Bool • visibility for attributes and association ends ( + , − , # , ∼ ): later • × get x () : Int p 0 .. 1 • initial values, properties : not here , cf. UML lecture – 12 – 2015-06-25 – Sumlsig – – 12 – 2015-06-25 – Sumlsig – – 12 – 2015-06-25 – Sumlsig – • associations in general (names, reading direction, ternary; visibility, navigability, etc. of association ends): not here , cf. UML lecture • inheritance : later (maybe) • behavioural features : not here , cf. UML lecture 7 /38 8 /38 9 /38 Object System Structure Basic Object System Structure Example System State Wanted : a structure for signature Definition. A Object System Structure of signature Definition. Let D be a structure of S = ( T , C , V, atr , F, mth ) . S 0 = ( { Int } , { C, D } , { x : Int , p : C 0 , 1 , n : C ∗ } , { C �→ { p, n } , D �→ { p, x }} , A system state of S wrt. D is a type-consistent mapping S = ( T , C , V, atr , F, mth ) { f : Int → Bool , get x : Int } , { C �→ ∅ , D �→ { f, get x }} ) σ : D ( C ) � ( V � ( D ( T ) ∪ D ( C ∗ ))) . is a domain function D which assigns to each type a domain, i.e. That is, for each u ∈ D ( C ) , C ∈ C , if u ∈ dom( σ ) • τ ∈ T is mapped to D ( T ) , A structure D maps • τ ∈ T to some D ( τ ) , C ∈ C to some identities D ( C ) (infinite, pairwise disjoint), • C ∈ C is mapped to an infinite set D ( C ) of (object) identities . • dom( σ ( u )) = atr ( C ) • C ∗ and C 0 , 1 for C ∈ C to D ( C 0 , 1 ) = D ( C ∗ ) = 2 D ( C ) . • object identities of different classes are disjoint, i.e. ∀ C, D ∈ C : C � = D → D ( C ) ∩ D ( D ) = ∅ , • σ ( u )( v ) ∈ D ( τ ) if v : τ, τ ∈ T • on object identities, (only) comparision for equality “ = ” is defined. D ( Int ) = Z • σ ( u )( v ) ∈ D ( D ∗ ) if v : D 0 , 1 or v : D ∗ with D ∈ C – 12 – 2015-06-25 – Sumlstruc – • C ∗ and C 0 , 1 for C ∈ C are mapped to 2 D ( C ) . – 12 – 2015-06-25 – Sumlstruc – – 12 – 2015-06-25 – Sumlstruc – N + × { C } ∼ D ( C ) = = { 1 C , 2 C , 3 C , ... } We call u ∈ D ( C ) alive in σ if and only if u ∈ dom( σ ) . N + × { D } ∼ We use D ( C ) to denote � C ∈ C D ( C ) ; analogously D ( C ∗ ) . D ( D ) = = { 1 D , 2 D , 3 D , ... } We use Σ D S to denote the set of all system states of S wrt. D . 2 D ( C ) D ( C 0 , 1 ) = D ( C ∗ ) = Note : We identify objects and object identities, because both uniquely determine each other D ( D 0 , 1 ) = D ( D ∗ ) = 2 D ( D ) (cf. OCL 2.0 standard). 10 /38 11 /38 12 /38
Recommend
More recommend