Google I/O 2017 Day 1 Discussion Megathread

I am aware of MVVM, and viewmodels in general.

LiveData<> is just a shitty, less capable subject.

observe(LifecycleOwner owner, Observer<T> observer)

Adds the given observer to the observers list within the lifespan of the given owner.

That method is so awful.

If you want to see MVVM functional style done well check out kickstarter OSS.

https://github.com/kickstarter/android-oss

And no, your data layer should NOT know who is observing some field. That's part the whole point of this abstracted data layer or repository.

If no one listens, that's cool. If some value changes, the typical approach is to push that out through a Subject or RxRelay.

If you have this ViewModel and nice asynchronous programming models, and actions you should never HAVE to deal with lifecycles because it doesn't matter. If you update the ViewModel in some presenter because of some user interaction and no one is listening, it doesn't matter.

Another good example of this MVVM-ish view model, functional observable data architecture.

https://speakerdeck.com/jakewharton/the-state-of-managing-state-with-rxjava-devoxx-us-2017

/r/androiddev Thread Parent