Model Driven Engineering

An Introduction

Agenda

  • Definition

  • Context

  • Software Modeling

  • Anatomy of a Modeling Language

  • Meta-modeling

  • Conclusion 

Definition

Model-driven engineering (MDE) is a software development methodology which focuses on creating and exploiting domain models (that is, abstract representations of the knowledge and activities that govern a particular application domain), rather than on the computing (or algorithmic) concepts.

— Wikipedia
And also focus on creating modeling languages to represent these domain models.
— me

Models as the central artifact of software development

model central

Model-driven code generation

code generation

Model-driven interoperability

interoperability

Model-driven reverse engineering

reverse

Models@run.time

runtime

Agenda

  • Definition

  • Context

  • Software Modeling 

  • Anatomy of a Modeling Language

  • Meta-modeling

  • Conclusion 

Context

Software Engineering Today

Modern Software Problems (1/2)

Increasing complexity of software:
  • Evolving functional requirements:

    • Environment Integration, Adaptation, (Software and GUI), Flexibility (notion of product lines)

  • Increasing importance of non-functional properties:

    • Distributed systems, parallel and asynchronous

    • Security

Modern Software Problems (2/2)

Increasing complexity of infrastructures:
  • Operating system APIs, language libraries, application frameworks

Increasing importance of quality of services:
  • reliability, latency, performance

Increasing complexity (1/2)

  • The control software to run a U.S. military drone uses 3.5 million lines of code.

  • A Boeing 787 has 6.5 million lines behind its avionics and online support systems.

  • Google Chrome (browser) runs on 6.7 million lines of code (upper estimate).

  • A Chevy Volt uses 10 million lines.

  • The Android operating system runs on 12-15 million lines.

Increasing complexity (2/2)

  • The Large Hadron Collider uses 50 million lines.

  • Not including backend code, Facebook runs on 62 million lines of code.

  • With the advent of sophisticated, cloud-connected infotainment systems, the car software in a modern vehicle apparently uses 100 million lines of code. This is according to Wired magazine.

  • All Google services combine for a whopping 2 billion lines.

Technology evolution

’70’80’95

Structured programming

Objects

Components

Procedures, Pascal, C

Smalltalk, C++

Aspects, Components, Software Frameworks, Software Patterns

arrow
Figure 1. Time

Design Patterns

  • Embody architectural know-how of experts​

  • As much about problems as about solutions​:

  • pairs problem/solution in a context​

  • About non-functional forces:

    • reusability, portability, and extensibility.

  • Not about classes & objects but collaborations​

    • Actually, design pattern applications are parameterized collaborations

From Objects to Components​

  • Object = instance of a class​

  • Class = reusable unit of software​

    • focus on structural and functional properties​

    • development concept​

  • Component = deployment unit​

    • focus on non-functional properties​

    • installation/execution concept​

      • Explicit dependencies​

      • Configuration and connection

Aspect Oriented Programming​

  • Kiczales et al., ECOOP’97​

    • MIT’s one of 10 key technologies for 2010​

  • Encapsulation of cross-cutting concerns in OO programs​

    • Persistence, contract checking, etc.​

  • Weaving at some specific points (join points) in the program execution​

    • Hence more than macros on steroids​

  • AspectJ for AOP in Java​

    • Some clumsiness in describing dynamic join points

Good modularity

tomcat xml
  • XML parsing in org.apache.tomcat

    • red shows relevant lines of code

    • nicely fits in one box

Tomcat

tomcat pattern
  • URL pattern matching in org.apache.tomcat

    • red shows relevant lines of code

    • nicely fits in two boxes (using inheritance)

However

tomcat log
  • Logging in org.apache.tomcat

  • red shows lines of code that handle logging

  • not in just one place

  • not even in a small number of places

AspectJ

  • a small and well-integrated extension to Java

  • a general-purpose AO language

    • just as Java is a general-purpose OO language

  • freely available implementation

    • compiler is Open Source

  • includes IDE support

    • Eclipse, NetBeans, JBuilder, IntelliJ IDEA

  • user feedback is driving language design

  • currently at release 1.9.1 (compatible with Java 7)

In short

  • Growing complexity of software

  • Separation of concerns

  • Separation of professions

  • Requirement diversity

  • Platform diversity

  • Continuous evolution

  • Is source code the correct level of abstraction?

Agenda

  • Definition

  • Context

  • Software Modeling

  • Anatomy of a Modeling Language

  • Meta-modeling

  • Conclusion

Defintion

A Model is a simplified or partial representation of reality, defined in order to accomplish a task or to reach an agreement

Why?

Modeling, in the broadest sense, is the cost-effective use of something in place of something else for some cognitive purpose. It allows us to use something that is simpler, safer or cheaper than reality instead of reality for some purpose.

A model represents reality for the given purpose; the model is an abstraction of reality in the sense that it cannot represent all aspects of reality. This allows us to deal with the world in a simplified manner, avoiding the complexity, danger and irreversibility of reality.

— Jeff Rothenberg

In short

Models are useful to:
  • understand complex systems.

  • communicate.

  • minimize risks (early error detection).

  • investigate and compare alternative solutions.

  • drive implementations.

Models in science

Migratory Routes of the Blue Whale
  • Description of a real phenomenon (descriptive models).

Models in traditional engineering

engineering
Figure 2. Example by Brian Selic
  • A reduced representation of some system that highlights the properties of interest from a given viewpoint.

  • Description of something in order to build it (prescriptive models)​.

Properties of a useful model

  • Abstract: emphasize important aspects while removing irrelevant ones.

  • Understandable: expressed in a form that is readily understood by observers.

  • Accurate: Faithfully represents the modeled system

  • Predictive: Can be used to answer questions about the modeled system

  • Inexpensive: Much cheaper to construct and study than the modeled system

To be useful, engineering models must satisfy all of these characteristics!

Models in Software Engineering

Software has the rare property that it allows us to directly evolve models into full-fledged implementations without changing the engineering medium, tools, or methods!
— Selic
  • This ensures perfect accuracy of software models; since the model and the system that it models are the same thing

  • The model evolves into the system it was modeling

Entity-Relationship model

entity relationship
Figure 3. [Chen ’76]
  • Database modeling method, used to produce a type of conceptual schema or semantic data model of a system, often a relational database, and its requirements in a top-down fashion.

Data-Flow Diagrams

dfd example
Figure 4. [Constantine & Yourdon ’75]
  • Graphical representation of a flow of data through an information system.

Petri Nets

Early seventies

petri
Figure 5. Mathematical modeling language for the description of distributed systems

State Diagrams [Booth ’67]

state machine
  • Describes the behavior of a system in terms of states.

UML [Los 3 amigos ’96]

One model, 4 dimensions, multiple views:

  1. Static Aspect (Who?)​

    • Describes objects and their relationships​

    • Structuring with packages​

  2. User view (What?)​

    • Use cases​

  3. Dynamic Aspects (When?)​

    • Interaction diagram (Sequence, Collaboration) ​

    • State Diagram ​

    • Activity Diagram ​

  4. Implementation Aspects (Where?)​

    • Component Diagram & deployment diagram

KAOS (Goal-Directed Requirements Acquisition) [Dardenne ’93]

kaos

ORM (Object-Role Model) [Halpin ’89]

orm
  • Representation of the semantics of a universe of discourse. ORM is often used for data modeling and software engineering.

Feature Models [Kang ’90]

feature model
  • Compact representation of all the products of the Software Product Line (SPL) in terms of ``features''.

Agenda

  • Definition

  • Context

  • Software Modeling

  • Anatomy of a Modeling Language

  • Meta-modeling

  • Conclusion

Language

A language is composed of:
  • A syntax

  • A semantics

  • The syntax specifies the subjects (concepts, entities) and the verbs (links between these concepts) of a language.

  • The semantics gives an interpretation to subjects and verbs.

Example: The UML Syntax

uml syntax illustration

Example: The UML Semantics

uml semantics illustration

Language Syntax

  • A language’s syntax is composed of two parts:

    • The abstract syntax: defines the concepts (subjects) and possible links (verbs).

    • The concrete syntax: defines their representation.

  • An abstract syntax may have several concrete syntax.

  • Two (or more) concrete syntax may share the same concrete syntax.

Abstract Syntax: Concepts and Links

uml concepts links
Concepts

Class, Association, Attribute, Operation/Method, etc.

Links

Class contains Attributes, Class contains Operations, Association from Class, Association to Class

Concrete Syntax: Visual Representation

Failed to generate image: Could not find the 'mmdc' executable in PATH; add it to the PATH or specify its location using the 'mmdc' document attribute
erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ LINE-ITEM : contains
    CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
Entity-Relationship Example

Example: Several Concrete Syntaxes for the same Abstract Syntax

Diagram
ood order item

Example: UML concrete syntax

class "Order" {
    class "Sales Line Item"
        feature: Attribute "title" {
            visibility: "public"
            isSpecification: false
            type: "String"
        }
        feature: Operation calculateTax() {
            visibility: "public"
        }
    }
}
Human-Usable Textual Notation (HUTN): Textual concrete syntax for any modeling language specified in MOF.
Diagram

Agenda

  • Definition

  • Context

  • Software Modeling

  • Anatomy of a Modeling Language

  • Meta-modeling

  • Conclusion

Definitions

Meta-modeling is the specification of a modeling language in another de modeling language, called meta-language.

Meta-language is a form of language or set of terms used for the description or analysis of another language

Remark

  • A meta-language is a language.

  • Even if it is a meta-meta-meta-meta-meta-meta-meta-meta-meta-meta-meta-meta-meta-language.

Meta-model

  • A model that represents the syntax of a language.

  • And only the syntax.

Meta-modeling language

  • A modeling language used to specify the syntax of other modeling languages.

  • Often named «meta-meta-model»

  • Examples:

    • OPPR (MetaEdit+)

    • MOF (OMG)

    • Ecore (Eclipse Foundation)

MOF

Meta Object Facility

  • Meta-modeling language de proposed by the OMG and used to specify UML and other modeling languages: SysML, MOF, CWM, SPEM etc.

  • MOF is similar to the UML class diagram and can be seen as a UML subset.

  • MOF does not have a concrete syntax:

    • It borrows the UML’s one.

  • Current version: 2.5.1

MOF

  • Since version 2.0 uses the UML Infrastructure Library

  • Provides more powerful mechanisms to customize UML

  • Allow users to define language dialects for platforms (e.g., J2EE, .NET) and domains (e.g., eBusiness, finance, etc.)

Modeling techniques at OMG: 3 steps ​

steps

Example: UML abstract syntax

uml syntax

Example: DFD - Data Flow Diagram (Yourdon)

dfd example

DFD meta-model, expressed in OPPR [Lyytinen 94]

dfd oppr

Underlying model

  • Set of classes (in a programming language) allowing the instantiation of language.

  • Can also be seen as a meta-model represented in a programming language.

Current standards:
  • Eclipse Modeling Framework (EMF).

  • Java Metadata Interface (JMI).

QVT - Query-View-Transformation.

  • Standart Model Query and Transformation language.

  • QVT-Operational: imperative language for unidirectional transformations.

  • QVT-Relations: declarative language for both unidirectional and bidirectional transformations.

  • QVT-Core: specifies the semantics of the declarative language.

Eclipse Modeling Framework (EMF)

  • MOF, JMI et XMI at Eclipse.

  • Simpler, smaller, more usable.

  • The current de facto standard.

Agenda

  • Definition

  • Context

  • Software Modeling

  • Anatomy of a Modeling Language

  • Meta-modeling

  • Conclusion

MDE Principles

  • Everything relevant to the development process is a model

  • All the meta-models can be written in a common meta-modeling language.

  • A development process can be modeled as a partially ordered set of model transformations, that take models as input and produce models as output

Consequences

  • Models are aspect oriented. Conversely: Aspects are models

  • Transformations are aspects weavers. They can be modeled.

  • Every meta-model defines a domain specific language

  • Software development has two dimensions: M1-model development and M2-transformation development

  • Related: Software Language Engineering