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?