Consultation: Policy on multiple versions of mobile app backend Interfaces

Source: Internet
Author: User
Tags autoload
Because the project needs to control how interfaces of multiple versions are provided to clients of multiple versions at the same time, you have always been skeptical about the interface Version Policy. How can this problem be achieved? Backend language: php implementation methods I can think of now: 1. single directory, internal interface judgment (very evil... because the project needs to control how interfaces of multiple versions are provided to clients of multiple versions at the same time, you have always been skeptical about the interface Version Policy. How can this problem be achieved?
Backend language: php
Currently, I can think of the following implementation methods:
1. single directory, internal interface judgment (disgusting, easy to cause confusion)
2. Each version is dragged out of a version directory. You can modify the interfaces of a specific version as you like. However, if you want to modify an interface logic, files in all versions may be involved, such as 1.0, 2.0, 3.0, 4.0 .... Abnormal Method
3. Create a base version and use the autoload rule. If there is a base version directory, use the classes in the version directory. If not, use the classes in the base version. The advantage is that only changed files exist in the directories of different versions. But in development, it still seems to be a drag-and-drop.
4. Using inheritance and the classes in the version to override the class methods in the basic version, the advantage is that only one method needs to be rewritten, but the disadvantage is that the private method is taken into account.

I hope there are other methods to better manage the problems of multiple versions.
Thanks

Reply content:

Because the project needs to control how interfaces of multiple versions are provided to clients of multiple versions at the same time, you have always been skeptical about the interface Version Policy. How can this problem be achieved?
Backend language: php
Currently, I can think of the following implementation methods:
1. single directory, internal interface judgment (disgusting, easy to cause confusion)
2. Each version is dragged out of a version directory. You can modify the interfaces of a specific version as you like. However, if you want to modify an interface logic, files in all versions may be involved, such as 1.0, 2.0, 3.0, 4.0 .... Abnormal Method
3. Create a base version and use the autoload rule. If there is a base version directory, use the classes in the version directory. If not, use the classes in the base version. The advantage is that only changed files exist in the directories of different versions. But in development, it still seems to be a drag-and-drop.
4. Using inheritance and the classes in the version to override the class methods in the basic version, the advantage is that only one method needs to be rewritten, but the disadvantage is that the private method is taken into account.

I hope there are other methods to better manage the problems of multiple versions.
Thanks

Http://ningandjiao.iteye.com/blog/1990004

Could you give me a teacher's answer?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.