Home > Article > Backend Development > Please tell me about the APP backend multi-version strategy
Someone has asked this question before, but I saw that there are no nutrients that can be absorbed, so I want to ask again, how do everyone do it?
Because the project needs to control the situation where multiple versions of interfaces are provided to multiple versions of clients at the same time, I have always had questions about the interface version strategy. Please tell me how you achieved it?
Back-end language: php
The implementation methods I can think of at present:
1. Single directory, internal judgment of the interface (very disgusting, easy to cause confusion)
2. Drag out a version directory for each version, and you can modify it as you like A version of the interface, but if there is an interface logic that needs to be modified, it may involve files in all versions, such as 1.0, 2.0, 3.0, 4.0. . . A very abnormal way
3. Create a basic version and use the rules of autoload. If there is one in the version directory, use the class in the version directory. If not, use the class in the basic version. The advantage is that only changed files exist in each version directory. But during development, it still feels laggy.
4. Using inheritance, the classes in the version 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 problem of private methods is taken into consideration.
I hope there are other ways to better manage multiple version issues.
Thank you