Renovation of old systems-Foreword

Posted Jun 5, 20202 min read

Foreword of old user system transformation and upgrade

problem

  1. Business complex
  2. Package chaos
  3. Old tools are unstable
  4. The routing name rules are confusing
  5. Too much code coupling, too much code duplication
  6. Too much code

Causes difficulties in later code maintenance, such as bug positioning, iteration of new functions, and difficulty for newcomers to get started, etc.

Split purpose

  1. Re-plan the package
  2. Discard old tools
  3. Redefine routing rules(as compatible as possible)
  4. Reduce code coupling, avoid duplication of code, large blocks of code
  5. Clear annotations
  6. Unified API calling tool

step

  1. According to the Alibaba project layered package planning

  2. Define the meaning of the new project(non-login registration related interfaces are completely refactored into new services
    User services are split into two services:registration and login and user center.) Split the interface to be migrated and name the interface route

  3. Writing of general functions, global exception interception, general filter, global return code, exception business process handling

  4. Business coding

    1. Common layer processing, cache, rpc, three-party api
    2. Replace old tools
    3. Common service layer withdrawal
  5. Unit testing and integration testing subcontracting

New Project Directory

image.png

  1. intTest is the integration test directory
  2. com.eqxiu.common is general logic, this package is not in the Alibaba engineering specification, it is only used to extract the common configuration here
  3. user.config global exception interception, cross-domain, and other configuration classes
  4. user.constant business static variable
  5. user.manager common business layer, such as cache, rpc, three-party api(WeChat service, SMS service, etc.)
  6. user.service business layer
  7. user.util no business tool class(emphasis on no business, including not calling remote services, try to only rely on the basic class library)
  8. user.web control layer(here only for parameter verification)

image.png