Managing State with RxJava (Preface)

Config Change Edition

There I was, playing with the Model-View-Intent architecture for some time now. André Medeiros explains it nicely in his What if the user was a function? talk. TL;DW: Everything is a function of the previous function.

View(Model(Intent()))

The first person I know that explicitly talked about porting it to Android is Hannes Dorfman with its Model-View-Intent on Android blog post series. I found them rather easy to understand but something bugged me deep inside. The part supposed to deal with config change has just been delegated to Hannes’ library: Mosby. Like, that was the part I was anticipating the most. The part I could be talking for minutes with fellows. Well done! […] I checked the source but did not clearly understand how it was actually managing life cycles and got overwhelmed by all the abstractions the library was creating.

Then, Devoxx US happened and some guy called Jake Wharton presented a talk entitled: The State of Managing State with RxJava. Jake took the MVI architecture to an other level. He went further and suggested a more Android adapted pattern, really easy to understand and testable.

UiModel(Result(Action(UiEvent())))

He also displayed some mad RxJava tricks. Check this out:

Crazy stuff

One thing he did not talk about is, tambourine playing…, config change. To say the whole truth, I messaged Jake and say something like: you said this, but I thought that; what do you think? Nothing close to an answer yet.

So I tried to implement it myself. After watching Jake’s talk, I had a brief idea about how to and now, I think I found something comfortable to reason about. I therefor decided to share it. Maybe someone could help me find any flaws or bring on some new ideas.

one has to smile at the thought of describing Internet hackers as “egoless”.

I also feel this context mise en place was not of any value for anyone but me so I’ll stop right here and write a new post very soon to deal only with the meat. See: https://medium.com/@oldergod/managing-state-with-rxjava-b0798a6c5757