From 6 million lines of legacy code to immediate insight: Deltares unravels 40 years of software history

Share this:
The challenge

Hidden Logic and Isolated Knowledge

The D-Flow FM calculation kernel is largely written in Fortran. Over the course of several decades, the software has been continuously developed and expanded. This has resulted in an extensive codebase that incorporates a great deal of technical and domain-specific knowledge.

At the same time, senior developers and domain experts who had worked on the original software retired or left the organization. This posed a risk that some of the historical context and knowledge regarding undocumented dependencies would be lost.

It was therefore important for Deltares to regain full control of the existing software architecture. Developers needed to be able to get quick answers to questions about:

  • Exact call trees, dependencies, and the use of global variables and global state.
  • The consistency in content between the Fortran code and the official technical reference documentation, including TechRef PDFs.
  • Complex code paths that take a long time to analyze completely using traditional search methods.
The solution

Re:App Reverse Architecting

Together with SUE, Deltares launched a “ Reverse Architecting ” project to fully analyze and map out the D-Flow FM kernel using Re:App, SUE’s AI-driven solution for application modernization. The goal was not to replace the existing software immediately, but first to gain insight into how the application is actually structured and how the code, dependencies, and technical documentation are interconnected.

Bringing Code and Context Together

The entire Fortran codebase, consisting of approximately six million lines of code, was incorporated into Re:App, along with CMake build configurations, utility libraries, and technical documentation.

As a result, Re:App was able not only to analyze individual files, but also to identify relationships across the entire application.

Knowledge Graph and Hybrid Search

At Re:App, SUE configured a hybrid search architecture in which elements from the source code—such as subroutines and variables—were directly linked to relevant documentation and hydrological formulas.

This Knowledge Graph makes it possible to answer questions not only based on textual similarities, but also based on the actual relationships within the software architecture.

Specialized AI agents

Specialized subagents were deployed for specific analyses. This allows, among other things, for the automatic generation of visual Mermaid call-tree diagrams.

By defining tasks and context for each agent, the analysis remains focused, and complex architectural questions regarding a large codebase can be examined in detail.

Validation by domain experts

The results were then tested and validated by developers and domain experts at Deltares. Using Re:App’s chat interface, they were able to ask specific questions about the architecture, code paths, and technical documentation, and verify the answers immediately.

The result

From millions of lines of code to immediate insight

The D-Flow FM calculation kernel was reverse-engineered using Re:App. This allows Deltares to gain insight much more quickly into the structure, dependencies, and hidden logic within a large, mission-critical legacy codebase. The approach was evaluated against predefined success criteria and compared to standard AI coding assistants, such as GitHub Copilot.

Insight into the entire codebase

While traditional AI coding assistants primarily operate within a local context, Re:App can explore connections across the entire repository.

This allows developers to ask questions about top-level entry points, complex dependencies between modules, and the broader architecture of the application.

Code and documentation are directly linked

Re: The app links source code to internal coding guidelines and technical reference documentation.

Questions about, for example, hydrological formulas can therefore be directly linked to the relevant implementation and associated source information.

Less room for hallucinations

Through its integration with the Knowledge Graph, Re:App bases its analyses on files, subroutines, and interrelationships that actually exist within the codebase.

This reduces the likelihood of incorrect or fabricated references and makes the results easier for developers to verify.

Architectural Connections Revealed

In addition to summarizing large and complex routines, Re:App also highlights interdependencies and potential inconsistencies between modules.

This not only provides insight into what individual pieces of code do, but, more importantly, into how the application functions as a whole.

From hours of searching for answers to just seconds

In the past, investigating complex code paths often took hours or even days and involved, among other things, manual searches using tools such as grep.

With Re:App, developers can ask the same architectural questions directly and, within seconds, gain targeted insights into the relevant code, dependencies, and documentation.

Han van Veldhuizen, Director of Digital Technology
"We're pleased with the project's results. Re:App gives us an easier way to gain a better understanding of the complex code behind our software."

Let's Talk

stefan.behlen 1
Stefan Behlen

Let's chat!


Let's Talk

* required

By submitting this form, you confirm that you have read and understood our privacy statement.
Privacy overview
This website uses cookies. We use cookies to ensure that our website and services function properly, to gain insight into the use of our website, and to improve our products and marketing. For more information, please read our privacy and cookie policy.