arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2608.05612cs.SE

保持模型与代码同步:面向战术领域驱动设计的往返工程

Keeping Models and Code in Sync: Roundtrip Engineering for Tactical Domain-Driven Design

Weixing Zhang, Mario Herb, Wai Chung Dorothy Cheng, Michael Wagner, Bowen Jiang, Tianhai Liu, Anne Koziolek

AI总结:

本文提出面向战术DDD的双向同步工具链JDomInO,可保持Java代码库与领域模型同步,其正向路径已在酒店管场景验证,反向路径通过单元测试,还可作为AI代码助手的精准上下文层。

AI中文摘要:

领域驱动设计(Domain-Driven Design,简称DDD)为团队提供了用于复杂业务逻辑的共享词汇表,但该词汇表仅在模型与代码保持一致时才有用。实践中,二者会逐渐偏离:代码变更速度超过模型,或模型修订从未纳入代码库。本文提出JDomInO,这是一个面向战术DDD的双向同步工具链,通过共享元模型将Java代码库及其领域模型关联,以在系统演进过程中保持二者同步。JDomInO可从领域模型确定性生成Java代码结构(正向路径),并从现有Java代码重构领域模型(反向路径)。正向路径已在酒店管场景中完成全部验证,覆盖元模型的全部12种构建块类型;反向路径的映射逻辑已通过单元测试,端到端验证正在进行中。此外,本文还阐述了JDomInO生成的结构化领域模型如何作为AI代码助手的精准上下文层,帮助其理解原始源代码无法传达的聚合边界与DDD语义。

英文摘要:

Domain-Driven Design gives teams a shared vocabulary for complex business logic, but that vocabulary only stays useful as long as the model and the code agree with each other. In practice, they drift apart: code changes outpace the model, or model revisions never make it into the codebase. This paper presents JDomInO, a bidirectional synchronization toolchain for tactical DDD that keeps a Java codebase and its domain model connected through a shared metamodel, with the goal of keeping the two in sync as the system evolves. JDomInO generates Java code structure deterministically from a domain model (forward path) and reconstructs a domain model from existing Java code (reverse path). The forward path has been fully validated on a Hotel Management scenario covering all 12 building block types in the metamodel; the reverse path's mapping logic has passed unit testing, with end-to-end validation underway. We also outline how the structured domain model produced by JDomInO could serve as a precision context layer for AI code assistants, helping them respect aggregate boundaries and DDD semantics that raw source code alone does not convey.

↑