Back to Blog
February 6, 20269 min readWhy Business Logic

Why Business Logic Is Often Found in User Behavior, Not the Source Code

R
Replay Team
Developer Advocates

Your source code is lying to you.

If you are leading a legacy modernization project by starting with the repository, you are already behind schedule. In the enterprise, the "source of truth" isn't the 15-year-old COBOL scripts or the undocumented Java monolith; it is the behavior of the people who use it every day. Global technical debt has ballooned to $3.6 trillion because we treat software like a static document rather than a living process. When 67% of legacy systems lack any meaningful documentation, "reading the code" isn't engineering—it's archaeology. And archaeology is slow, expensive, and prone to misinterpretation.

TL;DR: Modernization fails because business logic often migrates from the codebase into user workarounds; Replay captures this "behavioral logic" through visual reverse engineering, reducing modernization timelines from years to weeks.

The $3.6 Trillion Archaeological Dig#

Most Enterprise Architects approach modernization with a "code-first" mentality. They assign a team of developers to spend six months performing a technical debt audit, trying to map out dependencies in a system where the original authors retired a decade ago. This is why 70% of legacy rewrites fail or significantly exceed their timelines.

The code tells you what the system was intended to do in 2008. It doesn't tell you how the business has adapted to the system's limitations in 2024.

The Documentation Gap#

When documentation is missing—which is the case for two-thirds of enterprise systems—the "logic" is actually distributed across three unreliable silos:

  1. The Codebase: Full of "zombie logic" (code that runs but serves no current business purpose).
  2. The Database: Full of "ghost schemas" and orphaned tables.
  3. The User's Head: The actual business logic, including the "clicks" they have to perform to bypass a bug that was never fixed.

If you only migrate the code, you migrate the bugs and the technical debt. If you migrate the behavior, you migrate the business value.

ApproachTimelineRiskCostLogic Accuracy
Big Bang Rewrite18-24 monthsHigh (70% fail)$$$$Low (Misses edge cases)
Strangler Fig12-18 monthsMedium$$$Medium (Co-existence issues)
Replay (Visual Extraction)2-8 weeksLow$High (Captures actual use)

Why Business Logic Migrates to User Behavior#

In a regulated environment—be it Financial Services or Healthcare—business logic is frequently "hard-coded" into the manual workflows of the staff. When a legacy system doesn't support a new compliance requirement, users don't wait two years for a release cycle; they develop a "workaround."

That workaround is your new business logic.

If you look at the source code of a claims processing system, you might see a linear validation path. But if you watch a veteran claims adjuster, you’ll see them skip field A, double-click field B to trigger a hidden legacy macro, and manually override field C.

Why business logic is found here, and not in the

text
if/else
statements of the backend, is simple: the UI is the only part of the system that had to evolve at the speed of the market. The backend stayed stagnant.

⚠️ Warning: Relying solely on static analysis of legacy code will result in a "feature-parity" rewrite that users hate because it doesn't support the informal workflows they've spent years perfecting.

From Black Box to Documented Codebase#

The traditional way to extract this logic is manual: an analyst sits with a user, takes notes, and writes a PRD. This takes an average of 40 hours per screen. With Replay, this process is compressed into 4 hours by using video as the source of truth for reverse engineering.

By recording the real user workflow, Replay’s AI Automation Suite identifies the components being interacted with, the data being passed, and the state changes occurring in the UI. It then generates clean, modern React components and API contracts that reflect the actual business process.

Step 1: Recording the Truth#

Instead of interviewing users about what they think they do, you record them doing it. Replay captures the DOM state, network requests, and user interactions. This eliminates the "I forgot to mention this step" problem that plagues manual requirements gathering.

Step 2: Visual Reverse Engineering#

Replay’s engine parses the recording to identify patterns. It distinguishes between static UI elements and dynamic business logic. For example, it can detect that a specific sequence of inputs triggers a complex calculation—logic that might be buried in a stored procedure in the legacy database but is clearly visible in the data flow of the UI.

Step 3: Generating the Modern Stack#

Once the flow is captured, Replay generates the technical artifacts needed for the move to a modern architecture.

typescript
// Example: Replay-generated React component from a legacy Insurance portal // This preserves the "Shadow Logic" captured during the user recording import React, { useState, useEffect } from 'react'; import { Button, Input, Alert } from '@/components/ui'; // From your Replay Design System export const ClaimsValidationForm = ({ initialData, onComplete }) => { const [claimAmount, setClaimAmount] = useState(initialData.amount); const [isHighValue, setIsHighValue] = useState(false); // Replay detected this implicit logic: // Amounts > $5000 require a secondary 'Supervisor ID' field not found in original docs useEffect(() => { if (claimAmount > 5000) { setIsHighValue(true); } }, [claimAmount]); return ( <div className="p-6 bg-white rounded-lg shadow-md"> <h2 className="text-xl font-bold mb-4">Validate Claim</h2> <Input label="Claim Amount" value={claimAmount} onChange={(e) => setClaimAmount(Number(e.target.value))} /> {isHighValue && ( <Alert type="warning" message="High-value claim detected. Supervisor override required." /> )} <Button onClick={() => onComplete({ claimAmount, isHighValue })}> Submit for Review </Button> </div> ); };

💰 ROI Insight: Companies using Replay see an average 70% time savings. A project slated for 18 months is often completed in under 6 months because the "discovery" phase is automated.

The Architecture of Understanding: Flows and Blueprints#

The core problem with legacy systems is that they are "black boxes." You put data in, you get data out, and nobody knows exactly what happens in the middle. Replay turns that black box into a transparent architectural map.

Flows (The Architecture)#

Replay maps out the "Flows"—the sequence of screens and interactions that constitute a business process. This provides an instant technical debt audit. If a flow requires 15 jumps between three different legacy modules, Replay visualizes that complexity, allowing architects to consolidate them into a single microservice.

Blueprints (The Editor)#

Once a flow is captured, it becomes a "Blueprint." This isn't just a static diagram; it's a living specification. You can modify the logic in the Blueprint editor and see how it affects the generated code. This is where the transition from "what we have" to "what we want" happens.

Library (The Design System)#

Modernization isn't just about logic; it's about consistency. Replay's Library feature extracts UI patterns from your legacy screens and maps them to a modern Design System. This ensures that the 50 different "Submit" buttons in your legacy apps become one standardized, accessible React component.

json
// Example: Generated API Contract from a Replay Flow { "endpoint": "/api/v1/claims/validate", "method": "POST", "payload_structure": { "claim_id": "string", "amount": "float", "requires_override": "boolean", "user_metadata": { "session_id": "string", "department_code": "string" } }, "observed_responses": [ { "status": 200, "latency": "45ms" }, { "status": 403, "reason": "Missing Supervisor ID for High-Value Claim" } ] }

Built for the Regulated Enterprise#

Modernizing a government or financial system isn't the same as updating a consumer app. You can't just ship data to a public LLM and hope for the best.

Replay is built for high-stakes environments:

  • SOC2 & HIPAA Ready: Data privacy is baked into the extraction process.
  • On-Premise Available: For organizations that cannot let their source code or user data leave their network.
  • Audit Trails: Every piece of generated code is linked back to the original video recording, providing a clear "Why" for every line of logic.

💡 Pro Tip: Use Replay to document your "as-is" state even if you aren't ready to migrate yet. Having a video-backed documentation library reduces onboarding time for new engineers by 50%.

The Future Isn't Rewriting—It's Understanding#

The "Big Bang Rewrite" is a relic of the 2010s. It's a high-risk gamble that assumes you can recreate 20 years of business evolution in 18 months. The future of enterprise architecture is Visual Reverse Engineering.

By focusing on user behavior, we bypass the obfuscation of legacy code. We stop guessing what the "business logic" is and start seeing it in action. Replay provides the bridge between the legacy past and the cloud-native future, turning months of manual archaeology into days of automated extraction.

Stop reading the code. Start watching the business.

Frequently Asked Questions#

How long does legacy extraction take with Replay?#

While manual documentation and component mapping can take 40+ hours per screen, Replay reduces this to approximately 4 hours. For a standard enterprise module with 20-30 screens, you can move from "Discovery" to "Generated Codebase" in less than two weeks.

What about business logic preservation?#

Replay captures the "side effects" and "state changes" that occur during user interaction. By analyzing the data sent to and from the backend during a recording, Replay identifies the implicit business rules (e.g., "if X is selected, Y must be validated"). This logic is then surfaced in the generated React components and API contracts.

Does Replay work with green-screen (mainframe) applications?#

Yes. As long as there is a web-based terminal emulator or a UI layer, Replay can record the workflow and extract the underlying logic. For pure backend COBOL/Mainframe logic, Replay generates the API contracts required to interface with those systems during a phased "Strangler Fig" migration.

Can Replay generate E2E tests?#

Yes. Because Replay records the actual user path, it can automatically generate Playwright or Cypress E2E tests that replicate that path. This ensures that your modernized version maintains functional parity with the legacy system from day one.


Ready to modernize without rewriting? Book a pilot with Replay - see your legacy screen extracted live during the call.

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free