mardi 13 septembre 2016

Data persistent layer design

I develop an Android app with Java. I'm trying to design proper app architecture (it is my task, not a whim) and I'm confused with persistence layer. There is a lot of patterns that confused me.

Right now I develop an interface DataProvider. It will have methods to add, remove, update and query entities from it's storage. Storage may be some database or something else. In my case I get data from server via http(s). So I planned to implement it with abstract MyClassDataProvider which will be extended to MyClassNetworkDataProvider.

Also I will develop a Repository. It is something like collection but with querying methods. MyClassRepository will contain MyClassDataProvider to get or save MyClasses from storage.

Is it a good idea? Am I understand this patterns correctly or not?

Aucun commentaire:

Enregistrer un commentaire