android / android/architecture-samples

[todo-mvp-clean] Applying Dependency rule

Open
#515 2 comments 7 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
45.8k
Forks
11.9k
PR merge metrics
No merged PRs in 30d

Description

I noticed the sample is not following the dependency rule proposed by the linked article Clean Architecture.I.e. [GetTasks](https://github.com/googlesamples/android-architecture/blob/todo-mvp-clean/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/domain/usecase/GetTasks.java) uses the Task Repository, which belongs to the data package. I would argue it is a style common when writing a 3-layer architecture where the TaskRepository is used as a Port to access the data layer.

In clean architecture the depencendy rule would force us to have a interface inside the domain layer which is implemented by some class in the data layer. As it is very common to have some kind of persistence, we could say we break the rule for convinience? How do we apply the dependency rule to other cases where domain logic wants to talk to the outside world i.e. Messaging or Sharing information.

What do you think? How did you manage this in practice ?

Contributor guide

Open the contributing guide

Research direction

Start with todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/domain/usecase/GetTasks.java and the linked Clean Architecture article. The issue is a design discussion rather than a defined change, so first establish the desired dependency rule and affected outside-world interactions; done criteria are not specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.