Coder Social home page Coder Social logo

coding-task's Introduction

Coding Assignment

An android app built using Kotlin that consumes the given api and display the information. It has been built following Clean Architecture Principle, Repository Pattern, MVVM Architecture in the presentation layer as well as Jetpack components(including Jetpack Compose).

Table Of Content.

Prerequisite.

In order to be able to build the application you'll need Android Studio Minimum version Android Studio Chipmunk

Disclaimer.

  • Clean architecture is an overkill for such a small app, just wanted to demonstrate and revise the current architecture patterns

Layers.

1. Domain.

This is the core layer of the application. The domain layer is independent of any other layers thus ] domain models and business logic can be independent from other layers.This means that changes in other layers will have no effect on domain layer eg.

Components of domain layer include:

  • Models: Defines the core structure of the data that will be used within the application.

  • Repositories: Interfaces used by the use cases. Implemented in the data layer.

  • __Use cases: They enclose a single action, like getting data from a database or posting to a service. They use the repositories to resolve the action they are supposed to do. They usually override the operator “invoke”, so they can be called as a function.

2. Data.

The data layer is responsibile for selecting the proper data source for the domain layer. It contains the implementations of the repositories declared in the domain layer.

Components of data layer include:

  • models

    -dto models: Defines POJO of network responses.

    -entity models: Defines the schema of SQLite database.

  • repository: Responsible for exposing data to the domain layer.

  • mappers: They perform data transformation between domain, dto and entity models.

  • remote: This is responsible for performing network operations eg. defining API endpoints using Retrofit.

  • local: This is responsible for performing caching operations using Room.

3. Presentation.

The presentation layer contains components involved in showing information to the user. The main part of this layer are the views(activity) and viewmodels.

Tech Stack.

This project uses some of the popular libraries, plugins and tools of the android ecosystem.

DEPENDENCIES

Used kotlin dsl to easily manage and update the dependencies

Libraries.

  • Hilt - Dependency Injection library.

  • Jetpack

    • Android KTX - Provide concise, idiomatic Kotlin to Jetpack and Android platform APIs.

    • Jetpack Compose - Jetpack Compose is Android’s modern toolkit for building native UI. It simplifies and accelerates UI development on Android.

    • AndroidX - Major improvement to the original Android Support Library, which is no longer maintained.

    • Lifecycle - Perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.

    • ViewModel - Designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.

    • Compose Navigation -Component that allows easier implementation of navigation from composables.

  • Retrofit - Type-safe http client and supports coroutines out of the box.

  • OkHttp-Logging-Interceptor - Logs HTTP request and response data.

  • Coroutines - Library Support for coroutines.

  • Flow - Flows are built on top of coroutines and can provide multiple values. A flow is conceptually a stream of data that can be computed asynchronously.

  • Square/Logcat -Library for easier logging.

  • Material Design - Build awesome beautiful UIs.

  • kotlinx.coroutines - Library Support for coroutines,provides runBlocking coroutine builder used in tests.

  • Compose-Accompanist -Accompanist is a group of libraries that aim to supplement Jetpack Compose with features that are commonly required by developers but not yet available.

Testing

The tests are mainly unit tests covering the Network layer and Domain layer and also viewmodel tests for the characters module,main Libraries used for testing include:

  • Junit - JUnit is a simple framework to write repeatable tests
  • Hamcrest - Matchers that can be combined to create flexible expressions of intent
  • Coroutines Testing - Test utilities for kotlinx.coroutines.
  • CashApp Turbine - A small testing library for kotlinx.coroutines Flow

References

In this section i've included some resources ie. articles and GitHub repositories that are helpful when learning about clean architecture:

  1. The clean code blog by Robert C. Martin.
  2. A detailed guide on developing android apps using clean architecture pattern Medium article.
  3. Clean Architecture Component Boilerplater GitHub repo .
  4. Clean architecture sample Video by Philip Lackner
  5. Foodies Github Repo by Linus Moose to show how to build UIs with Compose
  6. Pokedex by Ronnie Otieno demonstrating how to properly use Jetpack Components

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.