Model-driven engineering

What is model-driven engineering?

  • Model-driven engineering (MDE): Software development approach where models are the primary artifacts for analysis, design, and automatic code generation. Focuses on abstraction, automation, and transformation, aiming to raise the level of abstraction above programming code.

Usage of MDE

  • models specify system structure, behavior, and requirements
  • enables communication among stakeholders
  • supports early validation and verification
  • can generate code or documentation from models

Pros of MDE

  • improved productivity via automation
  • consistency between design and implementation
  • facilitates reuse of models and components
  • helps manage complexity through abstraction

Cons of MDE

  • steep learning curve for tools and languages
  • tool support can be immature or inconsistent
  • risk of outdated or inaccurate models
  • high initial investment in training and setup

Model-driven architecture (MDA)

  • Model-driven architecture (MDA): An OMG (Object Management Group) initiative for MDE that separates system specification from implementation details.
  • defines three main types of models:
Model TypeFocus/DescriptionExample
Computation Independent Model (CIM)Focuses on environment and requirements; describes what the system should do, not howexample: Business process model
Platform Independent Model (PIM)Describes system operation abstracted from technical details; independent of platformsexample: UML design class diagram
Platform Specific Model (PSM)Adds platform, technology, or implementation details to PIMexample: Java classes for a specific framework

Transformations

  • Transformation: Automated or semi-automated conversion between CIM, PIM, and PSM.
  • can generate code or documentation from models.

MDE and Agile Methods

  • mde often seen as heavyweight, with upfront modeling.
  • Agile methods: Emphasize working software and minimal documentation.
  • Tension exists between detailed models and rapid change.
  • Some agile teams use lightweight or “just enough” modeling.

Challenges in adopting MDE/MDA

  • resistance to change in established practices
  • lack of skilled practitioners
  • tool interoperability and standardization issues
  • keeping models synchronized with code

Key points

  • mde offers abstraction and automation but requires investment
  • not universally adopted; best suited for large, complex systems
  • success depends on organizational commitment and appropriate tooling

Architectural design

Introduction

  • Architectural design: Defines overall structure and organization of a software system.
  • identifies major components and their relationships.
  • serves as a blueprint for development and evolution.

Agility and architecture

  • agile methods may downplay upfront architecture.
  • some architecture is always present, even if implicit.
  • balance needed between adaptability and architectural planning.
  • Emergent architecture: Structure evolves during development.
  • Intentional architecture: Structure planned upfront.

Abstraction in architectural design

  • small-scale abstraction: data types, functions, classes.
  • large-scale abstraction: subsystems, modules, services.
  • architectural design focuses on large-scale structure.
  • helps manage system complexity and evolution.

Advantages of making architecture explicit

  • improved communication among stakeholders.
  • enables analysis of system qualities (e.g., performance, security).
  • supports reuse of architectural patterns and components.
  • facilitates maintenance and evolution.

Representations of software architecture

  • Box-and-line diagrams: Commonly used to represent architecture.
    • boxes: components, subsystems, modules
    • lines: relationships, dependencies, communications
  • diagrams are abstractions; do not show all details.
  • multiple views often needed (e.g., logical, physical, process).

Example box-and-line diagram (Mermaid)

graph LR
    A[UI Component] --> B[Application Logic]
    B --> C[Database]
    B --> D[External Service]

Use of models in architectural design

  • models help visualize and reason about architecture.
  • can be informal sketches or formal notations (e.g., UML).
  • support architectural analysis and decision-making.