Skip to content

agustiyann/Android-Clean-Architecture

Repository files navigation

Android Clean Architecture

agustiyann GitHub GitHub last commit

What is Clean Architecture?

Clean Architecture is a software engineering development architecture created by Uncle Bob (Robert C. Martin). The essence of this architecture is separation of concern. So that we can read the code in the project more easily.

In addition, the main idea of ​​using Clean Architecture is to produce a system that is Independent of Framework, Testable, Independent of UI, Independent of Database, and Independent of External. This is an overview to represent Clean Architecture suggested by Robert C. Martin:

Use this pattern in an Android project

In a typical android project it is divided into 3 layers like this:

  • Presentation Layer contains the UI and Presenter / ViewModel which will control the views. This UI will depend heavily on the Use Case.
  • Domain Layer contains Entities, Use Case, Repository Interface. This is the most core layer and is associated with business processes.
  • Data Layer contains Repository Implementation and DataSource which can be Local DataSource (database) and Remote DataSource (network).

Modularization

Modularization is a technique of breaking an Android project into sections called modules. With modularization we will get a lot of advantages over implementing the monolith (only one part) in our project.

Tech stack & Open-source libraries

  • Kotlin based, Coroutines + Flow for asynchronous.
  • Koin for dependency injection.
  • Jetpack Libraries
    • LiveData - notify domain layer data to views.
    • ViewModel - UI related data holder, lifecycle aware.
    • Room Persistence - construct a database using the abstract layer.
  • Architecture
    • MVVM Architecture (View - DataBinding - ViewModel - Model)
    • Repository pattern
  • Glide - loading images.
  • Retrofit2 & OkHttp3 - construct the REST APIs and paging network data.
  • Gson - JSON representation.
  • Timber - logging.
  • Material-Components - Material design components.
  • Leak Canary - memory leak detection library for Android.
  • Security
    • SQLCipher - protecting data.
    • ProGuard - disguise the code so that it is difficult to read by others after reverse engineering.
    • Certificate Pinning - secure connection from mobile to server.
  • Lottie - displays animation in JSON format.
  • Shimmer - create a shimmer effect on the application.

License

   Copyright 2020 Agus Tiyansyah Syam

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.