Code quality

Small systems:

  Livestock systems, government systems, micro small shopping channel, a single web system

  Simple front and rear interact directly involved in the back-end part of the third-party business, or not

  ToB mainly for government or education sector, the use of small shops

Midrange systems:

  Distributed systems, such as micro-credit, micro-channel end, back-end side, the pool of money the system, collection system, regular tasks, third-party data collection, each sub-module of the system

      ToC mainly for end users, but also has a large toC end system, such as the US group

Large systems:

  Distributed systems, such as supply chain, SAP, rookie logistics like supply chain, from the sale subsystem, subsystems procurement, logistics subsystem, subsystem materials, processes subsystem, the privilege subsystem, inventory subsystem, a function involving to many aspects, calling a link has a traceId, as a call to complete the link http

  If large systems, an error occurs, the error will be very complicated investigation, the development, the quality of the code for the control, and log output is very important.

  This business process normally takes three, one is internal business, one is external business processes, internal business calls to other internal business development, external development called by other internal, such an error occurs, the investigation more complex, in the development process for the retrospective issue are the following points can quickly locate:

  1. Handling business, as little as possible try ... catch, using a defined enumerated type, as the return information, you can know what the problem is in the front-end information return

  2. If the internal business process, there is the case of calling external interfaces, input parameters must be printed before the calls and calling information outputs, can be added traceId, uuid generated, if the entire link problem http log storage errors, occur for locate

  3. If you call other methods developed to capture abnormal size as small as possible, the whole code must not try ... catch, in order to facilitate the search log locate lines of code, a relatively large-scale projects have all kinds of interference logs, if not effective log back will waste a lot of time on top of the log as clear operational action, what action log records

  4. A big feature, you must split a small function for processing a large way to deal with the process, the details of processing functions to small, clear division of labor, the code is clear, it is conducive to reading and quality control

  

 

Guess you like

Origin www.cnblogs.com/2014-1130/p/11456057.html
Recommended