sound, yet flexible, modeling: a language engineering point of view
TRANSCRIPT
KEYNOTE @ FLEXMDE 2017, AUSTIN, TX, USA.
SOUND YET FLEXIBLE MODELING A LANGUAGE ENGINEERING POINT OF VIEW
BENOIT COMBEMALEPROFESSOR, UNIV. TOULOUSE, FRANCE
HTTP://COMBEMALE.FR [email protected]@BCOMBEMALE
Who Care About Flexible Modeling?
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Software intensive systems
▸ Multiple concerns & stakeholders
▸ Multi-engineering approach
▸ Software as an integration layer
Who Care About Flexible Modeling?
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Software intensive systems
▸ Recurring paradigms
▸ Evolving DSLs
▸ Collaborative modeling
FROM A LANGUAGE ENGINEERPOINT OF VIEW
All different,
but some are similar…
What it means from a language engineer point of view?
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
UML vs. Classical vs. Rhapsody Statecharts: Not All Models are Created EqualMichelle L. Crane, Jürgen Dingel
In Software & Systems Modeling (SoSyM), 2007
What it means from a language engineer point of view?
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Language (and tool support) Interoperability
▸ Foster model sharing and collaboration
▸ Manipulate models in different environments
▸ Reuse tools and services
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
In practice…
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
GRAMMARWAREParse…
MODELWAREConform To…
Limits of the conformance relation
▸ In MDE, a metamodel is the cornerstone artifact defining a DSL
▸ The conformance relation states
▸ Which models are valid instances of a given DSL
▸ How these models must be manipulated wrt. this DSL
▸ Theoretical limitations : ~ structural nominal typing
▸ Conformance is based on instantiation
▸ Conformance is nominal
▸ A model conforms to one and only one metamodel
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Limits of the conformance relation
▸ Analyze UML models publicly available on Github▸ Conforming to the UML implementation of Eclipse▸ 1651 models – UML2.2 to UML2.5▸ Force to bypass the conformance check
▸ Key findings▸ 7% of the models are valid wrt. only one version of UML▸ 83% of the models are valid wrt. every version of UML
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Safe model polymorphism for flexible modelingThomas Degueule, Benoît Combemale, Arnaud Blouin, Olivier Barais, Jean-Marc Jézéquel
In Computer Languages, Systems & Structures (COMLAN), 49: 176-195 , 2017
Towards a flexible typing relationship
▸ Conformance:▸ Used for creating models
▸ Bounds to a language implementation (i.e., metamodel)
▸ Typing:▸ Used to reason over models
▸ Relies on a language interface (which can possibly abstract a family of similar languages)
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
On model typingJim Steel, Jean-Marc Jézéquel
In Software and System Modeling (SoSyM), 2007
On Language Interface
▸ A language interface is a contract that exhibits the relevant information for a given purpose (i.e., to support specific operators or relations)
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Towards Language-Oriented ModelingBenoit Combemale, 2015
http://people.irisa.fr/Benoit.Combemale/hdr
On Language Interface
▸ Abstract over the intrinsic complexity of language implementations
▸ Expose meaningful information▸ Concerning an aspect of a language (e.g. abstract syntax)▸ For a given purpose (e.g. composition, coordination, analysis)▸ In an appropriate formalism (e.g. a metamodel, a control-flow graph)
▸ Provide a reasoning layer atop a language implementation
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
xDSML2xDSML1
structural/axiomatic
behavioral
xDSML3
subtypingrelation
coordinationpattern
TOWARDS A MODEL TYPE SYSTEM FOR MODEL POLYMORPHISM
Static Dynamic
Structural
Behavioral
Dimensions of Model Typing
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
[Guy et al.]
[Sun et al.]
[Steel et al.]
[Degueule et al.]
[de Lara et al.] [de Lara et al.]
Many more dimensions for model typing (e.g., [de Lara et al., TOSEM2017]), but no consensus on a proper classification of them…
Polymorphic language reuse with model typing
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
▸ Conformance relation ensures safe manipulation regardlessof context▸ But it hinders flexibility
Polymorphic language reuse with model typing
▸ Proposition: ▸ Model Types as structural interfaces atop language implementations▸ Flexible subtyping relations to support model polymorphism
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
On model typingJim Steel, Jean-Marc Jézéquel
In Software and System Modeling (SoSyM), 2007
On model subtypingClement Guy, Benoît Combemale, Steven Derrien, Jim Steel, Jean-Marc Jézéquel
In EU Conf. on Modelling Foundations and Applications (ECMFA), 2012
Using Model Types to Support Contract-Aware Model SubstitutabilityWuliang Sun, Benoît Combemale, Steven Derrien, Robert B. France
In EU Conf. on Modelling Foundations and Applications (ECMFA), 2013
Model typing in Kermeta 1, 2, 3!
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Model types as structural interfaces atop language implementations
@Aspect(className = FSM)class ExecutableFSM {State current
def void execute() {_self.states.forEach[…]
}}
…
<<implements>>
§ Manually written§ Inferred from a language§ Inferred from a footprint§ Static (metamodel level) or
dynamic (model level)
Model typing in Kermeta 1, 2, 3!
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
▸ States whether models typed by a given MT can be substituted to models typed by another MT
▸ Different subtyping relations [Guy et al.]▸ Total isomorphic▸ Partial isomorphic▸ Total non-isomorphic▸ Partial non-isomorphic
▸ Up to behavioral substitutability [Sun et al.]
▸ The choice of a subtyping relation vary with particular needs
Model typing in Melange!
▸ Model types defined explicitly or inferred from implementations
▸ Implementation relations defined explicitly or automatically inferred▸ Based on structural typing▸ Using the total isomorphic subtyping relation
▸ Simple renaming operator to align structurally dissimilar languages
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
// Explicit model type definition// e.g. a footprint that captures// the contract of a transformationmodeltype FsmMT {syntax ‘FsmMT.ecore’
}
// Language definitionlanguage GuardFsm {syntax ‘GuardFsm.ecore’with ExecutableFsmwith ExecutableStatewith ExecutableTransitionexactType GuardFsmMT
}
// Explicit implementationlanguage OtherFsm implements FsmMT {[…]renaming ‘otherfsm’ to ‘fsm’
}
transformation p-print(FsmMT m) {val root = m.contents.headm.states.forEach[s | print(s)]
}
Context Matters!
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Reuse is not enough! Context matters!
Imported / inherited DSMLs may not fit exactlydomain-specific requirements
èFinely tune with customization facilities
Melange: Language algebra with substitutability
▸ Language extension withlanguage inheritance
▸ Language unification withlanguage merging
▸ Language restriction withlanguage slicing
▸ Syntax merging and semantics’ weaving as fine-grainedcustomization mechanisms
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Melange: a meta-language for modular and reusable development of DSLsThomas Degueule, Benoît Combemale, Arnaud Blouin, Olivier Barais, Jean-Marc Jézéquel
In Int. Conf. on Software Language Engineering (SLE), 2015
Melange Resource: Seamless Model Polymorphism
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Safe model polymorphism for flexible modelingThomas Degueule, Benoît Combemale, Arnaud Blouin, Olivier Barais, Jean-Marc Jézéquel
In Computer Languages, Systems & Structures (COMLAN), 49: 176-195 , 2017
"How to fit type group semantics, structural typing, and family polymorphism in a language (Java) and framework (EMF) that do not support any of them"
Experiment: a Family of FSM Languages
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
c
module FlattenFsm;create OUT : FlatFsm from
IN : CompositeFsmMT;-- Creates a new FlatFsmrule SM2SM {
from sm1 : CompositeFsmMT!StateMachineto sm2 : FlatFsm!StateMachine
}-- Initial states of composite-- states become regular statesrule Initial2State {
from is1 : CompositeFsmMT!InitialState(not is1.parentState.oclIsUndefined())
to is2 : FlatFsm!State(stateMachine <- is1.stateMachine,name <- is1.name)
}-- Resolves a transition originating from-- a composite state rule T2TB {
from t1: CompositeFsmMT!Transition,src : CompositeFsmMT!CompositeState, trg : CompositeFsmMT!State,c : CompositeFsmMT!State (
t1.source = src andt1.target = trg andc.parentState = src andnot trg.oclIsTypeOf(CompositeFsmMT!CompositeState))
to t2 : FlatFsm!Transition (name <- t1.name,stateMachine <- t1.stateMachine,source <- c,target <- trg )
}
c
modeltype FsmMT uses “http://fsmmt/”;modeltype Fsm uses “http://fsm/”;
transformation dummyInvert(in inFsm : FsmMT, out outFsm : Fsm);
main() {inFsm.rootObjects()[FsmMT::FSM] ->map mapFSM();
}mapping FsmMT::FSM::mapFSM():Fsm::FSM {
ownedState := self.ownedState -> map mapState();initialState := self.finalState -> first().map
mapState();finalState := self.initialState.map mapState();
}mapping FsmMT::State::mapState() : Fsm::State {
name := self.name;outgoingTransition :=self.incomingTransition -> map mapTransition();
}mapping FsmMT::Transition::mapTransition() : Fsm::Transition {
input := self.input;output := self.output;target := self.source.map mapState();
}
TransfoFsm.qvto
c
// Delegate the execution of the state// machine "fsm" to the "execute" method// of its operational semantics.public void execute(
StateMachine fsm, String input) {// Dynamically dispatched on the actual// language implementation of execute()root.execute(input);
}
List<String> models = new ArrayList<>();models.add("melange:/m1.flat?mt=FlatFsmRtcMT");models.add("melange:/m2.timed?mt=FlatFsmRtcMT");models.add("melange:/m3.hier?mt=FlatFsmRtcMT");models.add("melange:/m4.timedhier?mt=FlatFsmRtcMT");ResourceSet rs = new ResourceSetImpl();
// Load the model pointed by the given// URI, retrieve its root StateMachine,// and execute itfor (String uri : models) {
Resource res = rs.getResource(uri,true);StateMachine root = (StateMachine)res.getContents().get(0);
execute(res, "{x;y;z;o;p;q}");}
ExecuteFsm.java
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Syntax & SemanticsOverview
Inheritance, implementation,
and subtyping relations
Interfaces description
Currently registeredlanguages & interfaces
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Syntax & SemanticsOverview
Inheritance, implementation,
and subtyping relations
Interfaces description
Currently registeredlanguages & interfaces
Built atop Eclipse, EPL-1.0 license
Seamlessly integrated with the EMF ecosystem
~30k Xtend LoC / 500k Java LoC
10 contributors, ~2000 commits
http://melange-lang.org
Parametric language reuse with generic metamodeling
▸ Inspired from generic programming:▸ Concept: additional typing to implement MT independently of
metamodels▸ Structural typing▸ Bind to metamodels through explicit, possibly flexible, relationships
▸ Template: use concept as requirement for their generic parameters, and are applied to model/metamodel
▸ Mixin layers: define functional layers for metamodel extensibility
▸ Implemented in MetaDepth
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Juan de Lara, Esther GuerraGeneric Meta-modelling with Concepts, Templates and Mixin Layers
In Int. Conf. on Model Driven Engineering Languages and Systems (MoDELS), 2010
A-posteriori Typing
▸ Model retyping decouple object creation from classification
▸ Model retyping is▸ Multiple classifiers, ▸ partial, ▸ either static (metamodel level) or dynamic (model level)
▸ Implemented in MetaDepth
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
A Posteriori Typing for Model-Driven Engineering: Concepts, Analysis, and ApplicationsJuan de Lara, Esther Guerra
In ACM Trans. Softw. Eng. Methodol. (TOSEM), 25:4, 2017
Other approaches (among others)
▸ Arnaud Cuccuru, Chokri Mraidha, François Terrier, Sébastien Gérard: TemplatableMetamodels for Semantic Variation Points. ECMDA-FA 2007
▸ Antonio Vallecillo, Martin Gogolla: Typing Model Transformations Using Tracts. ICMT 2012
▸ Andrés Vignaga, Frédéric Jouault, María Cecilia Bastarrica, Hugo Brunelière: Typing artifactsin megamodeling. Software and System Modeling (SoSyM), 2013
▸ Bernard Carré, Gilles Vanwormhoudt, Olivier Caron: From subsets of model elements to submodels - A characterization of submodels and their properties. Software and System Modeling (SoSyM), 2015
▸ Louis M. Rose, Esther Guerra, Juan de Lara, Anne Etien, Dimitris S. Kolovos, Richard F. Paige: Genericity for model management operations. Software and System Modeling (SoSyM), 2013
▸ Juan de Lara, Juri Di Rocco, Davide Di Ruscio, Esther Guerra, Ludovico Iovino, Alfonso Pierantonio, Jesús Sánchez Cuadrado: Reusing Model Transformations Through TypingRequirements Models. FASE 2017
▸ Etc.
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
TOWARDS CONCERN-ORIENTEDLANGUAGE DEVELOPMENT
Concern-Oriented Development
▸ Concern = ▸ Unit of reuse
▸ Domain-specific:▸ Encapsulates realization
artifacts related to a specific feature or development issue
▸ Generic: ▸ Includes and integrates all
relevant (functional) variations and realizations of solutions
▸ Crosscutting
▸ Long-lived
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Concern-Oriented Software DesignAlam O., Kienzle J., Mussbacher G.
In Int. Conf. on Model Driven Engineering Languages and Systems (MoDELS), 2013
Concern
Customization
Use
ReqModel
TestModel
DesignModel
<<trace>>
<<trace>>
Variability
…
<<trace>>
VCU: The Three Dimensions of Reuse
• Variability: select/configure what you want to reuse• Customization: adapt it to your own context• Usage: use it!
• VCU provides a powerful unified framework enhancing reuse, and cross-fertilizing various disciplines separately investigated (MDE, SPL, CBSE, OO…)
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Usage (U)Variation (V) Customization (C)
VCU: The Three Dimensions of ReuseJ. Kienzle, G. Mussbacher, O. Alam, M. Schöttle, N. Belloir, P. Collet, B. Combemale, J. DeAntoni, J. Klein, and B. Rumpe
In Int. Conf. on Software Reuse (ICSR), 2016
Concern-Oriented Development: CORE/COLD
▸ CORE at the model-level
▸ COLD at the language-level
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Metalanguage
Language
Model
COLD
CORE
Concern-Oriented Language Development
▸ Research questions: ▸ V: what means a goal model? how to breakdown a DSL?▸ C: which customization operators? ▸ U: how to get a full-fledged language protocol?
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Manuel Leduc’s PhD, Univ. Rennes 1, France
xDSML
Customization
Use
AbstractSyntax(AS)
ConcreteSyntax(CS)
SemanticsDomain(SD)
Mac
Mas
VariabilityV&V tools
editors
generators
CONCLUSION
Take Away Messages
▸ Flexibility in MDE is key for further adoption▸ the FlexMDE community is a great opportunity!
▸ This talk takes voluntarily an SLE point of view, others are relevant too!▸ co-evolution, sketching, globalization, agile modeling…
▸ Proposal: a sound, yet flexible, model type system for MDE▸ Typing relationship based on language interfaces▸ Subtyping relationships with possible isomorphic adaptions▸ Language algebra with substitutability (merge, slice, inherit…)
▸ Ongoing work▸ concern-oriented language development (COLD)▸ unifying theory for model and language reuse
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017
Hack your own languages?Join us in the MDE/SLE group of the CNRS IRIT lab, in a freshly rebuilt campus of the warm city of Toulouse!
Open Positions for PhD and Postdoc
BENOIT COMBEMALEPROFESSOR, UNIV. TOULOUSE, FRANCE
HTTP://COMBEMALE.FR [email protected]@BCOMBEMALE
Sound Yet Flexible Modeling: A Language Engineering Point of View
Abstract.
Domain-Specific Languages (DSLs) are increasingly used by domain expertsto handle various concerns in systems and software development. Tosupport this trend, the Model-Driven Engineering community has developedadvanced techniques for designing new DSLs. However, the widespread useof independently developed, and constantly evolving DSLs is hampered bythe rigidity imposed to the language users by the DSLs and their tooling,e.g., for manipulating a model through various similar DSLs or successiveversions of a given DSL.
In this talk, I discuss a sound yet flexible model type system to supportvarious scenarios of flexible modeling. I review different existingapproaches, and highlight how they provide flexibility to language users.Finally, I conclude with a long term initiative for a full-fledged unifyingapproach for language reuse, aka. a Concern-Oriented LanguageDevelopment (COLD), and the expected flexibility for language users.
Sound yet Flexible ModelingBenoit Combemale @ FlexMDE, Sep. 2017