forma icon indicating copy to clipboard operation
forma copied to clipboard

Clean sample on the clean

Open michaem opened this issue 5 years ago • 1 comments

Legacy part of our sample doesn't have almost clean architecture. That's why, we had some stuck trouble with relations between presentation layer and data layer. For example check out these files CharacterPageDataSource.kt and CharactersListViewModel.kt and you'll see.

GlobalScope.launch(CoroutineExceptionHandler { _, _ ->
            retry = {
                loadInitial(params, callback)
            }
            networkState.postValue(NetworkState.Error())
        })

DataSource shouldn't know anything about scopes.

Necessary to make sample architecture more cleaner with weak deps between presentation layer and data by implementing use case on domain layer. It will be necessary for future, for example, to make tests functionality from Forma.

michaem avatar Dec 02 '20 14:12 michaem

Here is the class diagramm diagram I painted the main problems in red. And we also need usecases.

ntnsmirnov avatar Dec 12 '20 07:12 ntnsmirnov