The Archaeologist’s Copilot

· Source: Martin Fowler · Field: Technology & Digital — Software Development & Engineering, Artificial Intelligence & Machine Learning, Cloud Computing & IT Infrastructure · Depth: Intermediate, extended

Summary

This article details the modernization of a 20-year-old Java 1.5 "Big Ball of Mud" codebase, originally built with Ant, which no longer compiled on modern systems. Initial attempts using LLMs with "Tourist Prompts" yielded hallucinated solutions, such as a `build.gradle` for Java 1.8 and incorrect dependencies like `commons-pool2 (v2.x)` instead of `org.apache.commons.pool (v1.x)`. Success was achieved by adopting an "Archaeologist Prompt" to ground AI analysis in evidence, leading to a "critical rewrite recommended" verdict. The process involved containing the legacy code in a Docker "Time Capsule" (Java 6/Ant on x86), lifting it to Java 8/Gradle 7.6 on Apple Silicon, hardening tests to expose silent failures, and using an AI-compiler feedback loop to systematically refactor raw types to generics, ultimately transforming it into a modern, thread-safe, and containerized library.

Key takeaway

For a DevOps or AI Engineer tasked with modernizing a legacy Java application, avoid "Tourist Prompts" to LLMs that generate optimistic, hallucinated solutions. Instead, adopt an "Archaeologist" mindset, using AI to perform forensic code audits and guide containment within a Docker "Time Capsule" before gradual, test-protected refactoring. This approach ensures verifiable baselines and prevents blind changes to fragile systems, transforming opaque legacy code into manageable technical debt.

Key insights

AI is most effective in legacy code modernization when grounded in evidence and constrained by clear roles and a step-by-step strategy.

Principles

Method

Modernize legacy Java by first auditing with an "Archaeologist Prompt," then containing in a Docker "Time Capsule" (Java 6/Ant on x86), lifting to Java 8/Gradle 7.6 on ARM64, hardening tests, and using an AI-compiler feedback loop for refactoring.

In practice

Topics

Code references

Best for: Software Engineer, DevOps Engineer, AI Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Martin Fowler.