Round-trip engineering

Round-trip engineering is the ability to make changes to either a model or the code generated from it, with each change propagating automatically to the other so that both artifacts stay consistent. It is the tightest possible integration of model-driven development and reverse engineering. Forward engineering generates code from a model, and round-trip engineering additionally reconstructs the model from changes made directly to the code, in both directions, indefinitely.

In practice, the idea works well for toy examples but struggles once a system reaches any real complexity. Forward generation, from a high-level model down to low-level code, is comparatively tractable, because it only requires expanding a design decision into its implementation. The reverse direction is much harder. Recovering the higher-level architectural intent behind a piece of source code usually depends on design decisions that were never recorded anywhere machine-readable, and this cannot realistically be automated in the general case.

Tooling that claims full round-trip support tends to fall back to partial synchronization, flagging conflicts for a human to resolve rather than merging both directions automatically.

The idea traces to the computer-aided software engineering (CASE) tools of the 1980s and 1990s, and it resurfaces wherever a modeling notation and its generated code are both expected to be edited directly, such as in some model-driven architecture toolchains.