ReactiveUI (RxUI) vs Reactive Extensions

后端 未结 1 798
误落风尘
误落风尘 2021-02-04 01:48

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

相关标签:
1条回答
  • 2021-02-04 02:14

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

    0 讨论(0)
提交回复
热议问题