Hire A Team
Request a Quote

Frequently Asked Questions

When should you rehost a legacy application instead of refactoring it?

You should rehost a legacy application instead of refactoring it when the application is stable, its existing code and functionality are still suitable, and the main problem is its hosting infrastructure. Refactoring is more appropriate when the code itself needs improvement to address maintenance, performance, or technical debt.

Key Takeaways

  • Rehosting is suitable when the application works properly but its existing infrastructure needs to change.
  • Refactoring is better when outdated or poorly structured code creates maintenance and performance problems.
  • Rehosting generally involves fewer application-level changes and can reduce migration complexity.
  • Refactoring requires more development effort, testing, and understanding of the existing codebase.
  • Businesses should assess application stability, infrastructure costs, technical debt, dependencies, and future requirements before choosing.
  • Rehosting can be the first step in a phased modernization plan, with refactoring considered later.

Understanding the Difference Between Rehosting and Refactoring

Rehosting and refactoring are two different approaches to legacy application modernization. The main difference is what the business wants to improve.

Rehosting focuses on moving an application to a different infrastructure or hosting environment while keeping most of its existing code and architecture unchanged. Refactoring focuses on improving the application’s internal code structure without significantly changing its external functionality.

Consider a company running a stable business application on ageing on-premises servers. The application supports daily operations, its features meet business requirements, and users are not experiencing major software-related problems. However, maintaining the servers is becoming expensive, and the company wants to move its workloads to the cloud. Rehosting may be the more practical option.

Now consider a different situation. The same application has duplicated code, tightly connected components, frequent software defects, and a development process that makes even small updates difficult. Moving it to the cloud will not resolve these problems. Refactoring may be necessary.

The decision should therefore begin with identifying whether the main limitation comes from the infrastructure or the application itself.

1. When Should You Rehost a Legacy Application?

Rehosting is the right choice when the application is still suitable for business use, but the infrastructure supporting it needs to change.

Businesses often choose rehosting when they want to move away from physical servers, consolidate infrastructure, or adopt cloud hosting without making major changes to the application.

You should consider rehosting in the following situations.

The Application Is Stable and Meets Business Requirements

If the application performs its required functions reliably, there may be little reason to change its code immediately.

For example, an internal inventory management system may have an older technology stack, but it continues to process orders, update stock, and generate reports correctly. If the business is satisfied with its functionality, moving it to a new hosting environment may be sufficient for the immediate requirement.

Existing Infrastructure Is Becoming Expensive

Maintaining on-premises infrastructure involves hardware, power, cooling, monitoring, maintenance, and replacement costs. These expenses can become difficult to justify as servers approach the end of their useful life.

Rehosting may help businesses move workloads to cloud infrastructure and reduce their dependence on physical hardware. However, cloud hosting is not automatically cheaper. The organization should compare migration costs, usage patterns, licensing, storage, and ongoing cloud charges before making a decision.

The Business Has a Limited Migration Timeline

Sometimes, an organization needs to move its applications within a specific timeframe because of a data centre closure, infrastructure contract expiry, or hardware replacement requirement.

Refactoring can extend the project because developers must examine the code, make changes, and test the modified components. If the application is stable and the immediate requirement is infrastructure migration, rehosting may offer a more direct route.

The Application Has Significant Dependencies

Some legacy applications depend on older databases, third-party integrations, specialised hardware, or established business workflows. Changing the code may affect several connected systems.

If these dependencies are well understood and the application can operate in the proposed new environment, rehosting may reduce the number of changes required during migration.

However, compatibility must be checked before moving the application. An application that depends on a specific operating system, runtime, or hardware configuration may need additional adjustments before it can run successfully in the new environment.

2. When Is Refactoring a Better Choice?

Refactoring is more suitable when the application code itself is creating problems that cannot be resolved by changing the hosting environment.

Moving an application to the cloud does not automatically make its code easier to maintain or improve its internal design. If the application has accumulated technical debt, refactoring may provide more long-term value.

Consider refactoring when:

  • The codebase is difficult to maintain: Developers spend excessive time understanding existing code before making even small changes.
  • Software defects occur frequently: Poorly structured code and duplicated logic make it difficult to identify and fix problems.
  • New features take too long to develop: The existing code structure makes it difficult to introduce business changes.
  • Application performance is affected by inefficient code: Slow processes may be caused by inefficient queries, algorithms, or application logic rather than infrastructure limitations.
  • Technical debt is increasing: Outdated coding practices and unnecessary dependencies make future development more expensive.
  • The application needs better testability: Refactoring can help create a more manageable structure for automated testing and ongoing maintenance.

For example, a customer management application may run on reliable servers but take several weeks to implement relatively small feature changes. If the problem comes from tightly coupled modules and duplicated code, moving the application to cloud hosting will not address the underlying issue.

Refactoring the relevant components can make the application easier to maintain and extend.

3. Rehosting vs Refactoring: Key Differences

The following comparison explains how the two approaches differ and what businesses should consider before selecting one.

Decision factor Rehosting Refactoring
Main objective Move the application to new infrastructure Improve the internal code structure
Code changes Minimal or none Changes to existing code
Architecture Mostly retained Usually retained, though internal design may improve
Development effort Generally lower Generally higher
Testing requirements Focus on migration and environment compatibility Focus on code changes, functionality, and regression testing
Typical reason Ageing or costly infrastructure Poor code quality or increasing technical debt
Business impact Changes where the application runs Changes how the application is maintained and developed
Main risk Compatibility and migration issues Introducing defects while modifying existing code

Neither approach is automatically better. Rehosting addresses infrastructure limitations, while refactoring addresses code quality and maintainability. The choice depends on the problem the business needs to solve.

4. Situations Where Rehosting Is Better Than Refactoring

Rehosting is often the more practical option when changing the application code would add cost and risk without solving the immediate business problem.

Here are some common examples.

Scenario 1: The Business Needs to Move Away from On-Premises Servers

A company operates a stable application on its own servers. The hardware is ageing, maintenance costs are increasing, and the organization wants to move its workloads to a cloud environment.

If the application is compatible with the target environment, rehosting may meet the immediate requirement. Refactoring the code would add development work without necessarily improving the infrastructure migration outcome.

Scenario 2: The Application Is Approaching a Data Centre Exit Deadline

An organization may have to vacate a data centre because of a lease expiry or infrastructure consolidation project. The application still supports essential business operations, and there is limited time for major software changes.

Rehosting can help the organization meet the migration deadline while keeping application changes limited. Refactoring can be planned separately after the application is running in the new environment.

Scenario 3: The Application Has Stable Functionality but Needs Infrastructure Support

An older reporting application may have a reliable codebase and continue to meet user requirements. However, the infrastructure it depends on may no longer fit the organization’s technology strategy.

If the application can run in a supported environment without major code changes, rehosting may be sufficient. Refactoring would be more useful if the application also had code-level problems that affected maintenance or performance.

Scenario 4: The Business Wants to Minimise Changes to Critical Workflows

Applications used for financial processing, inventory, logistics, or other essential operations may have complex business rules. Changing these rules or modifying large sections of code can introduce operational risks.

If the immediate objective is to move the application to a different infrastructure, rehosting can limit the scope of change. The organization must still validate the migrated application and confirm that its integrations and workflows function correctly.

5. When Rehosting Alone Is Not Enough

Rehosting should not be used as a substitute for fixing serious application-level problems.

A business may successfully move an application to cloud infrastructure and still experience the same problems it had before migration. This happens when the underlying limitations are part of the software rather than the hosting environment.

Rehosting alone may not be sufficient when:

  • The application has serious security vulnerabilities in its code or dependencies.
  • Its architecture prevents it from scaling as required.
  • Developers cannot maintain or extend the application efficiently.
  • Performance problems are caused by inefficient application logic.
  • The technology stack is unsupported in the target environment.
  • The application cannot integrate with essential modern business systems.

In these situations, refactoring or a more extensive modernization approach may be necessary. Businesses should also distinguish between application code problems and infrastructure configuration problems. For example, poor server sizing may be resolved through infrastructure changes, while inefficient database queries may require code or database-level improvements.

A technical assessment should identify the actual cause before the business commits to a solution.

6. Can You Rehost First and Refactor Later?

Yes. Rehosting first and refactoring later can be a practical phased modernization strategy when infrastructure migration is urgent but the application also needs longer-term improvements.

This approach allows businesses to separate immediate infrastructure requirements from broader application development work.

A phased plan may look like this:

  1. Assess the existing application: Review its architecture, dependencies, database, integrations, security requirements, and current performance.
  2. Confirm infrastructure compatibility: Check whether the application can run in the proposed hosting environment without major code changes.
  3. Prepare the migration: Plan the target environment, backups, network configuration, access controls, and rollback process.
  4. Rehost the application: Move the application and its required data, then validate its core workflows and integrations.
  5. Monitor the migrated system: Check performance, availability, resource usage, and operating costs.
  6. Plan targeted refactoring: Identify code components that need improvement and prioritise them based on business impact.
  7. Refactor and test incrementally: Improve selected components, run regression tests, and release changes in controlled stages.

This sequence is not suitable for every application. If the existing code contains critical security problems or cannot run in the target environment, those issues must be addressed before or during migration.

7. What Should Businesses Assess Before Choosing Rehosting?

A structured application assessment helps businesses confirm whether rehosting will solve the immediate problem or simply move existing limitations to a new environment.

Before selecting rehosting, review the following areas.

Application Compatibility

Check whether the application can run on the target infrastructure. Review its operating system, programming language, runtime, database, libraries, and third-party dependencies. Identify any components that may require upgrades or configuration changes.

Infrastructure and Operating Costs

Compare the current infrastructure costs with the expected costs of the new environment. Include hosting, storage, data transfer, licensing, monitoring, backup, and support. A migration should have a clear financial justification.

Security and Compliance

Review access controls, encryption, data storage, network security, backup policies, and applicable compliance requirements. Rehosting changes the hosting environment, so security responsibilities and configurations must be reviewed for the new setup.

Application Performance

Measure current application performance before migration. This provides a baseline for checking whether the new environment meets business expectations. If performance issues originate in the code or database design, rehosting alone may not resolve them.

Integration and Data Dependencies

Identify all systems that exchange information with the application. This includes internal databases, payment gateways, APIs, reporting platforms, and third-party services. Confirm that these connections will continue to work after migration.

Future Business Requirements

Consider whether the application will need new features, additional users, better integration, or greater scalability in the near future. If these requirements demand significant code changes, a rehosting-only strategy may provide limited long-term value.

8. How Technical Debt Influences the Decision

Technical debt is an important factor because it helps businesses understand whether the main modernization requirement relates to infrastructure or the application code.

Technical debt refers to the future cost and effort created by earlier technology decisions, shortcuts, outdated code, and design limitations. An application can run reliably on existing infrastructure while still carrying significant technical debt.

McKinsey research involving 50 CIOs from financial services and technology companies found that technical debt was estimated at 20% to 40% of the value of their technology estate before depreciation. The survey was conducted in July 2020, so the figure should be understood in the context of those respondents rather than as a universal estimate for every business. Read McKinsey’s research on technical debt.

This distinction matters when selecting a modernization approach. Rehosting may move an application away from ageing infrastructure, but it does not remove technical debt in the codebase. Refactoring can address selected code-level problems, but it may not resolve infrastructure limitations.

Businesses should therefore evaluate both areas separately. If the infrastructure is the main concern and the code remains suitable, rehosting may be enough for the current phase. If technical debt is affecting development, maintenance, or reliability, refactoring should be considered as part of the modernization roadmap.

9. How to Make the Final Decision

The following decision guide can help businesses identify the more appropriate starting point.

Business situation Recommended starting point
Application works reliably, but servers are ageing Rehost
Business needs to exit a data centre quickly Rehost, after compatibility checks
Application code is difficult to maintain Refactor
Developers struggle to add new features Refactor
Infrastructure costs are high, but application code is stable Evaluate rehosting and cloud costs
Performance problems come from inefficient code Refactor the affected components
Application has both infrastructure and code limitations Plan a phased combination
Existing architecture cannot support future requirements Consider rearchitecting or rebuilding

These are starting recommendations, not fixed rules. Some applications may require a combination of infrastructure changes, code improvements, and architectural updates.

Businesses can also review how software requirements and application functionality are handled in Bantech’s Verilock case study and Title Shield case study. These provide examples of business-focused software solutions, although the appropriate modernization strategy for another application must be determined through its own technical assessment.

Final Thoughts: Rehost or Refactor?

Rehosting is generally the better choice when a legacy application is stable, meets current business requirements, and needs to move to a new infrastructure. It allows businesses to address hosting limitations without immediately changing the application code.

Refactoring is more suitable when the existing codebase is difficult to maintain, creates development bottlenecks, or affects application performance. It addresses software-level problems that infrastructure migration cannot solve.

The most important step is to identify the actual reason for modernization. Businesses should assess the application, understand its dependencies, compare costs, and consider future requirements before deciding. In some cases, rehosting first and refactoring selected components later can provide a balanced path towards modernization.

Planning a Legacy Application Modernization Project?

Bantech Solutions can help evaluate your existing application, identify infrastructure and code-level limitations, and plan the right modernization approach for your business.

Contact Us Hire a Team Request a Quote

Why Choose BANTECH?

At BANTECH, we don’t just provide technology solutions—we deliver innovation, expertise, and reliability that set us apart. Here’s why businesses trust us as their preferred technology partner:

Contact us