Organization of DSLE part • Tooling Domain Specific Language Domain Specific Language • Eclipse plus EMF Engineering • Xtext, Xtend, Xpand, QVTo and ATL • Topics: Prof.dr. Mark van den Brand • Model driven software engineering Model driven software engineering GLT 2010/11 − Meta-modeling − Model transformations • Domain specific language design and engineering − Textual / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 1 Overview of DSLE Model driven software engineering • Model driven software engineering in general • Models are used everywhere g g g y • Grammars, signatures and meta-models • DSL Design • Model transformations • Code generation / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 2 / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 3
Model driven software engineering Model driven software engineering • Models increase the level of abstraction • Models are abstractions of real life objects j • used for both hardware and software design • often manually translated into design documents and code and code • no guarantee for consistency between model, design and resulting code / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 4 9-11-2010 PAGE 5 Model driven software engineering Model driven software engineering • Whole range of modeling languages are • UML is unified: g g g g developed over the years: • Class diagrams • data oriented, e.g., E/R models, class diagrams • Object diagrams • Use cases • Use cases • behaviour oriented, e.g., use cases, state b h i i t d t t • State machine diagrams machines, sequence diagrams, activity diagrams • Sequence diagrams • architecture oriented, e.g., package diagrams, • Activity diagrams component diagrams • Component diagrams • etc. • Standardization initiative of OMG: Standardization initiative of OMG: • Unified Modeling Language • UML is too “universal” / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 6 / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 7
Model driven software engineering Model driven software engineering • Criticism on UML: • UML is too “universal”: a general purpose modeling g g • It contains many diagrams and constructs that are language redundant or infrequently used. • Domain specific extension via: • Problems in learning and adopting • Problems in learning and adopting. • Profile diagram operates at the meta model level to P fil di t t th t d l l l t • Linguistic incoherence. show • Capabilities of UML and implementation language − stereotypes as classes with the <<stereotype>> stereotype, and • Dysfunctional interchange format. − profiles as packages with the <<profile>> stereotype • Meta modeling • Meta modeling / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 8 9-11-2010 PAGE 9 Model driven software engineering Model driven software engineering • Meta-Object Facility (MOF) is a four-layered architecture: • M3 Meta-Meta-Model Layer − defines structure of the meta-metadata − it provides a meta-meta model at the top layer • M2 M t M2 Meta-Model Layer M d l L − defines the structure of the metadata − the M3-model is used to build meta models − the most prominent example is the UML meta model the model that the most prominent example is the UML meta model, the model that describes the UML itself • M1 Model Layer − describes the data in the information layer − the M2-models describe elements of the M1-layer − For example, models written in UML • M0 Model Layer − describes objects or data in the information layer / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 10 / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 11
Model driven software engineering Model driven software engineering • Meta-Object Facility (MOF) is the OMG standard j y ( ) EMF Model Definition • no implementation • What is an EMF “model”? • EMF is the Eclipse implementation of MOF • Specification of an application’s data − Object attributes − Relationships (associations) between objects − Operations available on each object Operations available on each object − Simple constraints (e.g., multiplicity) on objects and relationships • Essentially the Class Diagram subset of UML E ti ll th Cl Di b t f UML / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 12 9-11-2010 PAGE 13 Model driven software engineering Model driven software engineering • What does EMF provide • EMF is middle ground in the modeling vs. programming world • • Meta-model Focus is on class diagram subset of UML modeling (object model) − A general model of models from which any model can be defined • Transforms models into efficient, correct, and easily customizable Java code − Models classes, attributes, relationships, data types, etc. • Provides the infrastructure to use models effectively in your code − Referred to as Ecore − Ecore is just another EMF model • Very low cost of entry • EMF is used to implement EMF! • • Tooling support within the Eclipse framework Full scale graphical modeling tool not required • • EMF is free Runtime environment • − Reflective and dynamic model invocation Small subset of UML − XML/XMI default model serialization / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 14 / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 15
Model driven software engineering Model driven software engineering • EMF Components • Simplified Ecore meta-model • EClass models classes Simplified Ecore meta model EClass models classes • EMF Core themselves − Ecore meta model • identified by name − Model change notification − Persistence and serialization • number of attributes number of attributes − Reflection API • number of reference − Runtime support for generated models • EAttribute models attributes − Change model and recorder − Validation framework Validation framework • • identified by name identified by name • EMF Edit • has a type − Helps integrate models with a rich user interface • EDataType represents − Used to build editors and viewers for your model − simple types i l t Includes default reflective model editor Includes default reflective model editor • EMF Codegen − Code generator for core and edit based components − Model importers from Rose, XML, or Java interfaces / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 16 9-11-2010 PAGE 17 Model driven software engineering Model driven software engineering • EReference models • Classes, abstract classes and interfaces • Simplified Ecore meta-model Simplified Ecore meta model associations between classes • identified by name • has a type which must be an ECl EClass • containment attribute • Attributes and Operations indicating whether the EReference is used as whole- EReference is used as “whole- part” relationship / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 18 / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 19
Model driven software engineering Model driven software engineering • Creation of abstract class • Associations in the meta-model: • One way association • Bidirectional association / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 20 9-11-2010 PAGE 21 Model driven software engineering Model driven software engineering • Associations in the meta-model: • EMF is suited for modeling domain specific g languages • Containment association • Inherit association / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 22 / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 23
Model driven software engineering Model driven software engineering • What is a Domain Specific Language (DSL)? • How do we design a Domain Specific Language? p g g ( ) g g g • Establish needed language concepts − domain specific • A DSL is a formal, procesable language targeting − abstract b t t at a specific aspect of a system − corresponding semantics • Its semantics, flexibility and notation is designed in • Graphical vs textual representation G ap ca s te tua ep ese tat o order to support working with that aspect as good order to support working with that aspect as good • Develop tooling as possible / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 24 9-11-2010 PAGE 25 Model driven software engineering Model driven software engineering • Example of a Domain Specific Language • State machine based g g • Specifying and Implementing the Controllers of Conveyor • combination of: Belts − graphical models and − We defined a domain specific language (DSL) for modeling p g g ( ) g − textual models textual models communicating systems • conditional message − Stepwise refinement to adapt the characteristics of the exchange communication channels to the Lego Mindstorms platform − plus activities plus activities • No data yet • No timing yet / Faculteit Wiskunde en Informatica 9-11-2010 PAGE 26
Recommend
More recommend