Microsoft's New .NET Rx Framework Tackles Challenges of Asynchronous Programming

Microsoft has quietly released the first key components of its .NET Reactive Framework (Rx), which allows developers to write LINQ (Language Integrated Query) expressions against events. Components of the Rx framework were included in the latest drop of the Silverlight Toolkit last month. A complete version is expected to be part of Visual Studio 2010 and will be supported by the .NET Framework 4.

The Rx Framework consists of a pair of interfaces (IObserver/IObservable), which represent "push-based" observable collections, along with a library of extension methods that implement Microsoft's LINQ Standard Query Operators and other stream transformation functions, according to Erik Meijer, the well-known language designer who runs the Data Programmability Languages Team at Microsoft. Meijer outlined .NET Rx Framework during a session at the recent O’Reilly Open Source Convention (OSCON) in San Jose, Calif. Observable collections capture the essence of the subject/observer design pattern, Meijer said, and are especially useful for dealing with event-based and asynchronous programming, such as you see in AJAX applications.

Meijer and software design engineer Wes Dyer have designed what Meijer describes as a major breakthrough in asynchronous programming. "Of all the work I’ve done in my career so far, this is the most exciting," Meijer told session attendees. "I know it’s a bold statement, but I really believe that the problem of asynchronous programming events has been solved."

A bold statement it may be, but veteran .NET developers agree that the Rx Framework is likely to change the way developers deal with asynchronous programming. "This is a completely new way of perceiving event handlers, delegates, and asynchronous programming," said Julie Lerman a .NET mentor and the author of the recently released book Programming Entity Framework (O’Reilly Media, Inc.) "I’m reacting like most programmers. We’re uttering a collective ‘Oh my god.’ They just peeled something open and showed us something new that has always been there."

Andrew Brust, chief of New technology at New York-based custom technology solutions provider twentysix New York sees the Rx Framework as a solution to the challenges inherent in asynchronous programming, which is the model employed in AJAX, Silverlight, Microsoft’s Azure, cloud-based services, and multi-core/multi-processor/multi-threaded programming. "It’s an important step in making the delicate parts of AJAX, rich Internet applications, and cloud computing less disruptive to line-of-business programmers," Brust said.

 "Asynchronous programming is really hard." Lerman said. "It’s hard for programmers to get their heads around it. Microsoft has been trying to find a way to make it more accessible to developers. In the same way that LINQ has made interacting with data objects easier, the Reactive Framework is going to make interacting with events easier. But not only that, it’s going to give us a new level of access to working with events."

Microsoft included components of the Rx Framework in the latest version of its Silverlight Toolkit. The biggest chunk is a new assembly called system.reactive.dll, located in the bin folder of the Silverlight Toolkit Unit Tests.

Jafar Husain, a software developer who works on the Presentation Platform Controls team at Microsoft has posted on his blog bits of sample code that can be downloaded and run inside Visual Studio 2008 via the Silverlight SDK.

"Just by thinking about events and asynchronous complications as collections, I know have this very powerful mechanism to glue these things together," Meijer said. "Really, I’ve just sort of rephrased stuff that people have been doing for a long time." He points to the UNIX shell as an example. "UNIX pipelines is also an observable collection," he says, "because each stage of the pipeline pushes the value to the next stage. The way you glue these things together is by wiring up these data flow networks." Another example: event-driven state machines in Windows Workflow, which is also a concrete type that implements the Observable interface.

The Dutch computer scientist has been involved in the development of a wide range of languages, including Haskell, Mondrian, X#, Cω, C#, and even Visual Basic. His work these days aims to remove the impedance mismatch between databases and programming languages in a cloud context. That work led him to develop LINQ, a ground-breaking .NET Framework component that adds native data querying capabilities to .NET languages (C#, VB, etc.).

The most important thing for developers need to know about Meijer’s latest creation is that the .NET Reactive Framework is likely to require some time to understand, Lerman said.

"Be patient while you wrap your head around this thing," she said. "Once it clicks, it will make perfect sense, and it will change the way you think about event handlers and delegates."

About the Author

John K. Waters is the editor in chief of a number of sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at [email protected].

comments powered by Disqus


  • VS Code Java Team Details 5 Best Dev Practices

    Microsoft's Visual Studio Code team for Java development added a new Coding Pack for Java installer and detailed best practices for setting up a development environment.

  • Binary Classification Using PyTorch: Defining a Network

    Dr. James McCaffrey of Microsoft Research tackles how to define a network in the second of a series of four articles that present a complete end-to-end production-quality example of binary classification using a PyTorch neural network, including a full Python code sample and data files.

  • Blazor Debugging Boosted in .NET 5 RC 2

    In highlighting updates to ASP.NET Core in the just-launched second and final Release Candidate of .NET 5, Microsoft pointed out better debugging for Blazor, the red-hot project that allows for C# coding of web projects.

  • Block Stack

    Final Go-Live .NET 5 Release Candidate Ships Ahead of Nov. 10 Debut

    Having been deemed "feature complete" and "near final" and "go live" for some time now, .NET 5 is out in a second and final Release Candidate, scheduled for a Nov. 10 debut during .NET Conf 2020.

  • Edge Browser Dev Tools for VS Code Now Generally Available

    Microsoft has moved its Edge browser development tools for Visual Studio Code from preview to general availability, providing in-editor web site debugging and other functionality.

Upcoming Events