Replies: 6 comments 25 replies
-
Disclaimer: I'm not affiliated with Google in any way. Thanks for raising your concerns (that I personally share as well), but I don't think Google ever said they were following "the clean architecture". Not on their official documentation, not on this project either. |
Beta Was this translation helpful? Give feedback.
-
Thanks for raising this. Let me try to provide some clarity. I'm an engineer on the Android DevRel team at Google and I'm the Tech Lead on this project. Why doesn't Now in Android use "Clean Architecture?" As @SimonMarquis said, Now in Android is intended to be a real-world implementation of the official Architecture guidance (as well as many other best practices for testing, UI design etc). As you have pointed out, the official guidance is different from "Clean Architecture" in two fundamental ways. In the official guidance:
Why doesn't Google just recommend "Clean Architecture"? Many apps aren't complex enough to justify having a domain layer. This is why in the official guidance the domain layer is optional. You can build your app with the UI layer dependent on the data layer, then introduce the domain layer later if the need arises. Ultimately we feel that the official guidance offers the best approach for most Android apps. It's worth saying that the official guidance is just that: guidance. It's not intended to be a one-size fits all. Developers should question whether the ui->(optional domain)->data approach is right for their app's requirements. What are the benefits of the official Android guidance over Clean Architecture?
What are the benefits of Clean Architecture over the official Android guidance?
Hopefully that answers some of your questions. One question in return (to @Yazon2006): you mentioned that Now in Android is breaking SOLID principles - where? I'm not saying it's perfect but I don't see any glaring violations of SOLID. Happy to discuss further. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I decided to see how easy it is in reality to refactor to clean architecture. Summary: around 1 hour's work. #1277 |
Beta Was this translation helpful? Give feedback.
-
This is a good talking. clean architecture's diagram is circle, however android architecture's diagram is layered. some more are different. So I want to say that if angular and android code architecture can be the same, it will be amazing. |
Beta Was this translation helpful? Give feedback.
-
Is there an existing issue for this?
Is there a StackOverflow question about this issue?
What happened?
Somebody sent me your project as a best example of Clean Architecture and the only one right reference from Google for those who study programming (meaning that this is the only one unbreakable existing source of truth of architecture).
I open the dependencies and see that domain layer depends on data. Which has no sense if your definition of the domain is the same as canonical definition of pure business logic layer.
It would be nice to add a disclaimer that the domain layer from this project has nothing in common with Clean Architecture's domain except the title. Or you may use other title for your layer because the domain logic can not depends on the data source implementation. E.g. "logic" layer, but not domain. It's very confusing because you substitute widely known definition of the domain layer with your own one and it gives wrong direction for those who can't argue against the huge Google authority.
On other hand you may slightly refactor the project by changing the way of dependencies so the data layer will depends on domain layer. In this case you'd need to define repository interfaces inside of the domain module and create their implementation inside of the data layer. It will cost almost nothing in terms of implementation efforts but will bring much more clarity for those who try to google question like "data layer depends on domain".
People already started asking questions.
In my opinion it's a major architectural issue because the data layer implementation should depends on abstract domain logic (including abstract repository interface) but not vice versa. Without doubts it's up to you keep everything as is but in this case I'd kindly ask you to add disclaimer directly to this project readme file with some clarifications and explanations.
Looking forward for your thoughts. Thanks in advance.
Relevant logcat output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions