Iced Tea Labs Share to be shared

Clean Architecture for Android

Clean Architecture for Android

What is Clean Architecture?

Clean Architecture is a software design philosophy that separates the software into many ring levels:

The Clean Architecture by Robert C. Martin (Uncle Bob)

Each of the circle represents different layers of your software and must follow 2 important rules:

What is the purpose of Clean Architecture?

Like many other architecture patterns, the main purpose of Clean Architecture is separating concerns. So that:

Adapts Clean Architecture to Android

The Clean Architecture can be applied to any type of software, based on the need, the number of circles can be varied as long as you still follow 2 important rules above.

The below figure showing my prefer layers for Android applications:

Android Clean Architecture

As you can see, we have 5 layers:

Demo application using Clean Architecture

All right, we have enough bland boring theory 😂 It’s time to show you the code!

Source: GIPHY

We’re gonna craft an application to show the public repositories on Github.

Below is the project structure that I will implement for the demo:

Project Structure

We’ll have 2 modules:

The relationship between 2 modules is visualized roughly as the diagram below:

I decided not to write every single class of the demo in this blog post (cause I’m lazy 😴).

So I’ll leave the link to Github repo with full implementation below and hope it can be descriptive enough for demo purpose 🤷‍♂️

trinhlbk1991/github-public-repos An Android app showing list of public Github repositories - a demo for Clean Architecture + MVVM in Android …


Some important points of Clean Architecture:

Pros of using Clean Architecture:

Cons of using Clean Architecture:

Any feedback or comments are welcome as usual.

Thanks for reading and happy coding! 👨‍💻

comments powered by Disqus