Android-Comonadic-UI
Android-Comonadic-UI copied to clipboard
Refactoring app into basic MVP with a Store
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 intoMoore
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.
I will review it before creating my PR to not be influenced by this.
Seems legit. I'll try to not make big changes until then so we know how to move forward with this branch 👍 .