Non-FictionAI OperatorSoftware Craft
AI for Code Migration and Upgrades eBook
Use AI to migrate legacy code, upgrade dependencie
by Crisp Cleora
Use AI to migrate legacy code, upgrade dependencies, and convert between frameworks or languages.
Formats
Free sample
Chapter 1: The Rewrite Trap--–- In the winter of 2019, a senior engineering team at a well-known financial services firm made a decision that would cost them eighteen months and nearly four million dollars. They decided to rewrite their core trading platform from scratch. No incremental migration, no strangler fig pattern, no gradual replacement. Just greenfield code and high hopes.Eighteen months later, they had a beautiful, modern Java 11 microservices architecture with all the right buzzwords—Kubernetes, Graph QL, event sourcing, the works. They also had zero users.
The rewrite failed not because the code was bad—it was technically excellent—but because the team had unknowingly rebuilt only 85% of the original functionality. The missing 15%? That was the undocumented business logic that had accumulated over a decade: the edge cases, the regulatory exceptions, the "we've always done it this way" rules that no one thought to document because "everyone knew them."The old system stayed in production. The new system was eventually abandoned. The team, demoralized and overworked, lost three senior engineers to burnout.
The trading platform, now even more legacy because no one had maintained it during the rewrite, limped along for another two years before a competitor ate their lunch.This story is not unusual. It is, tragically, the norm.Over the past decade, I have consulted for dozens of organizations attempting to modernize legacy systems. Banks, retailers, healthcare providers, government agencies—the industry verticals change, but the pattern remains stubbornly consistent. Teams look at a sprawling, undocumented, mission-critical codebase and conclude that the only way out is through a complete rewrite. They believe that starting from scratch is cleaner, faster, and less risky than incrementally migrating a system they don't fully understand.They are wrong.
And the data proves it.The Seduction of Greenfield Why do experienced engineers keep falling into the rewrite trap? The answer is psychological as much as technical. Legacy code is frustrating. It's filled with compromises made under deadlines long past. It uses libraries that were deprecated before some current team members joined the industry.
Its documentation—if it exists at all—is likely several versions out of date. Every time a developer touches it, they risk breaking some obscure dependency that no one remembers exists.The promise of greenfield development is intoxicating: clean architecture, modern frameworks, no technical debt. You can finally use that design pattern you read about on a blog. You can finally retire that god class that has been the source of every late-night outage. You can finally write tests that actually test something.But here is the uncomfortable truth that rewrite advocates consistently ignore: software is not just code.
Software is frozen business knowledge. Every conditional branch, every hardcoded constant, every seemingly bizarre error handling routine exists because someone, at some point, needed it to exist. When you throw away the code, you don't just throw away the syntax—you throw away the accumulated wisdom of everyone who touched that system.I call this the Knowledge Preservation Problem. And it is the single greatest reason that rewrites fail.Consider the following data points, drawn from industry research and my own consulting experience. Studies consistently show that 70-80% of complete system rewrites either fail outright, exceed their budget by more than 50%, or lose critical functionality that was present in the original system.
The famous rewrite of Netscape Navigator—a case study taught in engineering schools—took years longer than anticipated and ultimately failed to save the product. The UK's National Health Service attempted a rewrite of its patient record system, spending over ten billion pounds before abandoning the effort. Closer to home, a 2023 analysis of 500 enterprise software projects found that rewrites were three times more likely to be cancelled than incremental migrations.Why does this happen? The answer lies in what the industry calls the Unknown Unknowns. When you work with a legacy system, you know what you know—the features you use daily, the APIs you call, the reports you generate.
You also know what you don't know—the parts of the system that are confusing, poorly documented, or rarely touched. But there is a third category: the things you don't know that you don't know. The edge case that only triggers once a year during a specific financial reporting period. The validation rule that was added to satisfy a regulator who has since retired, but whose requirements are still legally binding. The integration with a vendor system that no one remembers exists until that vendor sends a notification that their API is changing.A complete rewrite guarantees that you will discover your Unknown Unknowns only after you have already committed to the new system, usually during user acceptance testing or, worse, after launch.
By then, it is too late. Adding a missing feature to a greenfield system is not simply a matter of copying code—you must rediscover the business logic, reimplement it, and then retest everything that might depend on it. Each discovery pushes the launch date further out, increases costs, and erodes stakeholder confidence.Incremental migration, by contrast, allows you to discover Unknown Unknowns gradually, while the legacy system remains operational. When you find a missing edge case, you can implement it in the new system and then verify it against the old system's behavior using techniques we will cover in Chapter 7 (the Safety Net). The legacy system acts as your oracle, your source of truth, your safety net.
You never have to guess whether your new implementation matches the old behavior because you can test them side by side.This is not a theoretical advantage. It is the difference between gambling and engineering.The Economic Shift: Why AI Changes Everything Even if rewrites were not inherently risky, they would still be economically questionable for most organizations. A complete rewrite of a moderately complex line-of-business application typically takes twelve to eighteen months and costs between one and five million dollars, depending on team size and scope. During that time, the legacy system continues to degrade because no one is maintaining it. Feature requests go unanswered.
Bugs accumulate. The business becomes increasingly frustrated with the IT department's inability to respond to changing market conditions.Incremental migration, performed manually, is not much better. The classic Strangler Fig pattern—which we will explore in depth in Chapter 9—replaces a legacy system piece by piece, but doing so manually requires maintaining two parallel codebases, writing extensive integration tests, and carefully orchestrating traffic migration. A manual strangler fig migration can take eighteen to twenty-four months, even longer than a rewrite, because you are essentially building the new system twice: once as a replacement for a specific module, and again to integrate that module with the rest of the legacy system.This is where artificial intelligence changes the calculus entirely.When you add AI to the migration process, the economics shift dramatically. AI does not replace the need for human judgment—as we will discuss throughout this book, the most successful migrations involve close collaboration between human architects and AI assistants.
But AI excels at the mechanical aspects of migration: analyzing dependency graphs, converting syntax between languages, generating test harnesses, and identifying patterns in legacy code that would take a human hours…
This is the end of the free sample. Get the eBook to keep going. Buy now
About this book
Details
- Author
- Crisp Cleora
- Publisher
- SamEnrico
- Language
- English
- Genre
- Non-Fiction, AI Operator, Software Craft
- Released
- 2026-06-01
- Pages (approx.)
- 137
- Available as
- eBook, Audiobook
Read better in the ZLOADR app
Your eBooks on your phone or tablet. Sign in with your SamEnrico account and start reading.
More by Crisp Cleora
End of Season Shopping BanCrisp Cleora$11.99
Hormone Balance On MATCrisp Cleora$11.99
The Mary Todd Lincoln LifeCrisp Cleora$11.99
Listening For Addiction RecoveryCrisp Cleora$11.99
The Derby Dancer: How a Forgotten Choreographer Revolutionized Football CelebrationsCrisp Cleora$11.99
Devops Automation SpecialistCrisp Cleora$11.99
How to Start a Fish and Chip Stand Business (Beginners Guide)Crisp Cleora$11.99
Learn to Play the SaenghwangCrisp Cleora$11.99You may also like
Hong Kong Handover 1997Dunn Johnnie$11.99
Zumba For Postnatal Recovery CourseNeal Christian$11.99
Zumba for BeginnersLadner Nikia$11.99
YouTube Comment Mining GuideHumes Pandora$12.99
Worry Box MeditationCarlin Rudy$11.99
Workplace Stress MeditationNguyen Lynn$11.99
Workplace Stress and Sleep RepairHawley Ivory$11.99
Workplace Perfectionism CureDelaney Jeffry$11.99
Workplace Injustice Anger GuideWallen Isabelle$11.99
Work Addiction and Burnout LinkGreenwood Ester$11.99
Women in Yoga and WellnessBeattie Galina$11.99
Women in Stand Up ComedyChun Evangeline$11.99