Review: Visual Studio 2012 shines on Windows 8

By Rick Grehan, InfoWorld |  Software, Visual Studio, visual studio 2012

You construct a Windows Store app using several language combinations, typically a language pair. A pair of languages is needed because the application code consists of both front-end and back-end components. The front-end (display) component is defined using a declarative language like XAML or HTML5; the back end (execution logic) executes in a procedural (or object-oriented) language such as C# or C++.

The specific combinations supported by Visual Studio 2012 are JavaScript and HTML, and C#, VB.Net, or C++ and XAML. If you want to build a game for Windows 8 and RT, you can add C++ with DirectX to the list.

Auto-magical multithreading

In concert with the arrival of Windows 8, .Net is being updated to version 4.5. Here, Visual Studio 2012 supports the new "async code" constructs in C# and VB.Net, which require new syntax elements in the languages and define new behaviors. Using the async and await keywords, you can identify potentially long-running methods -- that is, methods that may be blocked waiting for an I/O response -- but permit other parts of your code to continue executing, unimpeded by the blocked methods. Asynchronicity is key in Windows 8 apps. The Windows 8 application model is geared toward responsiveness, and many of the Windows 8 runtime APIs only support asynchronous operations.

When you define an async method, you're specifying that the method's results will be available at some unknown time in the future. The calling code can continue to execute, until it reaches a point where it must use the async method's return value. You identify this point with the await keyword. An async method returns a Task object, which encapsulates the rendezvous point (used by await) and provides access to the method's return value. In essence, the async and await keywords provide multithreading without your having to write callback functions, or thread startup and teardown code.

Not only does Visual Studio 2012 recognize the new async keywords, the IDE's debugger is also async-aware. You can debug an application as though the otherwise asynchronous code executed synchronously.

The .Net async feature is similar to JavaScript's "promise" (also called "deferred") objects. As in the case of .Net async, a promise object encapsulates the results of an operation that, if called synchronously, would block execution. JavaScript promises are not syntactic elements (unlike the .Net async feature), but abstractions of behavior. The jQuery and Dojo JavaScript libraries provide implementations of promises, as does the Windows JavaScript library, WinJS, which is used when you build Windows 8 Apps with JavaScript and HTML5.

Turning C++ to 11


Originally published on InfoWorld |  Click here to read the original story.
Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question
randomness