20
Automatic Application of Visitors to Evolving Domain-Specific Languages Computer Science Department University of York 1 & Willink Transformations Ltd 2 . Adolfo Sánchez-Barbudo Herrera 1 , Ed Willink 2 , Richard Paige 1 , Louis Rose 1 , Dimitris Kolovos 1 ([email protected] [email protected] [email protected] , [email protected] , [email protected] )

Automatic Application of Visitors to Evolving Domain-Specific Languages

Embed Size (px)

DESCRIPTION

MDE-based approach to automatically apply the Visitor design pattern to your Ecore-based languages (DSLs)

Citation preview

Page 1: Automatic Application of Visitors to Evolving Domain-Specific Languages

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])

Page 2: Automatic Application of Visitors to Evolving Domain-Specific Languages

Agenda

● Introduction to Modeling (MDSD, MDE,...)● Model Behaviour● Model Evolution● Visitor Pattern● Visitor Generation Framework (VGF)● VGF for Model Behaviour Evolution● Conclusions

2

Page 3: Automatic Application of Visitors to Evolving Domain-Specific Languages

● 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

Page 4: Automatic Application of Visitors to Evolving Domain-Specific Languages

With a modeling language you can create model instances, which correspond to objects at runtime.

Modeling Introduction II4

Page 5: Automatic Application of Visitors to Evolving Domain-Specific Languages

Modeling Introduction III

● MDE techniques to support software development:

Model to Text Transformations

Model to Model Transformations

5

Page 6: Automatic Application of Visitors to Evolving Domain-Specific Languages

Model Behaviour

● Model concepts may comprise behaviour● Usually modelled as Operations

A user can create new posts in a given uBlog

6

Page 7: Automatic Application of Visitors to Evolving Domain-Specific Languages

Model Evolution

● Model evolution - like SW evolution - is a recurrent and open issue.

7

Page 8: Automatic Application of Visitors to Evolving Domain-Specific Languages

Model Evolution II

● Same issues regarding behaviour.

8

Page 9: Automatic Application of Visitors to Evolving Domain-Specific Languages

Visitor Pattern● OOP design pattern

○ Well known solutions to a recurring problem● Separate structure from behaviour

9

Page 10: Automatic Application of Visitors to Evolving Domain-Specific Languages

Visitor Pattern II

● Main advantage○ Add/Remove/Modify/Replace behaviour without

changing structure.○ Ideal when working with third party structures.

10

Page 11: Automatic Application of Visitors to Evolving Domain-Specific Languages

Visitor Pattern III

● Main disadvantage○ It’s not the ideal pattern with evolving structures.

11

Page 12: Automatic Application of Visitors to Evolving Domain-Specific Languages

Visitor Pattern IV

● Visitors applied to modeling languages

12

Page 13: Automatic Application of Visitors to Evolving Domain-Specific Languages

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

Page 14: Automatic Application of Visitors to Evolving Domain-Specific Languages

Visitor Generation Framework II

● M2M transformation to prepare the DSL

14

Page 15: Automatic Application of Visitors to Evolving Domain-Specific Languages

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

Page 16: Automatic Application of Visitors to Evolving Domain-Specific Languages

Visitor Generation Framework IV

● VGF abstract visitors examples:

16

Page 17: Automatic Application of Visitors to Evolving Domain-Specific Languages

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

Page 18: Automatic Application of Visitors to Evolving Domain-Specific Languages

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

Page 19: Automatic Application of Visitors to Evolving Domain-Specific Languages

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

Page 20: Automatic Application of Visitors to Evolving Domain-Specific Languages

Thank you very much

Questions ?

doubts, feedback, enquiries, etc. to [email protected]