The latest insights from 50 techies who love what they do.

Migrate First or Refactor First?

One of the critical questions you need to tackle when modernizing a legacy application is whether to migrate it to the new platform first or refactor it before doing so.

During the discovery and planning process we often encounter custom applications that already have a roadmap for modernization and refactoring. In other cases our discovery process uncovers end-of-life frameworks and software components, unpatched security vulnerabilities and poor documentation such that the list of applications that need refactoring gets longer. I’ve written about these types of applications in a series of posts on Migration Resistant Applications.

When planning cloud migration for legacy applications that either have a modernization roadmap in place or newly discovered need for refactoring, the issue of order becomes important. Should we migrate first or should we refactor first?

It depends, of course! Here are some of the principles that I use when helping organizations decide between those two options.


Migrating first is a good strategy when:

  • Your organization has many applications to move
  • Your organization is reasonably comfortable with the current state of enterprise applications
  • Your organization does not have time/capacity to review and test the code changes before a migration.

The benefits of migrating first are:

  • Speed. Reducing or eliminating data center infrastructure and/or co-location leases quickly
  • Makes a clear distinction between migration and refactoring and enables your organization to concentrate the disruption due to migration to a much shorter time span
  • Spreads the costs of refactoring over a longer budgetary cycle


Refactoring first is a good strategy when:

  • The targeted applications have known security vulnerabilities that need immediate remediation.
  • The targeted applications are old and rely on customized installations/patching of operating systems and/or a patchwork of outdated languages, frameworks and libraries.
  • The targeted applications have not had code, documentation or performance reviews in years and contain private/sensitive data subject to government regulations.

The benefits of refactoring first are:

  • Your organization gains the full performance and cost savings that the cloud makes possible by refactoring using cloud-native, low code and “serverless” techniques.
  • Your organization gets a clean application. By remediating all known issues you to move a solid, vetted, approved application to the cloud instead of taking your problems with you.
  • Your organization gains a firm foundation for better and more efficient application support. By updating or creating missing documentation for features, policies, business rules, databases and code you provide a solid foundation for future support personnel.

So, yes, it does depend on your situation. Whether you migrate or refactor first depends on a mix of factors that include the number of applications to be moved, the quality of the applications in question, time pressures and organizational preference for front-loading the cost of refactoring or spreading it out. Although the decision can be complex, these principles can help you make the right decision for each application.

Tim Michalski

Tim Michalski is the founder & CEO of Lighthouse Software, a legacy software support and modernization firm that specializes in the delicate transition from older, reliable software systems to newer, modern technologies.

At the age of 8, Tim resolved to be an entrepreneur. At the age of 13, Tim discovered the creative power of computer programming when he received his first computer and learned his first programming language. For nearly 30 years since that day, Tim has passionately devoted most of his conscious hours towards becoming an expert software engineer and experienced entrepreneur. In that time, Tim built Lighthouse Software from the ground-up and championed the cause of restoring existing technology investments with iterative modernization over time to lower risks and gain a competitive advantage for his clients. Clients include numerous Fortune 500 companies to small technology firms in banking, healthcare, and government.

Leadership Best Practices for Migrating Legacy Applications

Migrating enterprise software systems to modern languages, platforms and libraries is a deeply challenging process with many risks and matching potential rewards.

DOwnload Resource