Killer benefit of Reactive Extensions?
What is the killer benefit of Reactive Extensions (for either .NET or JavaScript)? Why should a developer learn and use th开发者_如何转开发em?
Reactive Extensions gives developers a way to compose complex event processing and asynchronous computation across Observable collections using a much more functional and declarative syntax.
A fairly simple example can be found at:
Mike Chaliy: Reactive Extensions AI: Domain Events Example
The clincher for me, even on a simple example, is this:
...notify manager about all noticeable transfers.
Account.TransferMoney
.Where(_ => _.Amount > 100.0m)
.Subscribe(_ => SendMessageToManager());
As you can see, subscribing using Rx clearly defines our intent in a clear and concise manor. You can imagine chaining together complex logic (much like a complex LINQ query) to make some very interesting functionality.
You might also want to take a look at:
Reactive Framework (Rx) Wiki: (not yet) 101 Rx Samples
精彩评论