Actual architecture

I have an app where a model is attached to every activity. The model ask a repository for information that can come from server or local db depending on many factors. When it asks server for information it creates a petition encapsulated under an object that goes to a webService Manager that process the request. The webService manager returns and errorEvent if somethings goes wrong and also handles the errors. where there is information it returns a genericEvent that comes with all the information retrieved from the server.


The server is going to next rest api version, with some improvements and features. The server is an engine configurable from the app, since every client has it's own server setup. Some clients will not update their servers to new version, and use the version from playstore. So I need to be able to handle different versions of restApi from the app, since there will be endpoints missing on older versions of server.

My alternative for solutions

I've changed the Interface that is each repository, to a abstract class that extends this interface. in order to create common calls, that can be overridden under each version. So every new version will inherit from the previous one. with the necessary changes. This way I'll be able to handle changes.

NOTE: that is stated that endpoint that retrieves server configuration and version, won't change in time. Or at least in few years.

Any ideas about it?

  • 1
    have you thought about API Versioning? original API stays the same while the new api is at something like site.com/api/V2/endpoint. Old app and new app live happily together for a while (until you kill V1) – RubberChickenLeader Feb 2 '16 at 21:53
  • that's exactly what I've said before, but they need to extend some functionality not present on api v1 that is present on api v2 but have to maintain backward compatibility. and also moving everything to api v2 is not an option directly since some clients have server with api v1 only and they don't want to force them to update – Pedro Teran Feb 3 '16 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.