Giter Site home page Giter Site logo

feedbacktree's Introduction

FeedbackTree

The API is not stable yet as we are still experimenting with the concept.

FeedbackTree is a unidirectional data flow architecture for Android which relies heavily on state mahines to perform all types of side effects, like network calls, bluetooth, UI updates as well as navigation. It was highly inspired by RxFeedback.swift and by Square Workflows

Introduction

Most UI architectural patterns out there are screen-based meaning that the code is always organized around a particular screen or part of a screen. For instance, in MVVM (i.e. MVP) you have a View-Model (i.e. Presenter) driving a particular View telling how to update the different UI components as the state in the ViewModel (i.e. Presenter) is progressing.

As you hit more complex flows that span over multiple screens, organising the shared area gets harder. FeedbackTree allows you to confine business logic in what is called a Flow. Business logic or Flows drive what should be displayed to the user even if the Flow spans over multiple screens.

Let's elucidate how FeedbackTree is different by considering the example of a payment flow where the user should enter his card number on the first screen, his address on the second and once he taps the button Pay we show a progress dialog. In FeedbackTree, you create a PaymentFlow, and, depending on which state you are in, the flow renders the appropriate layout.

  • If you are in the state EnteringCreditCardNumber, render the EnterCreditNumberViewModel
  • If you are in the state EnteringAddress, render the EnterAddressViewModel
  • If you are in the state Paying, show a ProgressDialog

FeedbackTree:

  • Organizes the code around the business rules.
  • Logic can be easily unit tested
    • Most logic is placed in the reducer which is pure function.
    • Side effect are isolated and testing can be done with a TestScheduler.
  • Built-in navigation
  • Reactive UI

Installation

Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Add the dependency

dependencies {
  implementation 'com.github.eliekarouz:feedbacktree:0.8'
}

feedbacktree's People

Contributors

eliekarouz 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.