Microsoft is fitting its Visual Basic and C# languages with an asynchronous programming model to help developers accommodate the growing complexity in applications.
With the release of its Visual Studio Async CTP (Community Technology Preview) this week, the company is providing an example of an asynchronous programming pattern, said S. Somasegar, senior vice president of the Microsoft Developer Division, in a blog post. Accessible for download at this website, Visual Studio Async CTP features a streamlined syntax for asynchronous development, extending Visual Studio 2010.
"Today, we are unveiling significant language and framework enhancements in C# and Visual Basic that enable developers to harness asynchrony, letting them retain the control flow from their synchronous code while developing responsive user interfaces and scalable web applications with greater ease," Somasegar said.
"Writing applications that effectively handle long latencies can be a daunting challenge. As software applications grow more complex, more developers are building software that accesses remote resources, performs longer computations, and processes large data sets," Somasegar said. "Tasks we used to think of as being quick now may take orders of magnitude longer to complete or may never complete. Without special care taken to manage conditions that may arise from these latencies, applications can become unresponsive or unable to scale.
"To accommodate these conditions, C# and VB are adopting a new asynchronous programming model," Somasegar said.
During a session at the Microsoft Professional Developers Conference, Anders Hejlsberg, Microsoft Technical Fellow, discussed the company's intentions to add asynchrony to the next versions of the two languages.
"[The] advantages of asynchrony are you get more responsive UIs because your UI can do other stuff while it is waiting for the results of an asynchronous operation," Hejlsberg said. "But also in servers, you get better scalability because you can free up threads when they're not doing any work because they're waiting for asynchronous requests."
While existing asynchronous paradigms offer ways to work with I/O and other high latency operations without blocking threads, current patterns can be difficult to understand and can complicate simple operations with callbacks and custom-exception handling. This can result in error-prone code, Somasegar said.
"With Async, our goal now is to make asynchronous programming far more approachable so asynchronous code is as easy to write and maintain as synchronous code. Making your code asynchronous should require only simple changes and should be possible to implement in a non-disruptive manner in your code," Somasegar said.
Language and framework enhancements from Microsoft will help developers harness asynchrony in C# and Visual Basic, Somasegar said.