Abbreviated once reconstruction project

I. Background and context of reconstruction

Background: The original project mainly includes a service nearly 2,000 rows.

Large changes recently, some time ago, a colleague left, ordering the driver to give us a handover-related projects. The inputs are: the order and the driver list. Services based on the specific status of an order, take a number of different strategies to combine these drivers sort.

In fact, a few months ago, I tried to reconstruct the project, then do not understand business, struggling for a week or so, look at the code of dizziness, a parameter has been used in the export from the entrance, some parameters generated halfway across after a few hundred lines of code to be used. Single measurement can not write, pulled out of the first part of the tool category, but not feel the improvement of the entire class, eventually gave up.

About two weeks ago, the leadership of the speaker, to reconstruct this service, also organized several review. Clear objectives: that is to be reconstructed, integrated into another service inside the service under the original swap.

 

Second, reconstruction design

While I worked for so many years, also experienced large and small projects, but a complete reconstruction project of things to do too much. Design patterns one by one read it again, I feel irrelevant. It is to own request last reconstruction: packaging changes.

According to several reviews before I drew a rough flow chart, write a general idea, the group carried out the assessment, did not find any major problems.

Process substantially as follows:

1, shunt

Internal shunt require developers to modify their own, this is the main logic: Select a specific algorithm to order specific parameters.

Algorithm: a plurality of policies, as well as scores of heavy weight of each strategy.

Strategy: Minimum execution unit. Need to implement policies specified interface if you need data from other strategies, can interact by "session".

About "session": read the realization of ThreadLocal, feeling weak references may be cases where the process of thread execution data is cleaned GC, then internal implementation of a class ThreadLocal. Later, reading a lot of articles, find their own lack a deep understanding of the GC.

2, algorithm execution

A flow algorithm to obtain, according to the agreed order of implementation of each policy included, and updates the final score.

3 results found

Package return result

 

According to the above process, when the developers add algorithm, it requires: 1, developed their own strategy, 2, then a set of algorithms package manually, 3, is determined to increase their phase shunt branch

After the whole process framework written by another familiar business colleagues developed a strategy W, algorithms, the result of determination. After completion of the project, W colleagues conducted a Crosstalk.

 

Third, identify problems

He took the time, I found, to determine the result of this design is not much, I feel this is fixed before the design process.

Listen processes found that the overall result of all of the policy before any strategy relies. According to the current design, the results will be summarized only when all policy enforcement end.

Because the strong colleagues W engineering capabilities, directly modify the "judgment result" of this process, it is precisely because here, I found the problem (the equivalent of the frame is changed). .

 

Late improvements: Let strategy implementation can obtain the results summary. "The result judgment" should be allowed to determine their own algorithm developers.

 

Fourth, the project summary

For this reconstruction, the overall result is acceptable. Week and a half to develop, test less than two weeks, the reconstruction of a total of two years of development project, the personal feeling is very good.

Personal experience:

Package change, the change is to authority in their own hands. You can change the overall structure of the project from the overall situation when needed, without affecting the user too much of the frame.

Personally I feel:

A project, code development were concerned about the less, the less involved changes to the class, the less error-prone. The mandatory is forced, coding can not have too much freedom (convention over configuration)

 

V. Summary

1, in the premise not know enough about the business of reconstruction, architecture design, the higher the risk.

2, before the start of the design, we should fully discuss business scenarios. (Fortunately, the reconstruction of much missed)

3, after the new project is completed, the process chuanjiang is necessary.

 

Guess you like

Origin www.cnblogs.com/shuimutong/p/10953217.html