dimanche 8 décembre 2019

Data sources responsibility

In situation when a program have "big" number of models (tables in SQLite or whatever) and the models are relationed(model depend on others models).

Each model have data source class that encapsulate the logic for example:

getAll()

getItemById(int id)

save(Item item)

...

Because the models are relationed data source contain other data sources and the logic of specific data source become messy and loose it responsibility, also it may lead to cyclic dependency(if you use Dagger).

So my question is there better way to handle this kind of situation? And is this wrong that data source contain other data sources?

Aucun commentaire:

Enregistrer un commentaire