Follow Us

We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message

Applications

Software

Microsoft Visual Studio 2012 review

Article comments

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

Visual Studio 2012 also supports new syntactic features for the C++11 standard. These include range-based iteration for loops, which lets you define an iterable - say, an integer array - and compose a for statement whose index is drawn from successive members of that iterable. Among other new features, C++11 also implements a standard thread class and supports atomic operations, which provide classes and template classes that give more expressive control over multithreaded access to objects.

In addition, Visual Studio 2012 supports C++ Accelerated Massive Parallelism (AMP), announced last year by Microsoft. C++ AMP is a programming model that exploits the data parallelism present in graphics processing units (GPUs) and provides data handling constructs, as well as math function libraries. Visual Studio 2012 not only recognizes the new constructs, but also includes a GPU debugger for working with C++ AMP applications.

Debugging C++ AMP applications is not the only graphics debugging feature in Visual Studio 2012. Perhaps one of the IDE's most interesting new capabilities is Pixel History. Used in debugging Direct3D applications, Pixel History lets you identify which piece of code is responsible for a specific pixel in your application's display and examine the events that affected the pixel over the application's lifetime. This is important if the rendered pixel is the result of a blending of two or more events that have modified it at different points in the past. You can step through the events and find the graphical primitive responsible for altering the pixel.

Visual Studio 2012 adds optimization features for ASP.Net development as well. This includes "minification," which reduces the footprint of an application's JavaScript libraries for deployment. During development and debugging, you want JavaScript code to be in its full-text, human-readable form. But when deployed, you want the JavaScript compressed (and possibly obfuscated) for performance and security. The minification process optimizes the JavaScript files for deployment.

While Visual Studio 2012 looks forward to Windows 8, it doesn't shrug off its ancestry. The IDE is particularly tolerant of projects built by its predecessors. Provided that a project doesn't explicitly employ a feature available only in Visual Studio 2012, that project file can be opened either in Visual Studio 2010 or Visual Studio 2012. The notable exceptions to this are F# and LightSwitch projects. Once you allow Visual Studio 2012 to upgrade such projects, they can no longer be opened in Visual Studio 2010. The reason given for these exceptions is the relative novelty of F# and LightSwitch. Microsoft deemed it unlikely that a large legacy codebase existed for either, so focused less effort on preserving backward compatibility with such projects.

In addition to all the new capabilities, some welcome features in the IDE have been updated. Code snippets have been improved with the inclusion of "surround with" snippets. Whereas ordinary code snippets are pieces of skeletal code for common constructs that you simply "pour" into a single location (like a glorified paste operation), "surround with" snippets let you define an enclosing construct -- such as an if statement and its accompanying body -- that surrounds a section of selected code.



Share:

More from Techworld

More relevant IT news

Comments

Send to a friend

Email this article to a friend or colleague:

PLEASE NOTE: Your name is used only to let the recipient know who sent the story, and in case of transmission error. Both your name and the recipient's name and address will not be used for any other purpose.


Techworld White Papers

Choose – and Choose Wisely – the Right MSP for Your SMB

End users need a technology partner that provides transparency, enables productivity, delivers...

Download Whitepaper

10 Effective Habits of Indispensable IT Departments

It’s no secret that responsibilities are growing while budgets continue to shrink. Download this...

Download Whitepaper

Gartner Magic Quadrant for Enterprise Information Archiving

Enterprise information archiving is contributing to organisational needs for e-discovery and...

Download Whitepaper

Advancing the state of virtualised backups

Dell Software’s vRanger is a veteran of the virtualisation specific backup market. It was the...

Download Whitepaper

Techworld UK - Technology - Business

Innovation, productivity, agility and profit

Watch this on demand webinar which explores IT innovation, managed print services and business agility.

Techworld Mobile Site

Access Techworld's content on the move

Get the latest news, product reviews and downloads on your mobile device with Techworld's mobile site.

Find out more...

From Wow to How : Making mobile and cloud work for you

On demand Biztech Briefing - Learn how to effectively deliver mobile work styles and cloud services together.

Watch now...

Site Map

* *