NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

S2A: A Compiler for Multi-modal UML Sequence Diagrams

David Harel, Asaf Kleinbort, Shahar MaozFASE 2007

Abstract

In modern software engineering, requirements are often captured as scenarios—sequences of interactions between multiple system components. However, traditional object-oriented programming languages often obscure these scenarios by distributing their logic across multiple classes. This paper presents S2A, a compiler designed to bridge this gap by transforming visual, multi-modal UML sequence diagrams into executable AspectJ code. By leveraging Aspect-Oriented Programming (AOP), S2A treats inter-object interactions as cross-cutting concerns, enabling the direct execution and monitoring of high-level requirements within standard Java environments.

Introduction

A persistent challenge in software development is the "impedance mismatch" between requirement specifications and implementation. Requirements are naturally scenario-centric: they describe how a set of objects should collaborate to achieve a goal (e.g., a user authentication flow or a media playback sequence). Conversely, mainstream programming languages like Java are object-centric, requiring developers to decompose these cohesive scenarios into fragmented methods across various classes.

While previous research into "Live Sequence Charts" (LSCs) introduced the concept of "play-out" (direct execution of diagrams), these solutions often relied on specialized execution engines that were difficult to integrate into industrial toolchains. S2A addresses this by compiling Modal Sequence Diagrams (MSDs)—a UML-compliant extension of LSCs—directly into AspectJ, allowing scenario-based logic to run natively on the Java Virtual Machine (JVM).

Methodology: From Diagrams to Aspects

The S2A compiler architecture is built upon three primary pillars: Modal Sequence Diagrams, Scenario Aspects, and a centralized Coordinator.

S2A utilizes MSDs to capture the "modality" of interactions. Unlike standard UML diagrams, MSDs distinguish between different types of behavior:

  • Hot (Universal): These represent mandatory behaviors. A violation of a "hot" message or condition is considered a critical failure, typically resulting in program termination.
  • Cold (Existential): These represent optional or possible behaviors. If a "cold" expectation is violated, the specific scenario instance is simply discarded without impacting the overall system state.

The Compilation Process

The compiler transforms each MSD into a Scenario Aspect in AspectJ. Each aspect functions as a state machine—specifically an alternating Büchi automaton—that tracks the progression of a scenario. S2A uses AspectJ pointcuts to intercept relevant method calls and events within the system, allowing the scenario logic to "listen" to the application's execution.

The Coordinator Aspect

To manage the complexity of multiple overlapping scenarios, S2A generates a Coordinator Aspect. This central component maintains the state of all active scenario instances. It determines which events are currently enabled and ensures that no action is taken that would violate a "hot" requirement in any active scenario.

Key Insights

The core innovation of S2A lies in the conceptual alignment of scenarios and aspects. Both are designed to handle cross-cutting concerns—logic that naturally spans multiple objects and modules. By mapping visual scenarios to AspectJ, S2A moves scenario-based programming from academic prototyping into the realm of standard software engineering.

Furthermore, S2A provides a dual-purpose toolset:

  1. Execution: Generating reactive behavior directly from requirements.
  2. Monitoring: Using diagrams to specify safety properties for existing Java applications. S2A can generate the monitoring code necessary to detect and report deviations from the specified visual model in real-time.

Results and Implementation

The S2A compiler supports a wide array of UML 2.0 constructs, including symbolic lifelines (representing classes or interfaces), dynamic object creation, and complex control structures such as loops (while, for) and conditional logic (if-then-else, switch-case).

By adhering to UML and AspectJ standards, S2A ensures compatibility with existing IDEs and build systems, facilitating its adoption in professional development environments. The multi-modality support allows developers to specify both mandatory safety properties and optional behavioral traces within the same visual environment.

Limitations and Future Work

While S2A represents a significant step forward, several areas for improvement remain. The current compilation strategy is a direct translation; future iterations could optimize performance by utilizing advanced AOP features like per-object aspect instantiation. Additionally, the authors aim to implement "Smart Play-Out," using model-checking techniques to anticipate and avoid deadlocks or specification violations. Finally, the development of scenario-aware debuggers would allow engineers to troubleshoot applications at the level of the visual diagram rather than the generated Java code.

Summary updated

BibTeX
@inproceedings{harel2007s,
  author = {David Harel and Asaf Kleinbort and Shahar Maoz},
  title = {{S2A: A Compiler for Multi-modal UML Sequence Diagrams}},
  booktitle = {FASE},
  year = {2007},
  doi = {10.1007/978-3-540-71289-3\_11},
}

Loading related content...

Figure