{"action":"created","issue":{"url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/136","repository_url":"https://api.github.com/repos/android10/Android-CleanArchitecture","labels_url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/136/comments","events_url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/136/events","html_url":"https://github.com/android10/Android-CleanArchitecture/issues/136","id":144921041,"number":136,"title":"Why data layer has a dependency on the domain layer?","user":{"login":"andrewjohnson90","id":10178419,"avatar_url":"https://avatars.githubusercontent.com/u/10178419?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewjohnson90","html_url":"https://github.com/andrewjohnson90","followers_url":"https://api.github.com/users/andrewjohnson90/followers","following_url":"https://api.github.com/users/andrewjohnson90/following{/other_user}","gists_url":"https://api.github.com/users/andrewjohnson90/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewjohnson90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewjohnson90/subscriptions","organizations_url":"https://api.github.com/users/andrewjohnson90/orgs","repos_url":"https://api.github.com/users/andrewjohnson90/repos","events_url":"https://api.github.com/users/andrewjohnson90/events{/privacy}","received_events_url":"https://api.github.com/users/andrewjohnson90/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/android10/Android-CleanArchitecture/labels/discussion","name":"discussion","color":"5319e7"},{"url":"https://api.github.com/repos/android10/Android-CleanArchitecture/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-31T14:39:39Z","updated_at":"2016-04-01T08:59:53Z","closed_at":null,"body":"As stated in Clean Architecture, dependencies should point only inwards. This separates layers in a way that they could be interchangeable easily and also decoupled (right?). \r\nIn your case, you decided to create 3 layers which have this dependency relationship:\r\n\r\npresentation ---> domain ---> data\r\n\r\nYou use DI for some good reasons (still decoupling, dependency inversion ecc).\r\nHowever from your build.gradle files, it seems that data has a dependency on domain, while domain doesn't have anything. The dependency is in this way:\r\n\r\npresentation ---> domain <--- data\r\n\r\nCould you explain me why? Is there something I'm missing?"},"comment":{"url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/comments/204318155","html_url":"https://github.com/android10/Android-CleanArchitecture/issues/136#issuecomment-204318155","issue_url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/136","id":204318155,"user":{"login":"andrewjohnson90","id":10178419,"avatar_url":"https://avatars.githubusercontent.com/u/10178419?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewjohnson90","html_url":"https://github.com/andrewjohnson90","followers_url":"https://api.github.com/users/andrewjohnson90/followers","following_url":"https://api.github.com/users/andrewjohnson90/following{/other_user}","gists_url":"https://api.github.com/users/andrewjohnson90/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewjohnson90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewjohnson90/subscriptions","organizations_url":"https://api.github.com/users/andrewjohnson90/orgs","repos_url":"https://api.github.com/users/andrewjohnson90/repos","events_url":"https://api.github.com/users/andrewjohnson90/events{/privacy}","received_events_url":"https://api.github.com/users/andrewjohnson90/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T08:59:53Z","updated_at":"2016-04-01T08:59:53Z","body":"@android10 Maybe I'm confusing naming with your example? Being an implementation detail, shouldn't Data be the inner circle? I see logic in Data, not in Domain. You say: Domain contains business rules, Data contains Repository implementation logic, though Domain shouldn't know how data is retrieved and this should be the outer circle.\r\n\r\nI'm really sorry if I'm confusing stuff, but I want to understand this properly!"}}