Root Contracting: A Novel Method and Utility for Implementing Design by Contract in Domain-Driven Design with Event Sourcing

Event-Sourced Systems (ESSs) that adopt Domain-Driven Design (DDD) are becoming more popular because of their intuitive business process modeling and improved auditability, scalability, and flexibility. However, ensuring the correctness of domain models—particularly event-sourced aggregates (ESAs)—remains challenging. To address this, we propose root contracting, a novel, constrained, and lightweight adaptation of Design by Contract (DbC), specifying the precondition, postcondition, and class invariant exclusively at aggregate roots. Root contracting simplifies correctness enforcement by leveraging DDD principles aligned with DbC and the standardized ESA code structure. We offer uContract, a Java open-source utility that realizes root contracting, enabling automated verification of ESAs with configurable runtime overhead. Through performance evaluation and methodological discussion, we demonstrate that root contracting effectively bridges formal correctness with practical domain modeling. Our approach provides developers with a tool to streamline development workflows, potentially reducing testing overhead and supporting integration with methodologies like Behavior-Driven Development (BDD).

Authors

Institutions

Publication Details

Journal
Electronics
Published
2025-10-28
DOI
https://doi.org/10.3390/electronics14214205
Primary Topic
Model-Driven Software Engineering Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Root Contracting: A Novel Method and Utility for Implementing Design by Contract in Domain-Driven Design with Event Sourcing

Yu-Hsiang Hu, Chien‐Tsun Chen, Yi-Chun Yen, Yu Chin Cheng
Electronics
Model-Driven Software Engineering Techniques
article

Root Contracting: A Novel Method and Utility for Implementing Design by Contract in Domain-Driven Design with Event Sourcing

Yu-Hsiang Hu, Chien‐Tsun Chen, Yi-Chun Yen, Yu Chin Cheng
article en

Abstract

Event-Sourced Systems (ESSs) that adopt Domain-Driven Design (DDD) are becoming more popular because of their intuitive business process modeling and improved auditability, scalability, and flexibility. However, ensuring the correctness of domain models—particularly event-sourced aggregates (ESAs)—remains challenging. To address this, we propose root contracting, a novel, constrained, and lightweight adaptation of Design by Contract (DbC), specifying the precondition, postcondition, and class invariant exclusively at aggregate roots. Root contracting simplifies correctness enforcement by leveraging DDD principles aligned with DbC and the standardized ESA code structure. We offer uContract, a Java open-source utility that realizes root contracting, enabling automated verification of ESAs with configurable runtime overhead. Through performance evaluation and methodological discussion, we demonstrate that root contracting effectively bridges formal correctness with practical domain modeling. Our approach provides developers with a tool to streamline development workflows, potentially reducing testing overhead and supporting integration with methodologies like Behavior-Driven Development (BDD).

ElectronicsVol. 14(21)
National Taipei University of Technology (TW), Tethys Research Institute (IT)
Openalex Percentile: Top 68%
Model-Driven Software Engineering Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.