I do not understand why not reuse the old interfaces?

Party colleagues today have asked me why b interfaces function without a certain function of a certain interfaces (api front-end interfaces to do a function, a similar query user data), you need not to say that both use the same table data? (Similar to the user data table)

Do not want to answer, why, because I suspect asked this question when he did not see the code, or not to think, but simply to consider the issue from a business level.

Explain, a function is already on a product line features more than two years and stable operation of the product in good yields. b is the latest feature to be added a product similar to a function.

The above mentioned certain interfaces, colleagues why I do not mean the old interface, that is a common written and b do a certain function interface.

Although both products after collection of user data common features of a database table, but because the two products have their own business logic function, i.e., to get the user data have different business logic. Different product features, but also to get another another each different data (data fields completely different), with the public use of user data.

What is the problem with the old interfaces?

1, a product feature has been stable for 2 years running, code modifications who test?

2, a and b are taken while the same user data, but also after taking their business logic, it can be said that only a code (querying user data), as the complexity of the change the old interface in this case is much larger than the newly written one interface.

3, the business logic becomes complicated, difficult to understand the code

4, unnecessary logic, in particular in the loop, affect performance

The benefits of using the new interface:

1, the decoupling between business, independently of each other between the two product features

2, does not affect previous product features, will not increase the workload of retesting

3, a single interface method duties, easier to read

In fact, in the actual work we can, as the case may be, does not have to follow the old codes before, do not necessarily have to tangle code reuse issues, and more from several angles at the pros and cons analysis.

 

Guess you like

Origin www.cnblogs.com/ibigboy/p/10953611.html