Android Actual Clean Architecture (AACA)
by Adrian Tache, 08.05.2024
TODO add TLDRs
Downsides
About this section
In my experience trying to implement this architecture, I have been faced with a lot of resistance, mainly because many people just want to write code as quickly as possible, without considering its maintainability or covering it with tests. As such, I wanted to put together a section on the most common complaints I've heard about this architecture and why you might want to ignore them anyway.
So much code!
People often complain that AACA leads to so many more lines of code than just a regular MVVM, and this is true. Having said that, we must always remember that building this extra scaffolding around your code (and thinking in this different way) brings a lot of benefits which simply don't happen if just throwing code all around your app and praying it remains maintainable. As it is often in life, you can't have something for nothing.
Another counter-argument to this is that, while you do write more code initially, the fact that further refactorings and additions to the code don't require you to rewrite significant parts of your code base is a huge advantage. Just think of the impact of the API changing as part of a normal app, and then consider this architecture. Similarly, consider how changes to your UI will impact your core business logic, and how much of it needs to be rewritten if it is just hanging out in your UI. And of course, don't forget that every time you touch a piece of code, you have a chance to break it!
Finally, a lot of this architecture can be written using templates, and I have built some Live Templates inside my IDE to quickly build mappers (I also use an extension to add all the variables of the data class there for fast autocomplete), use cases, and tests for them. I also have templates for the file structure of a data layer, for example, as well as the UI layer. Once you do this, it's much easier to write a lot of the boilerplate, and I welcome LLMs of the future to do a lot of this heavy lifting for us.