search
HomeBackend DevelopmentPHP TutorialFrom software legacy to strategic opportunity: The starting point (I)

Refactoring legacy software: from challenges to opportunities

This article tells how we handle the internationalization of an logistics management system (OMS) and the challenges of integrating with new e-commerce platforms. The system was developed in 2018 to optimize the order preparation process of a booming e-commerce company and efficiently integrate with different logistics operators. Built using PHP (Symfony), MySQL, Socket.io, and jQuery, it covers the entire process from packaging to shipping, including features such as order tracking, courier connections, label generation, and order preparation performance metrics.

The accumulation of technical debt

This system worked well for many years, but as the business grew, its limitations became increasingly apparent. Technical debt is particularly worrisome, affecting multiple levels of a project. In terms of technical infrastructure, the application runs on outdated frameworks and base language versions:

  • Symfony version (4.0) is not a long-term support (LTS) version and will stop receiving security updates starting from January 2019.
  • PHP 7.1 has also ended its life cycle and the system lacks critical security updates.

In addition to outdated versions, the project also has serious flaws in the fundamentals of software development:

  • Lack or Insufficient Testing: A lack of automated testing (unit, integration, and end-to-end testing) not only hinders the early detection of bugs, but also makes any modifications potentially jeopardizing the stability of the system.
  • Lack of coding standards: The codebase does not follow any documented patterns or standards, and even if there are, they are not consistent with industry best practices. This makes both maintenance and onboarding new developers to the project difficult.
  • Inadequate documentation: Existing documentation is sparse and often incomplete. This affects not only technical development but also the understanding of the business processes implemented in the code.
  • Incomplete version control: Git history lacks explanation, commit granularity is rough, messages do not follow any conventions, and lack background information on the changes made. This makes it difficult to understand the evolution of code and decisions made over time.

The accumulation of technical debt not only poses a threat to the stability and security of the system, but also:

  • Reduced the development speed of new features
  • Increased risk of introducing bugs
  • Increased the difficulty for new members to join the team
  • Increased maintenance costs
  • Complicates problem diagnosis and resolution

Structural limitations

The original architecture had coupling issues that seriously affected its flexibility and scalability:

  • Completely dependent on the main e-commerce platform: The application cannot run independently, and all logistics operations are directly dependent on the data and processes of the e-commerce platform. This means that any changes to the main platform may break the functionality of the system.
  • Shared database causing performance issues: Logistics applications and e-commerce platforms use the same database, which leads to performance issues, especially during peak load periods for either application. Additionally, this configuration complicates permission management because any access to the database may compromise important data from other systems.
  • Cannot run standalone: This app is designed to run only with e-commerce platforms. Not only does this limit its portability, it also prevents testing in an isolated environment or migrating to other platforms. Its dependencies are not properly encapsulated, any attempt at isolation would require large and costly changes to the entire system, and the Single Responsibility Principle (SRP) is not adhered to in the main class.
  • Difficulty in implementing new features: Lack of compliance with the Open/Closed Principle (OCP) and Liskov Substitution Principle (LSP) greatly hinders the evolution of the system. New features require modifications to existing code, increasing the risk of introducing regressions. Additionally, direct dependencies between modules make following the Dependency Inversion Principle (DIP) nearly impossible.

These structural limitations not only reduce the maintainability and scalability of the system, but also increase the risks associated with any modification or evolution, leaving the application in a technically fragile and strategically vulnerable state.

Development management and strategic alignment

One of the most significant challenges is not only technical, but also strategic. While external development is functionally correct, there are significant organizational limitations:

  • Disconnected from global strategy: Development is done in silos without a complete understanding of the company’s internal goals and processes. This results in features that, although technically correct, don't always meet the actual needs of the business.
  • Lack of strategic prioritization: Implementation of new features lacks a clear evaluation and prioritization process. There is no questioning whether a feature is truly necessary, whether it is the best way to implement it, or whether a more efficient alternative exists.
  • Reactive Development vs. Proactive Development: Development primarily follows a reactive model, addressing immediate needs without considering long-term impacts or potential synergies with other processes in the company.
  • Lack of Validation Process: The lack of a structured review and validation process results in features that, while working, don’t always provide the best solution for the end user or the company’s overall goals.

This situation is unsustainable in the long term because it:

  • Resulting in products increasingly deviating from actual needs
  • Hinders integration with other company systems and processes
  • Complicates strategic decisions about products
  • Limits the team’s ability to innovate and continuously improve

Impact of basic costs

An often overlooked but particularly important aspect in this project is base cost, which I believe is a key concept in software development and refers to the cost of keeping a system running even without adding new features or making improvements. minimum cost required.

In our case, base costs include all costs associated with maintaining obsolete framework and language versions, resolving emergencies due to accumulation of technical debt, managing dependencies with other systems, adapting to coupled architectures, and domain knowledge costs incurred due to insufficient understanding. All of this consumes a significant amount of available resources and directly impacts the ability to invest in innovation and continuous improvement.

Although this factor was not the decisive factor in our decision to internalize development, it was quite influential in the initial diagnosis of the project. Base costs are often ignored when assessing the sustainability of a system, but in this case it clearly demonstrates that current strategies are unsustainable in the long term. Furthermore, as we will see in subsequent articles, any attempt to maintain the existing structure will exponentially increase the base cost over time.

For a more detailed explanation of basic cost concepts and their importance, it is recommended to refer to Eduardo Ferro’s original article.

Turning Point: New Challenges and Strategic Decisions

In any refactoring project, there are multiple strategies that can be employed, and the dilemma is often encountered: strangler fig or big bang rewrite.

De software legacy a oportunitat estratègica: El punt de partida (I)

The initial technical decision was to work within the same legacy project using the Strangler Pattern, an approach that involves developing a new module or system that gradually replaces parts of the old system. This strategy allows us to make parallel changes, reduce risk, and maintain current functionality while building a stronger foundation to support future functionality.

However, from a business perspective, this option poses an undue risk to the existing system (which is already operational and performing its functions). We decided to avoid touching the existing project and instead develop a standalone application to meet the new needs.

This shift resulted in us forking the existing codebase, a decision that was technically feasible but had certain drawbacks:

  • Duplication of code bases: Two separate code bases now need to be maintained.
  • Database Separation: Data structures must be copied and adapted for each system.
  • Infrastructure replication: Requires deploying independent servers and ensuring appropriate observability for each system.
  • Increased cognitive load on the team: All this duplication requires extra effort to maintain consistency between the two systems, thereby increasing the team’s complexity and risk of errors.

This approach allows us to move towards independent solutions, ensuring the stability of existing systems while developing a project aligned with new strategic goals. However, a detailed analysis of the pros and cons is necessary to plan and address this challenge with confidence. In addition, we reached a consensus with the business level not to expand functionality and to tightly control the project's backlog until the migration to the new e-commerce platform was completed.

De software legacy a oportunitat estratègica: El punt de partida (I)

优点 缺点
在非生产环境中工作,降低生产环境的风险 需要暂时维护多个项目
自由地从零开始实施新技术和模式 在维护方面的努力暂时重复
不必担心旧系统的技术限制或依赖关系 由于需要在系统之间同步更改,功能的重复可能会长期减缓开发速度
能够专注于必要的特性 截止日期的风险,因为有两个代码库
有机会从一开始就实施最佳实践 项目管理的复杂性
更容易从一开始就实施测试 需要与历史数据保持兼容性
灵活地适应新的业务需求 初始时间和资源成本更高
更好地与公司的整体战略相一致 可能暂时丢失非必要的特性

Conclusion and next steps

The decision to internalize and rewrite legacy software is never easy, especially when the software is capable of doing its job. The saying "If it works, don't touch it" will always be there. However, sometimes it takes one step back to take two steps forward.

In subsequent articles in this series, we will explore how we responded to these challenges, the technical and strategic decisions we made, and how we turned these challenges into opportunities for improvement and team development.

The above is the detailed content of From software legacy to strategic opportunity: The starting point (I). For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP's Current Status: A Look at Web Development TrendsPHP's Current Status: A Look at Web Development TrendsApr 13, 2025 am 12:20 AM

PHP remains important in modern web development, especially in content management and e-commerce platforms. 1) PHP has a rich ecosystem and strong framework support, such as Laravel and Symfony. 2) Performance optimization can be achieved through OPcache and Nginx. 3) PHP8.0 introduces JIT compiler to improve performance. 4) Cloud-native applications are deployed through Docker and Kubernetes to improve flexibility and scalability.

PHP vs. Other Languages: A ComparisonPHP vs. Other Languages: A ComparisonApr 13, 2025 am 12:19 AM

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP vs. Python: Core Features and FunctionalityPHP vs. Python: Core Features and FunctionalityApr 13, 2025 am 12:16 AM

PHP and Python each have their own advantages and are suitable for different scenarios. 1.PHP is suitable for web development and provides built-in web servers and rich function libraries. 2. Python is suitable for data science and machine learning, with concise syntax and a powerful standard library. When choosing, it should be decided based on project requirements.

PHP: A Key Language for Web DevelopmentPHP: A Key Language for Web DevelopmentApr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP: The Foundation of Many WebsitesPHP: The Foundation of Many WebsitesApr 13, 2025 am 12:07 AM

The reasons why PHP is the preferred technology stack for many websites include its ease of use, strong community support, and widespread use. 1) Easy to learn and use, suitable for beginners. 2) Have a huge developer community and rich resources. 3) Widely used in WordPress, Drupal and other platforms. 4) Integrate tightly with web servers to simplify development deployment.

Beyond the Hype: Assessing PHP's Role TodayBeyond the Hype: Assessing PHP's Role TodayApr 12, 2025 am 12:17 AM

PHP remains a powerful and widely used tool in modern programming, especially in the field of web development. 1) PHP is easy to use and seamlessly integrated with databases, and is the first choice for many developers. 2) It supports dynamic content generation and object-oriented programming, suitable for quickly creating and maintaining websites. 3) PHP's performance can be improved by caching and optimizing database queries, and its extensive community and rich ecosystem make it still important in today's technology stack.

What are Weak References in PHP and when are they useful?What are Weak References in PHP and when are they useful?Apr 12, 2025 am 12:13 AM

In PHP, weak references are implemented through the WeakReference class and will not prevent the garbage collector from reclaiming objects. Weak references are suitable for scenarios such as caching systems and event listeners. It should be noted that it cannot guarantee the survival of objects and that garbage collection may be delayed.

Explain the __invoke magic method in PHP.Explain the __invoke magic method in PHP.Apr 12, 2025 am 12:07 AM

The \_\_invoke method allows objects to be called like functions. 1. Define the \_\_invoke method so that the object can be called. 2. When using the $obj(...) syntax, PHP will execute the \_\_invoke method. 3. Suitable for scenarios such as logging and calculator, improving code flexibility and readability.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),