Visual Studio 2012 shines on Windows 8
- 31 October, 2012 16:05
Visual Studio is no longer simply an IDE, no longer a place you go just to write and debug C/C++ code. It has long since become something of a development mashup. It's where you go to tackle any task in the development process, regardless of the target. It's where you head to do your LightSwitch development, your SQL Server development, your Web application development, your Windows Azure development, and your ASP.Net or Windows Forms development in C#, F#, VB.Net, and -- oh, yes -- good old Visual C++. Naturally, it's where you build applications for http://www.infoworld.com/category/tags/microsoft-windows-azure and Windows RT.
That's not all. With the new Visual Studio 2012, you have to start wondering what you don't do in Visual Studio 2012. It's not the Master Control Program by a long shot ... but it's trying.
[ Learn how to work smarter, not harder with InfoWorld's roundup of all the tips and trends programmers need to know in the Developers' Survival Guide. Download the PDF today! | Stay abreast of key Microsoft technologies in our Technology: Microsoft newsletter. ]
As with earlier releases of Visual Studio, Visual Studio 2012 is available in several editions. The Express editions are, of course, free. Whereas some of the non-free editions target QA and Team Managers, the Express editions are intended specifically for developers:
Express for Windows Desktop. This version of Express caters to the more traditional developer, one employing the Windows Presentation Foundation (WPF), Windows Forms, or the tried-and-true Win32 libraries. This edition also supports the creation of Windows 8 Store applications.
The top of the Visual Studio 2012 line is the Ultimate edition, which is the version I tested. Ultimate installs enough gigabytes (about 10GB on my system) of development tools and libraries and documentation to occupy a person for a lifetime. You can target any of the platforms mentioned in the above list of Express editions, and you'll find support for all the .Net languages. Plus, Ultimate edition includes modeling, lifecycle management, testing, and development team management tools.
Next, there's the Premium Edition, meant primarily for agile development teams. It includes tools for task planning and development workflow. The Professional edition is meant for small development teams, and it includes tools for building applications on the Windows desktop, the Web, in the Azure cloud, and even Windows-supported mobile devices.
The Test Professional edition is obviously intended for QA team members. It incorporates tools for managing tests and test plans, executing tests, and analyzing test results.
It is not possible to cover all of the features of Visual Studio 2012. This article will concentrate on those new features developers are likely to be interested in. Even then, it will be a challenge to do the IDE justice. Details for all the editions -- their intended users, as well as a comparison of features provided as well as omitted -- can be found at Microsoft's Visual Studio website.
Building Windows Store apps
In such a broad panorama of editions, target platforms, and target applications, it is difficult to identify a sole, outstanding, key new component of Visual Studio 2012. However, it is safe to assert that -- given the proximity of the release of Visual Studio 2012 with the release of Windows 8 -- the new IDE's support of the new operating system is at the top of the list.
Windows 8 presents a new kind of application: the Windows Store application (sometimes just called a Windows 8 app). Originally referred to as a Metro Style application, a Windows Store app or Windows 8 app is a "whole screen" application that runs on Windows 8 or Windows RT. It is not composed of multiple, overlapping windows (which is a bit weird given that it's running on an OS called Windows). The user interface of a Windows 8 app is clearly optimized for finger or stylus input, but can employ mouse or keyboard. The display surface is partitioned into a grid of tessellated rectangular regions, and the fundamental onscreen object is a tile, rather than an icon. On the startup screen of Windows 8, of course, the applications themselves appear as tiles.
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++.
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.
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.
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.
Rafts and previews
While the ability to "dock" a specific window to a particular monitor has been available in earlier versions of the IDE, Visual Studio 2012 adds a new facility (and new nautical metaphor) called a "raft." A raft is a collection of multiple windows that can be treated as a single unit for the purpose of docking.
Another welcome usability feature is the preview tab, which opens a file in a new tabbed window whenever you select a file from the solution explorer (or if you happen to step into the file in the debugger). Previously, viewing a file's content required that you explicitly open it; now you simply select it to materialize a preview window. The preview is not an editor (its content is read-only), so you must take the extra step of actually opening the file to edit it. But the preview tab is a handy feature for large projects where you need to quickly search through source files.
Visual Studio 2012 has also improved the dependency graph feature. A dependency graph will show not only logical dependencies (such as a method's callers and callees), but also physical dependencies (what header files a specific C++ file required). Dependency graphs are useful for finding reference loops (a built-in analyzer helps locate such loops) and can identify code with no dependencies, which is probably a candidate for elimination.
In addition, the graphs are interactive. Click a node, and a pop-up materializes to display the details of the object highlighted: its category, the assembly it's in, its data type, and its namespace. Similarly, click an arc, and you're shown its category (reference or call) as well as the source and destination nodes. This latter feature is useful if you're exploring a large and complex dependency graph.
You can actually build dependency graphs incrementally, by creating a directed graph file and adding it to your project. Then, you simply drag objects (for example, source for class definitions) from either the solution explorer or the architecture explorer and drop them into the graph file's editor window. Visual Studio will parse the source code, index it, and incorporate it into the existing graph.
Working with Visual Studio 2012
When you install Visual Studio 2012, you're presented with numerous optional components. These include Blend for Visual Studio, MFC (Microsoft Foundation Classes) for C++, Office Developer Tools, SharePoint Developer Tools, Visual Studio LightSwitch, and Web Developer Tools.
In addition to tuning the environment to your particular sort of development (LightSwitch, SQL Server, Web development, or any of the .Net languages), you can also select the quantity of help documentation installed. A management console lets you pick which content will be recorded locally and which will be accessed from the Web. All help text is available online, and the IDE will access its online repository as needed, but fine-tuning the cached content can help if you know you're going to be working either offline or in an area with spotty connectivity.
Of course, building a Windows 8 app is not precisely like building a Web application. You have to learn the event model -- as well as the events themselves -- imposed on Windows 8 applications. Microsoft has defined events that unify the handling of touch, mouse, and pointer input, so you don't have to concern yourself with whether a finger or a mouse triggered an event.
Luckily, there are plenty of resources -- everything from style sheets to libraries of controls -- to draw on. Possibly the greatest hurdle that developers of Windows Store applications will face is simply wading through the mountains of choices to select from.
Big rock candy IDE
If you've used any of the previous versions of Visual Studio, you'll be right at home in Visual Studio 2012. You'll find plenty of documentation, guides, and tutorials online to help you navigate the new features. On the other hand, if you're new to Visual Studio, you'll quickly discover how vast it is. The only practical advice I can offer is to explore it one tributary at a time.
If you want a hint of just how big Visual Studio has become, consider its new Quick Launch capability. The idea behind Quick Launch: There's some operation in the IDE you want to perform, but you can't quite remember in which submenu or toolbar selection or pop-up window the control for that operation is hiding. Wouldn't it be nice if you could search the IDE, in the same way you, say, search for a variable's definition in your project's source?
That's exactly what Quick Launch lets you do. Enter a search string, and the IDE groups the results of your search. You can see matches in the most recent controls you've used, the documents you've opened, or menus or options you've selected. Click on one of the choices and -- hopefully -- you'll be taken to the spot in the IDE you're looking for.
As I warned at the beginning, Visual Studio 2012 is a big product. There's a whole lot more I didn't touch on: testing features, project lifecycle management, version control features, Visual Studio's integration with other Microsoft products, and so on.
If you want to do Windows development -- particularly Windows 8 and RT development -- then Visual Studio is really the only game in town. This is simultaneously a blessing and a curse. On the one hand, Visual Studio 2012 does an admirable job as the platform for building applications for a dizzying variety of targets. On the other hand, if you don't like it, you're pretty much stuck with it. Nevertheless, countless successful applications, small and large, were born, raised, and graduated from the Visual Studio IDE. And countless more are still to come.
Join the Computerworld Australia group on Linkedin. The group is open to IT Directors, IT Managers, Infrastructure Managers, Network Managers, Security Managers, Communications Managers.
- Cost of a Privacy Act breach could extend to ongoing audits: legal expert
- How Hunter Water is saving $50k a year in software licences
- NSW government invites registrations for ServiceFirst contract
- Audit agency does BYOD with BlackBerry
- Telstra breached privacy of over 15k customers: Privacy Commissioner
Cost of a Privacy Act breach could extend to ongoing audits: legal expert
If you haven't retired Windows XP and haven't been fired yet, get busy
Turnbull asks how the NBN got that way
Turnbull asks how the NBN got that way
Vodafone launches smartphone app for encrypted calls