Upload
the-university-of-york
View
144
Download
1
Embed Size (px)
DESCRIPTION
MDE-based approach to automatically apply the Visitor design pattern to your Ecore-based languages (DSLs)
Citation preview
Automatic Application of Visitors to Evolving
Domain-Specific Languages
Computer Science DepartmentUniversity of York1
& Willink Transformations Ltd2.
Adolfo Sánchez-Barbudo Herrera1, Ed Willink2, Richard Paige1, Louis Rose1, Dimitris Kolovos1
([email protected] [email protected] [email protected], [email protected], [email protected])
Agenda
● Introduction to Modeling (MDSD, MDE,...)● Model Behaviour● Model Evolution● Visitor Pattern● Visitor Generation Framework (VGF)● VGF for Model Behaviour Evolution● Conclusions
2
● Models as main artefact for developing SW● Models as abstract representations of SW● Higher level of abstraction than programs● Programs replaced by Models
Modeling Introduction
uBlog DSL
3
With a modeling language you can create model instances, which correspond to objects at runtime.
Modeling Introduction II4
Modeling Introduction III
● MDE techniques to support software development:
Model to Text Transformations
Model to Model Transformations
5
Model Behaviour
● Model concepts may comprise behaviour● Usually modelled as Operations
A user can create new posts in a given uBlog
6
Model Evolution
● Model evolution - like SW evolution - is a recurrent and open issue.
7
Model Evolution II
● Same issues regarding behaviour.
8
Visitor Pattern● OOP design pattern
○ Well known solutions to a recurring problem● Separate structure from behaviour
9
Visitor Pattern II
● Main advantage○ Add/Remove/Modify/Replace behaviour without
changing structure.○ Ideal when working with third party structures.
10
Visitor Pattern III
● Main disadvantage○ It’s not the ideal pattern with evolving structures.
11
Visitor Pattern IV
● Visitors applied to modeling languages
12
Visitor Generation Framework
● MDE based prototype to automatically apply the visitor pattern.
● Part 1. ○ Setup the DSL to apply the visitor pattern○ via a M2M Transformation.
● Part 2.○ Generate DSL-specific visitors framework○ via M2T Transformations.
13
Visitor Generation Framework II
● M2M transformation to prepare the DSL
14
Visitor Generation Framework III
● DSL-specific visitors framework generation
1. Visitor/Visitable Interfaces
2. Default Abstract Implementations
● Contextful Visitor● Null Visitor● Extending Visitor● Delegating Visitor● ...
15
Visitor Generation Framework IV
● VGF abstract visitors examples:
16
Visitor Generation Framework V
● VGF Overview
VGFDSL
Model
VisitableDSL
Implementation
Visitor/Visitable
Interfaces
AbstractVisitors
Impl.
DSL-Specific Visitors Framework
ManualVisitors
GeneratedVisitors
More MDE-basedgenerators
Manual Generated
17
VGF for models behaviour evolution
● Evolving behaviour - Same structure
● Evolving structure - Same behaviour
Behaviour No Model Visitors Model Visitors VGF
Adding Changes DSL Ok Ok
Removing Breaks clients Breaks clients Breaks clients
Modifying Changes DSL Ok Ok
Structure No Model Visitors Model Visitors VGF
Adding Ok Breaks visitors Ok
Removing Breaks clients Breaks clients Breaks clients
Modifying Ok Ok Ok
Convenient Inconvenient Very Inconvenient
18
Conclusions
● VGF:○ Automatically brings the benefits of the visitor
pattern to DSLs○ Automatically creates a DSL-specific framework to
leverage visitors creation○ It´s a convenient practice when a DSL has unclear
behaviour or an evolving one○ It may mitigate the drawbacks of the visitor pattern
with respect to language structure evolution
19