Upload
ralf-laemmel
View
320
Download
4
Embed Size (px)
Citation preview
© Software Languages Team, University of Koblenz-Landau
Modeling software systems at a macroscopic scale
Ralf LämmelSoftware Languages Team
University of Koblenz-Landau, Germany Joint work with Jean-Marie Favre, Andrei Varanovich, and Vadim Zaytsev
https://github.com/avaranovich/megal
http://softlang.uni-koblenz.de/mega
© Software Languages Team, University of Koblenz-Landau
Source: Colin Atkinson, Thomas Kühne: Model-Driven Development: A Metamodeling Foundation. IEEE Software (SOFTWARE) 20(5):36-41 (2003)
Who is Lassie?
What’s wrong with *modeling?
© Software Languages Team, University of Koblenz-Landau
http://en.wikipedia.org/wiki/Lassie
http://www.counter-currents.com/wp-content/uploads/2011/10/Lassie.jpg
Too many implicit assumptions!
© Software Languages Team, University of Koblenz-Landau
A typical software project(at the macroscopic scale)
programming languages (e.g., Java, PHP, JavaScript, or Python)
DSLs (e.g., CSS, XSLT, or SQL)
library-based languages(e.g., JQuery, DOM API)
configuration languages(e.g., Hibernate mapping)
models
schemas
models
“many” languages and technologies“somehow” related
© Software Languages Team, University of Koblenz-Landau
Can we model software projects more preciselyin terms of languages,
technologies,and concepts?
© Software Languages Team, University of Koblenz-Landau
A megamodel is a model of which at least some elements represent and/or refer to models or metamodels.
Source: Bezivin, J., Jouault, F., Valduriez, P.: On the need for Megamodels. In: Proceedings of the OOPSLA/GPCE: Best Practices for Model-Driven Software Development workshop (2004)
We embrace this notion in the broadest sense: programs are models and grammars are
metamodels (or v.v.) etc.
© Software Languages Team, University of Koblenz-Landau
A megamodel
ATL Documentations !
! ATL Starter’s Guide Date 07/12/2005
Page 2!
MMM
MMt
Ma Mb
MMa
Mt
MMb
conformsTo
conformsTo conformsTo
conformsTo
conformsTo
conformsTo
Transformation
MMMMMM
MMtMMt
MaMa MbMb
MMaMMa
MtMt
MMbMMb
conformsTo
conformsTo conformsTo
conformsTo
conformsTo
conformsTo
Transformation Figure 1. An overview of model transformation
Figure 1 summarizes the full model transformation process. A model Ma, conforming to a metamodel MMa, is here transformed into a model Mb that conforms to a metamodel MMb. The transformation is defined by the model transformation model Mt which itself conforms to a model transformation metamodel MMt. This last metamodel, along with the MMa and MMb metamodels, has to conform to a metametamodel (such as MOF or Ecore).
3 A simple transformation example This section introduces the transformation example that is going to be developed in the document. The aim of this first example is to introduce users with the basic concepts of the ATL programming. To this end, this example considers two similar metamodels, Author (Figure 2) and Person (Figure 3), that both encode data relative to persons.
Figure 2. The Author metamodel
Figure 3. The Person metamodel
Both metamodels are composed of a single eponym element: Author for the Author metamodel and Person for the Person metamodel. Both entities are characterized by the same couple of string properties (name and surname). The objective is here to design an ATL transformation enabling to generate a Person model from an Author model. The transformation to be designed will have to implement the following (obvious) semantics:
• A distinct Person element is generated for each source Author element; o The name of the generated Person has to be initialized with the name of the source
Author; o The surname of the generated Person has to be initialized with the name of the
source Author.
Source:http://wiki.eclipse.org/ATL/Concepts#Model_Transformation
Model transformations
with ATL
What to think of this part?
© Software Languages Team, University of Koblenz-Landau
A megamodel
Source:http://en.wikipedia.org/wiki/Tombstone_diagram
Bootstrapping a C compiler written in C, by compiling it using another compiler written in machine code.
© Software Languages Team, University of Koblenz-Landau
• Megamodeling must help with managing diversity and heterogeneity of software technologies.• Cognitive value is important!
Specific motivations of megamodeling:
Empirical Assessment of MDE in Industry by John Hutchinson, Jon Whittle, Mark Rouncefield and Steinar Kristoffersen
use of models for team communication
use of models for understanding a problem at an abstract level
use of models to capture and document designs
“Generic” motivations:
© Software Languages Team, University of Koblenz-Landau
The notion of megamodel
• Megamodels are (ER) models.
• Entities of interest‣ Languages‣ Technologies (components thereof)‣ Programs‣ ...
• Relationships of interest‣ Conformance‣ Transformation‣ ...
© Software Languages Team, University of Koblenz-Landau
How to validate megamodeling claims?
By “=” we mean (roughly) that one can define the same set of instances up to a uniquely defined isomorphism.
=?
© Software Languages Team, University of Koblenz-Landau
The upper frame uses the MegaL/yEd visual notation for megamodeling.
The lower frame shows some linked artifacts explained later in the paper.
Fig. 1. The linguistic architecture of a software product when displayed with the Me-gaL/Explorer tool.
technology for Object/XML mapping are clearly identifiable. Consider, for ex-
ample, the fact that the class generator is not described as generating ‘arbitrary’
C#. Instead, a designated subset, CSharpFromXsd, is used because the genera-
tor indeed produces very regular code whose regularity helps with understanding
Object/XML mapping, as we discuss later.
Demo
http://worker.101companies.org/MegaModels/implementations/xsdClasses/
© Software Languages Team, University of Koblenz-Landau
Linked megamodels
An entity is linked to a unique resource thatcan be browsed and examined
correspondsTo
© Software Languages Team, University of Koblenz-Landau
<xs:element name="company"> <xs:complexType> <xs:sequence> <xs:element ref="name"/> <xs:element maxOccurs="unbounded" minOccurs="0" ref="department"/> </xs:sequence> </xs:complexType> </xs:element>
http://101companies.org/resources/contributions/jaxbComposition/inputs/Company.xsd/element/xs:schema/element/xs:element?format=html
http://101companies.org/resources/contributions/jaxbComposition/src/main/java/org/softlang/company/xjc/Company.java/class/Company?format=html
public class Company {
@XmlElement(required = true) protected String name; protected List<Department> department;
/** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } .....
Use of fragments to establish an observable correspondence
© Software Languages Team, University of Koblenz-Landau
Key design principles of MegaL as general-purpose megamodeling language
• Entities and relationships are extensible.
• Everything is a resource, i.e.:
• accessible over HTTP.
• Relationships are executable.
© Software Languages Team, University of Koblenz-Landau
MegaL prelude// Entity typesSet < Entity .Artifact < Entity .Language < Set .Technology < Entity .Concept < Entity .File < Artifact .Folder < Artifact .
// Relationship typeselementOf < Entity * Set .subsetOf < Set * Set .partOf < Artifact * Artifact .instanceOf < Concept * Concept . isA < Concept * Concept . conformsTo < Artifact * Artifact .definitionOf < Artifact * Language .
© Software Languages Team, University of Koblenz-Landau
Some megamodels
Java : Language .extern JavaProgram : File .JavaProgram elementOf Java .
/* Models, metamodels, and conformance */Model < Artifact .Metamodel < Model .conformsTo < Model * Metamodel .
/* The MVC concept.MVC consists of model, view, and controller.Those subconcepts depend on the main concept.MVC is a design pattern.*/
MVC : Concept . Model @ MVC : Concept .View @ MVC : Concept .Controller @ MVC : Concept .DP ["Design pattern"] : Concept .
Model partOf MVC .View partOf MVC .Controller partOf MVC .MVC instanceOf DP .
© Software Languages Team, University of Koblenz-Landau
• Different sources of (partial) errors
• Extensibility of the language
• To be controlled by the type system
Design challenges of MegaL
© Software Languages Team, University of Koblenz-Landau
MegaL pipeline
event recorder
event bus
events events events
report
© Software Languages Team, University of Koblenz-Landau
Thank you!Questions?
https://github.com/avaranovich/megalhttp://softlang.uni-koblenz.de/mega