FDE Times dataFDE jobs open 913▼15 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 63Companies hiring 200Remote-friendly 24%Median US pay $200kTop hirer Databricks 106
中文VI

The newspaper of the Forward Deployed Engineer

Guides

Why the ERP database login is an FDE's costliest shortcut

An anti-corruption layer and separate read and write paths stop a legacy schema leaking into new code before the next ERP upgrade bites.

ShareLinkedInFacebookX

In brief

  • Direct database access is the cheapest option to build and the most expensive to remove. Treat it as a last resort rather than the default.
  • An anti-corruption layer keeps the legacy data model out of new code. The price is added latency and one more service to run.
  • Read through change data capture and write through an asynchronous channel with error-handling tools. UI bots are for when no other door exists.
Decision tree with the root question "Read or write?". The Read branch leads to change data capture, that is, reading the transaction log. The Write branch splits on the question "High volume?": if Yes, use an asynchronous channel such as SAP IDoc; if No, use a synchronous API such as OData or RFC. All three paths flow into one orange bar: the anti-corruption layer (ACL), the only file that knows the ERP's column names.
Separate reads from writes, give each its own entry point, and route all data through a single translation layer. Source: Microsoft, aixsap, Netguru, as cited in the article.

Take an FDE in the second week at a client’s factory. The agent being built needs to read purchase orders and create goods receipts, but the client’s ERP dates back more than a decade. Nobody maintains the API documentation, and the database administrator cheerfully hands over an account with read access straight to the tables.

Almost every FDE runs into this, and the decisions made in those first few days stay with a project for a long time. Getting connected is the easy part. The hard part is connecting in a way that still holds eighteen months later, when the ERP is upgraded and the product must not collapse with it.

The easiest way in is usually the hardest way out

Microsoft’s architecture documentation describes the problem precisely: legacy systems often have convoluted schemas and obsolete APIs. Support them naively and the new application ends up forced to adopt the old system’s semantics.

The clearest symptom is lines like if STAT_CD == "02" turning up across new code. By then the product is tightly bound to the ERP.

That is why the database account deserves more caution than it seems to. An analysis of legacy integration by Netguru states plainly that direct database access is the cheapest integration pattern to build and the most expensive to remove. It is fast in a demo.

After that, every column change means another fix, and nobody warns you in advance.

The answer is not to refuse every shortcut but to inventory all the entry points first, then choose one for reads and another for writes.

Entry point Suited to The cost
Direct database reads/writes A prototype built in a few days Code bound tightly to the schema, very expensive to remove
Change data capture (reading the transaction log) The read path when the legacy application cannot be changed Requires understanding each database’s log
Asynchronous channel such as SAP IDoc High-volume writes No immediate result
Synchronous API (OData, RFC) Lookups, single-record writes Depends on the legacy system’s throughput
UI automation bot When no other door exists Breaks whenever the UI changes, errors are hard to diagnose

Reads and writes need different doors

The read path and the write path carry different risks, so separate them. For reads, when the legacy application is built around its database and cannot be modified, Microsoft suggests either triggers on the database itself or change data capture reading the transaction log to push changes to the new service.

Of the two, change data capture deserves priority: because it reads the transaction log, nothing has to query or attach to the ERP’s business tables.

The write path is more sensitive, because a bad write to the ERP means wrong books. Take SAP. An analysis on aixsap argues that IDoc suits asynchronous, high-volume writes, since it has built-in error reprocessing and monitoring, whereas OData is synchronous.

The same source observes that RFC is still in use but its scope is narrowing, and the calling side has to install a separate connector.

The lesson reaches beyond SAP: favor the channel the client’s operations team already knows how to monitor. When a goods receipt gets stuck at 2 a.m., they need a familiar screen to reprocess it. A script left behind by a departed engineer will not help them.

The translation layer: the only place that knows the old column names

Whichever door is used, data has to cross a boundary. Microsoft calls it an anti-corruption layer (ACL): a translation layer that lets one system stay as it is without compromising the design and technology of the other. Netguru puts it more briefly: an ACL keeps the legacy system’s data model out of new code.

Below is an example for purchase orders. The column names are made up, but the data types will be familiar to anyone who has worked with an ERP: numeric status codes, supplier codes with leading zeros, money stored in the smallest unit, dates stored as strings.

# acl/purchase_order.py — the ONLY file allowed to know the ERP's column names
from dataclasses import dataclass
from datetime import date, datetime
from decimal import Decimal

class UnknownLegacyValue(Exception):
    pass

@dataclass(frozen=True)
class PurchaseOrder:            # the new application's model
    order_id: str
    supplier_id: str
    amount: Decimal
    due_date: date
    status: str                 # "open" | "approved" | "cancelled"

STATUS_MAP = {"01": "open", "02": "approved", "09": "cancelled"}

def from_legacy(row: dict) -> PurchaseOrder:
    code = row["STAT_CD"]
    if code not in STATUS_MAP:
        # stop immediately, don't guess
        raise UnknownLegacyValue(f"STAT_CD={code!r} PO={row['PO_NO']}")
    return PurchaseOrder(
        order_id=row["PO_NO"].strip(),
        supplier_id=row["VEND_CD"].lstrip("0"),
        amount=Decimal(row["AMT"]) / 100,
        due_date=datetime.strptime(row["DUE_DT"], "%Y%m%d").date(),
        status=STATUS_MAP[code],
    )

The code is short, but three things stand out. The agent and every downstream service see only PurchaseOrder, never STAT_CD. An unknown status code raises a clear error instead of being silently assigned a default. And when the ERP is replaced, exactly one file needs rewriting.

An ACL is not free. Microsoft is explicit that the layer adds latency and is one more service to manage and maintain. When the legacy system is slow, the ACL can run asynchronously and event-driven: the new business logic no longer waits on the old system’s pace, because data is translated via messages.

This fits high-volume flows, or cases where the two systems need to be fully decoupled.

Five steps on site

The first step is the inventory. List every entry point as in the table above, noting who owns each one and how each reports errors. The question for the client goes beyond “is there an API?” to “when this sync breaks, who gets alerted and where do they look?”

Next, separate reads from writes and choose a door for each. Prefer change data capture for reads and an asynchronous channel with monitoring tools for writes. The third step is to write the ACL before writing features, with a test for every unexpected value found in real data.

The fourth step is to plan for gradual replacement. Martin Fowler recounts that he and his colleagues chose incremental modernization over a one-shot rewrite. The Strangler Fig pattern uses a facade, a proxy, that intercepts requests heading to the legacy system and routes them either to the old application or to a new service.

Microsoft also notes, however, that the pattern does not fit when requests to the back end cannot be intercepted, which is common with closed ERPs. In that case the sensible choice is to fall back on change data capture for reads and accept slower progress on writes.

The final step is to record the decision: which door was chosen, why, and what cost was accepted. Whoever takes over will need that document more than anything else.

The familiar traps

The first trap is letting a demo shortcut become the real architecture. A direct table query written in week one can still be there at go-live, simply because nobody had time to go back and fix it.

The second is treating a UI bot as “integration”. Workato warns that such bots break easily when an application’s interface changes. Activepieces points to a more important difference: an API returns a status code saying exactly why a process failed, while a bot only guesses where the button is.

If a bot is unavoidable, put it behind the ACL so it can be swapped out without touching anything else.

The third trap is optimistic translation. Assigning a default to a status code whose meaning nobody knows is the fastest way to make an agent confidently wrong on the client’s real data.

In FDE job descriptions, phrases like “integrate with customer ERP” or “legacy systems” refer to exactly this work. On a CV, “SAP integration” alone says little. Write down which entry point you chose, why, and how you handled sync failures.

This week’s exercise goes beyond the read path: write the inverse function to_legacy for the entity you translated, then a round-trip test. Take a real record, translate it into the new model, translate it back and compare each field with the original.

Every mismatch, whether leading zeros in supplier codes, currency units or date formats, marks a place where the write path would corrupt the client’s books if it were not caught first.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
7 sources
Read next on the roadmap · Stage 2: Broad engineeringCode gets you an FDE interview; customers decide who gets hiredAcross about 1,000 FDE postings, most demand Python and full-stack skills, while 47% say the hire must work directly with customers.