Code Monkey home page Code Monkey logo

qapital-assignment's Introduction

Qapital assignment

Time estimate

I estimated the task to take about 6 hours but in reality I think I spent more about 12 hours. Not fully sure though, I was quite bussy with other things too and was a bit on and off the assignment but I was definetly quite of my estimate.

Main thing that took longer for me was that I spent quite a bit of time on the date range pager, previously I've only had to deal with incremental pagers. I also had to tweak my Dagger setup regarding unit tests to be able to mock the database that I didn't anticipate was gonna take a bit of time.

Running the app

Running should be fairly straight forward for any Android developer. You just gotta make sure you got API 31 and Java 11 setup, pull down the project and hit the play button in Android Studio.

For running the unit tests just right click on com.qapital (test) and hit "Run 'Tests in 'com.qapital''

Architecture

I know you mentioned in the assignment that you wanted to see an MVP architecture but to save some time I decided to go for my favorite architecture, that said it doesn't mean I won't respect an already existing and well defined architecture if I would start at Qapital. The architecture of my choice is a combination of MVVM and MVI where the UI has ViewModels that observes the state of interactors and all state changes is delivered with partial states updating the interactors state object in a unidirectional way without side effects.

The app consists of three modules:

An app module where you find:

  • the UI
  • ViewModels
  • Interactors
  • Repositories

A data module where you find:

  • Network and Database services
  • Object mappers

A domain module where you find:

  • Domain model objects mapped from the network model objects.
  • Network and Database service interfaces that the data module implements.

Persistent storage

Regarding caching I decided to only cache the user object that I consider valid for 24h, otherwise refetch. The activity feed felt like something where the cache would become outdated very quickly so I decided to not cache that.

Unit testing

There is unit tests that you can find in the app module. It's using OkHttps MockWebServer that reads a copy of the API responses from the resources folder and like that you can unit test everything from ViewModels all the way down to the network services and this can run on a CI server without any need of an emulator or device.

Third party Dependencies

RxKotlin

All the communication between the different layers are using RxKotlin.

Retrofit

To talk to the REST API.

Dagger

For dependency injection.

This library goes hand in hand with data binding where you pretty much never have to make your own adapters again.

Apache Commons Lang

It contains a HashCodeBuilder that is very convenient to use when you wanna ensure unique ids for your adapters.

qapital-assignment's People

Contributors

tobbelindberg avatar

Watchers

 avatar

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.