Android-CleanArchitecture-Kotlin icon indicating copy to clipboard operation
Android-CleanArchitecture-Kotlin copied to clipboard

How to create database in this architecture?

Open letruonglamit opened this issue 6 years ago • 6 comments

letruonglamit avatar Feb 04 '19 10:02 letruonglamit

Why is this closed? Any idea that you can share? Initially, i was thinking to use Room but it is not included in this project

crjacinro avatar Feb 10 '19 16:02 crjacinro

Theoretically the UseCase should save to DB, while the DB exposes either LiveData<List<T>> or Flowable<List<T>> to observe changes.

Data from network shouldn't be given back to UI directly, nor to the ViewModel's LiveData really (assuming there is local db).

Zhuinden avatar Feb 10 '19 18:02 Zhuinden

ok is there a fork of this project that has Room incorporated?

crjacinro avatar Feb 11 '19 01:02 crjacinro

I'm finding a way to use realm database. It is provided as a Network inside Repository.

letruonglamit avatar Feb 11 '19 02:02 letruonglamit

I'm finding a way to use realm database. It is provided as a Network inside Repository.

room would be a great example for this awesome clean arch

mochadwi avatar Jun 27 '19 07:06 mochadwi

I have an example using as base this project in my own repository.

https://github.com/CristianMG/KCleanArchitectureExample

But, I have a question, in this example the repository seems be using directly of use cases. I create my own repository with different annotations in dagger one of them cloud and other disk, but the disk repository has unused functions.

This breaks one of solid's principle "Interface segregation principle". here you can view the example https://gist.github.com/CristianMG/2c228e40bcf2166ce9daee6e70d5dc3f

As you can see there are functions in one of implementation that throw exception, I'm not pleased with this type solution.

I would like to know if any knows better solution without break the solid principle.

Thanks

@android10 @Zhuinden

CristianMG avatar Apr 10 '20 22:04 CristianMG