Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactiveUI vs. MvvmCross

Title says it all. Based on your experience, what's the key difference between both frameworks?. When we should use one over the other?.

Intended use: cross-platform development (Windows 8, iOS, Android, WindowsRT, Mac).

like image 600
ElSayed ElAshmawy Avatar asked Jul 10 '13 09:07

ElSayed ElAshmawy


2 Answers

I use both MvvmCross and ReactiveUI, in the same cross-platform solution, for iOS, Android, and Windows.

I would say my solution is based on MvvmCross because the App class, how the app starts up, and ViewModel navigation are following MvvmCross' way. But I also use several of ReactiveUI's key features:

  1. ReactiveCommand

I really like its auto disabling feature (CanExecute, IsExecuting) when it's bound to a button.

  1. ReactiveList and it's derived list

This is a class that I would like to recommend to anyone programming MVVM, it has solved almost all my pain points in ObservalbeCollection. The usage of CreateDerivedCollection itself alone can be the whole reason that I include ReactiveUI in my project.

  1. MessageBus

I'm afraid that I was spoiled by its auto marshaling to UI main thread. I don't need to worry if I'm in a task pool or UI thread, I just call SendMessage. (This is very different from MvvmLight's implementation and it's the main reason I left MvvmLight 2 years ago, sorry)

When I use the features above, I don't care if they're reactive or not, I just use them because they fit my needs very well. (In fact, ReactiveCommand, ReactiveList, and MessageBus are all reactive)

Can I use ReactiveUI only? I also asked the question to myself. I guess I will miss something from MvvmCross:

  1. MvvmCross Plugins.

I use several plugins from MvvmCross and I really want each plugin is compatible with both MvvmCross and ReactiveUI. ( Maybe they already are, I just didn't check because I'm already using MvvmCross to handle the plugins.)

  1. MvvmCross's tutorials

There are a lot of tutorial on MvvmCross and Youtube videos. I just can't image how much effort is put on those kinds of things.

I learn Xamarin by MvvmCross, to be honest.

  1. MvvmCross's integration with Xamarin

Sometimes I can't tell if a class is provided by MvvmCross or Xamarin if not for the Mvx prefix. I checked my project, almost all the base classes of my UI code are MvxSomething (I don't use Xamarin.Forms). I don't know what exactly are provided by the Mvx version of the base classes, I just use them and they work.

I'm still learning both of the 2 frameworks, but I wish they can be merged one day.

like image 138
Felix Avatar answered Nov 14 '22 04:11

Felix


But this isn't exclusive - ReactiveUI can be used with not-reactive code

Even further, you can use ReactiveUI alongside other MVVM frameworks, you don't need to commit to one or the other. Many methods in RxUI such as WhenAny work on any object and determine at runtime how to best connect to them.

RxUI is definitely a Buffet Table (take what you want!), not a seven-course meal :) MvvmCross is certainly a great choice to base your app on, and it'd be awesome to have a team try out how they work together in the same app. Report back!

like image 23
Ana Betts Avatar answered Nov 14 '22 04:11

Ana Betts