MDAFA 2004 Presentation1Dennis Wagelaar Context-Driven Model Refinement Dennis Wagelaar Vrije Universiteit Brussel
MDAFA 2004 Presentation2Dennis Wagelaar Contents Developing for Ambient Intelligence Context-Aware Modelling Context-Driven Refinement Conclusions and Future Work
MDAFA 2004 Presentation3Dennis Wagelaar Developing for AmI (1) Developing for AmI Context-Aware Modelling Context-Driven Refinement Conclusions
MDAFA 2004 Presentation4Dennis Wagelaar Developing for AmI (2) Developing for AmI Context-Aware Modelling Context-Driven Refinement Conclusions In MDSD, models abstract from context for reusability over different contexts –UML allows only limited abstraction: there is no “general” language element Alternative refinements exist for use in specific contexts –Refinement alternatives are currently chosen manually: does not scale up
MDAFA 2004 Presentation5Dennis Wagelaar Context-Driven Development Developing for AmI Context-Aware Modelling Context-Driven Refinement Conclusions CoCompose2: –Uses general “concept” language construct that can later be refined –Automatically chooses and applies model refinements, based on context –Separated from UML language model CoCompose2 can also be applied to other (modelling) languages
MDAFA 2004 Presentation6Dennis Wagelaar Context-Aware Modelling Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Each model element is initially represented as a “concept” Concepts can be connected with “relationships” –Nature defined by an intermediate concept Concepts can contain other concepts Concepts can have several “refinements”
MDAFA 2004 Presentation7Dennis Wagelaar Example: Breakout Game Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions
MDAFA 2004 Presentation8Dennis Wagelaar Example: Breakout Game Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout Ball Paddle Brick
MDAFA 2004 Presentation9Dennis Wagelaar Example: Breakout Game Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout Ball Paddle Brick ABall APaddle Bricks 1 1 n
MDAFA 2004 Presentation10Dennis Wagelaar Refining Concepts (1) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Several kinds of refinements exist: – Solution Patterns: template designs – Implementation Patterns: code templates – Model Transformations: executable model adaptors – Implementation Generators: executable code generators
MDAFA 2004 Presentation11Dennis Wagelaar Refining Concepts (2) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Refinements can be inherited from or superimposed on other concepts Icons are used to mark often-used concepts: when inheriting refinements, the icon is also inherited Refinements replace the original concept, unless specified otherwise
MDAFA 2004 Presentation12Dennis Wagelaar “Brick” Solution Pattern Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions java.awt.Panel Brick Is Breakout Ball Paddle Brick ABall APaddle Bricks 1 1 n
MDAFA 2004 Presentation13Dennis Wagelaar Refining Models (1) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout Ball Paddle Brick ABall APaddle Bricks 1 1 n BreakoutStructure Breakout Ball Paddle Brick
MDAFA 2004 Presentation14Dennis Wagelaar Refining Models (2) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions BreakoutStructure Ball Paddle Brick Breakout BreakoutFactory Product IBreakoutFactory IBF Parent Child IBreakout IBF Parent Child...
MDAFA 2004 Presentation15Dennis Wagelaar “Factory” Solution Pattern Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Factory CreateProduct Returns Product [0..*] return new (); Implementation Pattern
MDAFA 2004 Presentation16Dennis Wagelaar Describing Context Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Based on Faceted Classification Each design element can have a tree of general “properties” Constraints can be defined over these “property” trees –Can be inverted –Can be combined with an AND operator or an OR operator
MDAFA 2004 Presentation17Dennis Wagelaar Example Constraint (1) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions brickSolution Device PlatformConstraint Platform Java Windows CE PocketPC 2002 constrainedElement Platform Java Personal Java A constraint holds if the leaf properties of the common subtree are also leaf properties in the original property tree (left)
MDAFA 2004 Presentation18Dennis Wagelaar Example Constraint (2) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions brickSolution Device PlatformConstraint Platform Java Windows CE PocketPC 2002 constrainedElement Platform Java Personal Java Constraint holds, since “Java” was already a leaf element in the original tree on the left.
MDAFA 2004 Presentation19Dennis Wagelaar Example Constraint (3) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions brickSolution Device PlatformConstraint Platform Java Windows CE PocketPC 2002 constrainedElement Platform Java Personal Java Constraint does not hold, since “Java” was not a leaf element in the original tree on the left. Java 2
MDAFA 2004 Presentation20Dennis Wagelaar Context-Driven Refinement Based on Synthesis-Based Design Consists of 4 steps: 1.Choose refinements 2.Apply refinements 3.Determine implementation properties 4.Generate code Alternative: export low-level UML Constraint checking after each step Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions
MDAFA 2004 Presentation21Dennis Wagelaar 1. Choose refinements Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions brickSolution1 Platform Java Brick brickSolution2 Platform Windows CE brickSolution3 Platform Java Java 2 Device PlatformConstraint Platform Java Java 2 J2ME Preferred
MDAFA 2004 Presentation22Dennis Wagelaar 2. Apply refinements (1) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions BreakoutStructure Breakout BreakoutFactory Product IBreakoutFactory IBF Parent Child IBreakout IBF Parent Child Ball Paddle Brick...
MDAFA 2004 Presentation23Dennis Wagelaar 2. Apply refinements (2) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions BreakoutStructure Breakout BreakoutFactory Product IBreakoutFactory IBF Parent Child IBreakout IBF Parent Child Ball Paddle Brick... Breakout Ball Paddle Brick ABall APaddle Bricks 1 1 n
MDAFA 2004 Presentation24Dennis Wagelaar 2. Apply refinements (3) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout BreakoutFactory Product IBreakoutFactory IBF Parent Child IBreakout IBF Parent Child Ball Paddle Brick ABall 1 APaddle 1 Bricks n Breakout Ball Paddle Brick ABall APaddle Bricks 1 1 n Relationships are transferred
MDAFA 2004 Presentation25Dennis Wagelaar 2. Apply refinements (4) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout BreakoutFactory Product IBreakoutFactory IBF Parent Child IBreakout IBF Parent Child Ball Paddle Brick ABall 1 APaddle 1 Bricks n Factory CreateProduct Returns Product [0..*]
MDAFA 2004 Presentation26Dennis Wagelaar 2. Apply refinements (5) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout BreakoutFactory IBreakoutFactory IBF Parent Child IBreakout IBF Parent Child Ball Paddle Brick ABall 1 APaddle 1 Bricks n CreateBreakout Returns... Factory CreateProduct Returns Product [0..*] Names are adapted
MDAFA 2004 Presentation27Dennis Wagelaar 2. Apply refinements (6) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout BreakoutFactory IBreakoutFactory IBF Parent Child IBreakout IBF Parent Child Ball Paddle Brick ABall 1 APaddle 1 Bricks n CreateBreakout Returns... Model Transformation
MDAFA 2004 Presentation28Dennis Wagelaar 2. Apply refinements (7) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout BreakoutFactory IBreakoutFactory IBreakout Ball Paddle Brick ABall 1 APaddle 1 Bricks n CreateBreakout Returns... Is Add inheritance
MDAFA 2004 Presentation29Dennis Wagelaar 2. Apply refinements (8) Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Breakout BreakoutFactory IBreakoutFactory IBreakout Ball Paddle Brick ABall 1 APaddle 1 Bricks n CreateBreakout Returns... Is CreateBreakout Returns Move references Copy public methods
MDAFA 2004 Presentation30Dennis Wagelaar 3. Implementation properties Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Brick JavaClassGenerator Platform Java Construct Class Visibility Concreteness Public Protected Private Implementation Concrete Abstract... Implementation Generators impose special properties
MDAFA 2004 Presentation31Dennis Wagelaar 3. Implementation properties Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Brick JavaClassGenerator Platform Java Construct Class Visibility Concreteness Public Protected Private Implementation Concrete Abstract... Constraints and heuristics are used choose from multiple properties
MDAFA 2004 Presentation32Dennis Wagelaar 4. Generate code Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions Implementation Generators are applied: –Generate code for a specific concept –Insert Implementation Patterns –Invoke Implementation Generators of nested concepts
MDAFA 2004 Presentation33Dennis Wagelaar Conclusions CoCompose2 fits in MDA vision: allows definition of multiple layered refinements Specifically suited for Ambient Intelligence: context description Alternative refinements can be automatically chosen and applied Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions
MDAFA 2004 Presentation34Dennis Wagelaar Future Work Refinement mechanism must be specified in more detail –Experiences with CoCompose tool show possible scalability problems: these must be addressed Tool support has to be extended –Necessary features are (1) automated refinement, (2) UML import/export, (3) code generation, etc. Refinement problems Context-Aware Modelling Context-Driven Refinement Conclusions
MDAFA 2004 Presentation35Dennis Wagelaar Questions?