Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we have a better implementation for DataManager? #9

Open
ryanhoo opened this issue May 29, 2016 · 4 comments
Open

Do we have a better implementation for DataManager? #9

ryanhoo opened this issue May 29, 2016 · 4 comments

Comments

@ryanhoo
Copy link

ryanhoo commented May 29, 2016

As this question Implementing MVP in Android app described, DataManager is a big concern if I am gonna take the architecture applied in ribot.

It's a simple fact that DataManager will grow as the business grows. The ribot android app is just a small demo project and we already have a medium size DataManager here. How would you deal with the problem if the DataManager grows too big?

@ivacf
Copy link
Contributor

ivacf commented May 31, 2016

Hi, yes you are right. Having a single DataManager can become a problem for large apps. The simplest solutions would be to split up the DataManager into multiple ones. For example: UserDataManager, CheckInDataManager, VenuesDataManager etc.

@therajanmaurya
Copy link

therajanmaurya commented Jun 26, 2016

Hi, I am doing My GsoC Project In which I have implemented the MVP architecture. My project became very big because It started before two years. When I implemented the MVP I made the single DataManager but after Implementation, I found DataManager became very big. Now I am splitting DataManager into multiple.

I am thinking to stay with Main DataManager and wire all small datamanager with it
Is it good ?

Now I have to Implement the Offline functionality (Here we have two modes of Application Online and Offline, we don't need to sync from DatabaseHelper if the Internet is not present or some error occurred during fetching data. If User is online load from REST API and if Offline load from DatabaseHelper).

I am confuesd,
How can I use RxBusEvent between DataManager and DatabaseHelper during wring them ?

@ryanhoo
Copy link
Author

ryanhoo commented Jun 26, 2016

@therajanmaurya I think you don't have to keep all those things in a single DataManager. You can totally split them into model-specific data managers. For instance: UserDataManager manages User related logics and User related only. All data managers follow the same pattern(which holds multiple data sources, local & network or anywhere else) and provide a uniform public interface to the presenters. This seems to be silly but it's well decoupled. After all, you certainly added tons of code for business logics in the past two years, but I guess you won't change or add models in such a frequent manner.

@therajanmaurya
Copy link

Thanks @ryanhoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants