Clean Architecture on Android - a modern approach to medium to large-sized apps.
The talk was done by:
Manuel Sala de Borja Robles - https://www.linkedin.com/in/manuel-sala-de-borja-robles-50295130/
Lennart Bartelt - https://www.linkedin.com/in/lennart-bartelt/
Grigori Hlopkov - https://www.linkedin.com/in/grigorihlopkov/
Clean architecture has increased its popularity for Android in the last years. Three developers from Netlight built a sample app using Kotlin, Coroutines, Koin, Architecture Components, and Retrofit to showcase how a project is structured and how different parts of the codebase interact with each other.
These are some of the insights they want to share:
- What is it about?
- Why is it worth a look?
- How can we use it on an Android project?
- What benefits does it bring?
Link to sample app: https://github.com/netlight/android_cleanarchitecturesample
23. Dependency Inversion Principle
Uncle Bob’s definition:
1. High-level modules should not depend on
low-level modules. Both should depend
on abstractions.
2.Abstractions should not depend on
details. Details should depend on
abstractions.
24. Dependency Inversion Principle
In the end:
1. the high-level module depends on the
abstraction
2.the low-level depends on the same
abstraction
25. Keys for application of Dependency Inversion Principle?
• Inner layers define interfaces
• Outer layers implement interfaces
• Direction of coupling is towards the center
48. Layer - Presentation
• Displays data
• Bridges user interaction with business logic
• Contains frameworks (i.e. AndroidX, Coil, etc.)
• Unit testable
50. Layer - Presentation
Up to you to choose a pattern for presentation layer:
• MVVM (Model-View-ViewModel)
• MVP (Model-View-Presenter)
• MVC (Model-View-Controller)
• MVI (Model-View-Intent)
• etc.
54. Summary - Clean Architecture in a nutshell
• Separation
• Highly decoupled
• Testable
• Not complex
• Easy to maintain
55. How to start
• Read about the subject
• Build a sample project
• Try to think of use cases and how you can
isolate parts of your code
• Ask
56. Try it out
• List your use cases
• Start with domain layer (write use cases)
• Define interfaces between layers
• Use TDD (Test-Driven Development)
57. Here is the repo
https://github.com/netlight/android_cleanarchitecturesample