English 中文(简体)
Has RX Extensions "solved" the problem of complex event driven programming?
原标题:

I ve been using Rx on a new financial analysis project that receives all data asynchronously. I ve been pretty amazed at my personal productivity and how much more understandable my event based code is (as opposed to the previous model of event handlers with complex nested ifs and random state variables everywhere.). Has anyone else got a chance to play with it, and if so what are some of your thoughts?

最佳回答

I believe the Reactive Extensions dramatically simplify some portions of complex, event driven programming, but the problem as a whole is not "solved".

It does handle many situations is a much cleaner, more elegant manner than previously possible. However, it does not (necessarily) always help on the generation side of some asynchronous patterns, where event driven programming is still difficult. Rx really is focused on handling the subscription side of the event, but not necessarily the producing side of the equation.

For some distinct samples, and an idea of what is being considered for future versions of C# to handle some of the more complex asynchronous models, I d recommend watching Luca Bolognese s PDC Talk. He presented some ideas the language team is working on to help on the authoring side of asynchronous development, such as an "iterator" like syntax to produce an IAsync<T> directly, with language features to support the generation of the events.

问题回答

In http://channel9.msdn.com/posts/DC2010T0100-Keynote-Rx-curing-your-asynchronous-programming-blues, Bart de Smet excellently explains how handling event streams as a first-class concept raises the level of abstraction by making you think about how you implement eg. Throttle or DistinctUntilChanged every time imperatively with lots of error-prone boilerplate code. These operators encapsulate these behaviors in a reusable and composable way. So my opinion is that there is certainly room for further evolution (see e.g. the concerns about cold observables), but these tools should be in every developer s toolbox. The usual control flow constructs may cut it for single-threaded execution, but in today s highly concurrent, distributed world, I think Observable (or even better, EventStream/Property) is a proper abstraction.

No. The problem of complex event driven programming stems from the fact that any complex event driven computation is represented with a dynamic cyclic graph. That graph cannot be represented conveniently using linear programming text. The only way out is to have multiple tools to convert textual program representation to visual graphic form and back, and to check program correctness dynamically and statically.

I ve just seen a webcast on RX extensions, not played with it, and found the explication too complicated... I thought the creators were architect astronauts.

For now I just don t see where is the problem with classic event handler... I have always found elegant solution when I had to use asynchronous communication between a client and a service.

However I m curious with experiences from other people with this framework, depending on answers of this thread, I ll give it another try.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签