I have this problem: I have data to save both local and both remotely on cloud, in order to be able to get them from every device. Now, if there is connection I have to load them from remote (and eventually update them if there was an update without connection) and save any changes also locally, if there is no connection I can and have to use only the local source. I first thought of a Strategy but it is evidently wrong, than I thought of a Proxy but I don't know if it fits. During my design I created a managerPreferitiDB that on the situation (probably with a State pattern) accesso to localPreferitiDB (for local access) and/or cloudPreferitiDB (for remote access). I Thought that I should probably have a preferitiRetriever Interface, implemented by both of them and then having two or more preferitiRetriever in my managerPreferitiDB Proxy.
Any advices? Is there a better pattern that suits this? I'm using Java for Android, Thanks
Aucun commentaire:
Enregistrer un commentaire