What a legacy dependency graph shows and how to read one

What a legacy dependency graph actually shows

A dependency graph is a map of how the parts of a system rely on each other. In a legacy estate, the parts (nodes) are things like programs, copybooks, screens, database tables, batch jobs and reports. The links (edges) are the relationships between them: one program calls another, a screen reads a table, a job writes a file that something else picks up the next morning.

The graph does not tell you what the code is for. It tells you what is connected to what. That sounds modest, but in a system where the original developers are gone and the documentation is incomplete, it is often the first reliable picture a team gets. It replaces opinions about how the system fits together with something you can inspect.

Replai builds this kind of map by reading existing code in COBOL, Oracle Forms, PL/I and other legacy languages, then linking each relationship back to the source it came from. The source link matters. A graph you cannot check against the code is just another diagram to argue over.

Reading the nodes and the links

Start with what each node represents, because a graph that mixes everything together is hard to read. It helps to separate nodes by kind:

  • Executable units: programs, forms, procedures and jobs that do work.
  • Shared definitions: copybooks, libraries and common modules that many units pull in.
  • Data stores: tables, files and queues that units read from or write to.

Then look at the links, and ask two questions about each one. First, which way does it point? A program that calls a module depends on it, and the reverse is not true. Second, what kind of link is it? A call, a data read and a data write carry very different risk. Two programs that only read the same table are loosely related. Two programs that both write to it, in an order that matters, are not.

Node size or link count is a useful shortcut. A node with many incoming links is something a lot of the system depends on, so changing it touches a lot. A node with many outgoing links depends on a lot, so it breaks easily when something underneath it moves. Both are worth noting before anyone proposes a change.

Spotting tightly coupled clusters and orphaned components

Two patterns show up in almost every legacy graph, and they lead to opposite decisions.

Tightly coupled clusters. These are groups of nodes with many links among themselves and few to the outside. Sometimes a cluster is healthy: it is one business function that happens to be implemented across several programs. Sometimes it is a tangle, where nodes call each other in both directions or share data in ways nobody planned. A cluster like that is hard to move piece by piece, because pulling one node out drags its neighbors with it. If you see one, treat the whole cluster as a single unit of work until you have a reason not to.

Watch for the nodes that sit between clusters, the ones with links into several groups. These are the shared services and utility modules that quietly hold the estate together. They are the places where a small change has a wide reach.

Orphaned components. These are nodes with no incoming links at all. Nothing calls them, nothing opens them. They may be dead code left behind by old projects, which means you can leave them out of a migration and save effort. But be careful with the word orphaned. A program with no incoming links in the code can still be started by a scheduler, a menu entry, or an outside system that the code analysis cannot see. Confirm with the people who run the system before you drop anything. The related guide on finding unused code in a legacy system covers that check in more detail.

From the graph to scoping and sequencing decisions

The graph earns its keep when it changes a plan. Three decisions follow directly from what you have just read.

  1. Scope. Count what is actually in play. Orphaned components may come off the list. Tightly coupled clusters count as one block, not as a dozen small items. A scope estimate built from the graph is far less likely to be a guess than one built from a list of program names. System integrators scoping client work will find the same idea in the guide on scoping a legacy modernization project with less guesswork.
  2. Sequence. Start with parts that have few dependencies on the rest, so you can move them without disturbing anything else. Leave heavily connected nodes and tangled clusters for later, when the team knows more. This is the same logic behind a staged approach such as the strangler fig pattern, where you replace a system in pieces and need clean seams to cut along.
  3. Risk. Before touching a high-traffic node, trace what depends on it. The guide on change impact analysis for legacy code walks through that check, and the one on data lineage in legacy systems covers following a single field from screen to table.

One caution. A graph shows structure, not business meaning. It will tell you that a cluster exists, not whether the rules inside it are still correct. Pair it with a review of what the code does, as described in legacy code analysis, before you commit to a plan.

Frequently asked questions

What is a dependency graph in a legacy system?

It is a map of how programs, screens, shared definitions and data stores in a legacy system rely on each other. Nodes are the components and links are relationships such as calls, reads and writes.

How do I tell a tightly coupled cluster from a healthy one?

Look at the links between nodes in the group. If they call each other in both directions or share data in ways nobody planned, it is a tangle. If the group implements one business function with few links outside it, it is probably healthy.

Does an orphaned component always mean dead code?

No. A component with no incoming links in the code may still be started by a scheduler, a menu entry or an outside system the analysis cannot see. Confirm with the people who run the system before leaving it out of a migration.

Why does the direction of a link matter?

A link points from the component that depends to the one it depends on. A node with many incoming links affects much of the system when changed, while a node with many outgoing links breaks easily when something beneath it moves.

Can a dependency graph tell me what the business rules are?

Not on its own. It shows structure, meaning what is connected to what. Understanding the business rules inside a cluster takes a separate review of what the code does.

How does the graph help with sequencing a modernization?

It shows which parts have few dependencies on the rest, so those can move first without disturbing anything else. Heavily connected nodes and tangled clusters can wait until the team knows more.