Model Driven Engineering

An Introduction

Gerson Sunyé

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

Documentation

uml sketch

Code generation

code generation process

Reverse engineering

reverse

Model checking

model checker

Model-based testing

model based testing

Language engineering

language engineering

Executable models

executable uml

Models at runtime

runtime

Model-driven interoperability

interoperability

Model transformation

operational context

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 (1/2)

’70’80’90

Structured programming

Objects

Components

Procedures, Pascal, C

Smalltalk, C++

Aspects, Components, Software Frameworks, Software Patterns

arrow
Figure 1. Time

Technology evolution (2/2)

'00'10

 Services

Low Code & No Code Approaches

Javascript, Artifact Repositories

Microsoft PowerApps, Google AppSheet, Mendix

arrow
Figure 2. 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

  • Small and well-integrated extension to Java

  • General-purpose AO language

    • just as Java is a general-purpose OO language

  • Open Source (EPL2 License)

  • Includes IDE support:

    • Eclipse, NetBeans, JBuilder, IntelliJ IDEA

  • Currently at release 1.9.7 (compatible with Java 15 & 16)

  • Eclipse project

Low and No Code Approaches

  • Shortage of programmers even for simple applications: Mobile apps, Web, etc.

  • Build programs that generate/configure programs:

    • Put problem-solving capabilities into the hands of non-IT professionals

    • Users can more quickly and easily create business apps that help them do their jobs

  • Analysts at Gartner estimate that the low-code market grew 23% in 2020 to reach $11.3 billion, and will grow to $13.8 billion in 2021 and almost $30 billion by 2025

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 3. 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 4. [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 5. [Constantine & Yourdon ’75]
  • Graphical representation of a flow of data through an information system.

Petri Nets

Early seventies

petri
Figure 6. 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?)

    • Class, Component, Package and Object Diagrams

  2. User view (What?)

    • Use Case Diagrams

  3. Dynamic Aspects (When?)

    • Interaction diagram (Sequence, Collaboration), State and Activity Diagrams

  4. Implementation Aspects (Where?)

    • Component & Deployment Diagrams

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 (2016)

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). Last version: 2.31, 2022

  • Java Metadata Interface (JMI). Last version: 2002

Emerging technologies
  • JetBrains MPS

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