Table of Contents
Refactoring legacy software: from challenges to opportunities
The accumulation of technical debt
Structural limitations
Development management and strategic alignment
Impact of basic costs
Turning Point: New Challenges and Strategic Decisions
Conclusion and next steps
Home Backend Development PHP Tutorial From software legacy to strategic opportunity: The starting point (I)

From software legacy to strategic opportunity: The starting point (I)

Jan 15, 2025 am 06:14 AM

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 of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1655
14
PHP Tutorial
1252
29
C# Tutorial
1226
24
Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

What is REST API design principles? What is REST API design principles? Apr 04, 2025 am 12:01 AM

RESTAPI design principles include resource definition, URI design, HTTP method usage, status code usage, version control, and HATEOAS. 1. Resources should be represented by nouns and maintained at a hierarchy. 2. HTTP methods should conform to their semantics, such as GET is used to obtain resources. 3. The status code should be used correctly, such as 404 means that the resource does not exist. 4. Version control can be implemented through URI or header. 5. HATEOAS boots client operations through links in response.

What are anonymous classes in PHP and when might you use them? What are anonymous classes in PHP and when might you use them? Apr 04, 2025 am 12:02 AM

The main function of anonymous classes in PHP is to create one-time objects. 1. Anonymous classes allow classes without names to be directly defined in the code, which is suitable for temporary requirements. 2. They can inherit classes or implement interfaces to increase flexibility. 3. Pay attention to performance and code readability when using it, and avoid repeatedly defining the same anonymous classes.

How do you handle exceptions effectively in PHP (try, catch, finally, throw)? How do you handle exceptions effectively in PHP (try, catch, finally, throw)? Apr 05, 2025 am 12:03 AM

In PHP, exception handling is achieved through the try, catch, finally, and throw keywords. 1) The try block surrounds the code that may throw exceptions; 2) The catch block handles exceptions; 3) Finally block ensures that the code is always executed; 4) throw is used to manually throw exceptions. These mechanisms help improve the robustness and maintainability of your code.

Explain different error types in PHP (Notice, Warning, Fatal Error, Parse Error). Explain different error types in PHP (Notice, Warning, Fatal Error, Parse Error). Apr 08, 2025 am 12:03 AM

There are four main error types in PHP: 1.Notice: the slightest, will not interrupt the program, such as accessing undefined variables; 2. Warning: serious than Notice, will not terminate the program, such as containing no files; 3. FatalError: the most serious, will terminate the program, such as calling no function; 4. ParseError: syntax error, will prevent the program from being executed, such as forgetting to add the end tag.

What is the difference between include, require, include_once, require_once? What is the difference between include, require, include_once, require_once? Apr 05, 2025 am 12:07 AM

In PHP, the difference between include, require, include_once, require_once is: 1) include generates a warning and continues to execute, 2) require generates a fatal error and stops execution, 3) include_once and require_once prevent repeated inclusions. The choice of these functions depends on the importance of the file and whether it is necessary to prevent duplicate inclusion. Rational use can improve the readability and maintainability of the code.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

See all articles