ReactiveUI (RxUI) vs Reactive Extensions

我怕爱的太早我们不能终老 提交于 2019-12-03 08:52:01

问题


From http://docs.reactiveui.net/en/index.html :

ReactiveUI is a MVVM framework that allows you to use the Reactive Extensions for .NET to create elegant, testable User Interfaces that run on any mobile or desktop platform.

Is RxUI somehow differs from Reactive Extensions?

Why should I prefer RxUI over MVVMCross/light+Rx? What so special? Can RxUI do something that Rx can't? Is it more concise? Is it more cozy?

I saw example on github page https://github.com/reactiveui/ReactiveUI#a-compelling-example. But can't I do the same with just Rx?

P.S. Is there API doc somewhere?


回答1:


You have included here lots of questions, so I'll answer them one by one.

Is RxUI somehow differs from Reactive Extensions?

Yes. Reactive Extensions is "a library for composing asynchronous and event-based programs by using observable sequences and LINQ-style query operators." It has nothing to do with UI specifically. Rx provides you a general abstraction over a stream of data.

RxUI is an MVVM framework, which means it is a library of classes helping you implement MVVM pattern in your app.

Can RxUI do something that Rx can't? Is it more concise? Is it more cozy?

It serves a different purpose. Rx provides a set of methods, which are generally helping you move the data in your app around. RxUI is used to create User Interfaces. It uses Rx under the hood, and also exposes Rx-type API (namely, IObservble<T>) from it's components.

For example, an ICommand implementation in ReactiveUI, called ReactiveCommand, exposes a property called ThrownException, which is of type IObservable<Exception> (you can read it as "a sequence of errors").

Note that while the IObservable<T> interface type is part of the .Net Base Class Library, literally all the useful functions operating with this type are included in the Reactive Extensions library.

But can't I do the same with just Rx?

No, because - for instance - Rx does not provide you with an ICommand implementation, a vital part of every MVVM framework.

Why should I prefer RxUI over MVVMCross/light+Rx? What so special?

If you want to use Reactive Extensions a lot in your app, you might prefer to use RxUI (rather than other MVVM framework) because they integrate really well with each other. Combined, they provide you with a lot of functionality out of the box (check out, for example, ReactiveCommand or WhenAny.

That being said, as the creator of RxUI stated it:

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 :)

And, finally:

P.S. Is there API doc somewhere?

Yes there is! Take a look here: https://reactiveui.net/api/

As a side note, feel free to browse Reactive Programming section of the docs, which will explain you some of the basic terminology and concepts standing behind the framework :)



来源:https://stackoverflow.com/questions/34727584/reactiveui-rxui-vs-reactive-extensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!