Android-Comonadic-UI icon indicating copy to clipboard operation
Android-Comonadic-UI copied to clipboard

Refactoring app into basic MVP with a Store

Open Cotel opened this issue 6 years ago • 2 comments

In this branch we are trying to move away from the Android framework with a basic MVP approach #2 . We want to abstract the comonadic datatypes too so we can write them with plain Kotlin.

We will only call the View inside the render method of the Store which will be storing the Presenter state. This way we concentrate all the "effects" inside a method which could be potentially extracted (?). The downside is that operating with lists can be quite heavy as we need to calculate the diff and tell the view what to do. Luckily, Kotlin has good collection operators.

This is a work in progress so the next steps are:

  • Improving usecases to use Either and stuff.
  • Maybe extracting the val viewComponent : Store from the Presenter and transform it into Moore to be more like Redux. Presenter would only dispatch events and render any result coming from the datatype. This way the presenter becomes even more pure. I need to implement this to see If we like that approach.

Cotel avatar Oct 15 '18 18:10 Cotel

I will review it before creating my PR to not be influenced by this.

tonilopezmr avatar Oct 16 '18 16:10 tonilopezmr

Seems legit. I'll try to not make big changes until then so we know how to move forward with this branch 👍 .

Cotel avatar Oct 16 '18 17:10 Cotel