App development interface will encounter many version (Andriod 1.2.3.2, iphone 1.2.2.3, ipad 2.5.3.1 ...) Many clients (Android, iphone, ipad), because the product is iterative development, may be different client different version of the logic of the design, resulting in the code there are many such if judgment, maintenance and code readability is very poor, this block should be how to design code and logic clearer, Easier to maintain?
Or what design patterns should the product conform to, or when the code should be written?
Reply content:
App development interface will encounter many version (Andriod 1.2.3.2, iphone 1.2.2.3, ipad 2.5.3.1 ...) Many clients (Android, iphone, ipad), because the product is iterative development, may be different client different version of the logic of the design, resulting in the code there are many such if judgment, maintenance and code readability is very poor, this block should be how to design code and logic clearer, Easier to maintain?
Or what design patterns should the product conform to, or when the code should be written?
APIs on large versions can be directly differentiated by URLs, and different versions of the background are deployed to different addresses, such as
Http://xxx/api/v1/xxxx
Http://xxx/api/v2/xxxx
Iterative development does not mean that you can not abide by any arbitrary changes, there are many if, that means that your interface in the beginning of the design is not considered good enough. Putting a product out of an iteration in this way is not a pit of your own.
It is recommended that you take a look at a book called Refactoring: Improving the design of existing code, with a few different approaches to if.
In addition to this, I think it is possible to put these logic or version judgment in a static file to maintain?