Some people have asked this question before, but I have seen nothing to absorb. so I would like to ask again, how do we do it? 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. Someone has asked this question before, but I don't see any nutrients that can be absorbed. so I would like to ask again, how do we do it?
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