GithubHelp home page GithubHelp logo

flickr-image-gallery's Introduction

Flickr Image Gallery

The puropse of this repo is to experiment with MVI and Coroutines in a clean architecture. As a consequence it is a bit verbose.

MVI with Mobius

The app runs on a very basic implementation of the MVI pattern based on Spotify's Mobius (there are some very similar frameworks, like Badoo's, Spotify's, RxRedux, etc.).

The implementation can be found in the usecase module.

The view is effectively decoupled from Mobius or any framework: all the view cares about are Models (that receives and renders on screen) and Events (that emits when the user interacts). Model, Event, Effect are super simple immutable data classes.

The view is completely stateless.

As a consequence Espresso tests are very simple and effective.

Remarks

Compared to Badoo's MVICore it seems that is a bit less easy to implement features like navigation and transient messages. This is because the view listens to events of only one type, while MVICore has a second event type, News, that is used to model one-off occurrences.

The state

Models, Events, Effects are processed by pure functions.

The state is stored in the Controller, retained in a ViewModel, the Controller re-emits the latest Model when connects.

Long running operations happen in the UseCase (specifically in the RepositoryUseCase).

The Activity connects and disconnects in onResume and onPause, and so does not leak the connection.

Architecture

A simple clean architecture (see dependency graph) of Gradle modules connected via Dagger.

Coroutines

Coroutines and Kotlin instead of RxJava (see RepositoryUseCase).

Libraries

Mobius, Dagger and:

  • Simple Xml
  • AndroidX
  • LeakCanary
  • Retrofit
  • Architecture Components:
    • Room
    • ViewModel
  • For testing
    • Mockk
    • JUnit 5
    • AssertJ
    • Espresso

Tests

  • android-ui (Espresso tests)
  • repository (JUnit 5 tests)
  • network (no unit tests, only configuration of Retrofit)
  • usecases (JUnit 5 tests)
  • entities (no tests, only interfaces here...)

flickr-image-gallery's People

Contributors

pietmau avatar

Watchers

James Cloos avatar  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.