VS2010: The user interface
By Tim Anderson
Microsoft redesigns the user interface of Visual Studio 2010 using Windows Presentation Foundation.
HardCopy Issue: 52 | Found In: Visual Studio 2010 | Published: 19/05/2011 | Last Revision: 19/05/2011
Visual Studio 2010 has a completely new look compared to earlier editions, and there is a good reason for this as the product has been re-built using Windows Presentation Foundation (WPF). According to Principal Software Engineer Paul Harrington, who spoke on the subject at Microsoft’s Professional Developer’s Conference, there were three main reasons for this radical change. One was to “prove the capabilities of WPF 4.0”, a technology which has been around since late 2006 but is under-used by developers, both within and outside Microsoft. In the process, WPF itself was substantially improved, as the Visual Studio team worked with the WPF team to fix bugs and solve problems.
The second reason was to enable new features. Techniques such as zooming, graphical enhancements and visualisation fit naturally with WPF, and of course it is ideal for those working with WPF and Silverlight. The third reason was to improve the architecture of Visual Studio, separating the presentation from the business logic.
Although the user interface is new, under the covers Visual Studio has not been rewritten from scratch. Compatibility is crucial, so there is extensive interop code for integrating with native code and to continue support of COM extensibility interfaces.
Some of the designers are also the same. The Windows Forms designer, for example, is little changed from that in Visual Studio 2008. However the menus and command bars now use WPF, which is especially noticeable when you see the new and somewhat inferior customisation dialog.
Still, there are plenty of new features. Among the most welcome is the ability to float windows out of the main IDE. This is great if you have multiple screens: you might use one for a maximised editor window, for example, and a second to display the other tools you are using.
Another is the ability to search the toolbox. Click on the toolbox, start typing, and Visual Studio performs an incremental search on your expression, including items that are currently collapsed. If there are multiple matches, press tab to cycle through them.
Searching code is also improved. The new Navigate To dialog lets you search a solution and see results listed as you type. You can also use camel case abbreviations, so a search for MM would find MyMethod. Navigate To is on the Edit menu, or ‘Ctrl+,’ if you prefer keyboard shortcuts.
Zooming in the editor gives you flexibility to make the text very large, for example when showing code at a meeting or presentation, or to zoom out to see more code on the screen. Zoom can be controlled from the mouse or the keyboard.
The new Visual Studio Help Viewer has restored the tree view of contents, following an update in Service Pack 1.
Generate From Usage is a time-saving feature that also fits well with test-driven development. In essence, it lets you reference types, properties and methods that do not exist, and generates corresponding stub code for you. In C#, for example, you could type:
MyClass MyObj = new MyClass();
Presuming there is no such class, Visual Studio marks MyClass with a wiggly underline. Click on it, and a small blue block shows the presence of a smart tag. Click the block, and you get an option to generate the MyClass type.
A similar technique will generate properties and methods, with Visual Studio inferring argument types from your usage. Generated methods throw a NotImplementedException, which is well suited for test-driven development since it is good practice to design tests that fail initially, before implementing the correct code.
There are many changes to the Visual Studio debugger. For example, the breakpoints window now lets you search, label, import and export your breakpoints. There are new tools for debugging parallel applications, including a redesigned Threads window with search, grouping, filtering and new column types, and new tool windows where you can work with Parallel Stacks and Parallel Tasks.
Another neat feature relates to DataTips. Developers now take for granted that they can hover the mouse over a variable during a debug session, and get its value in a tooltip. However, the value disappears when you move the mouse, unless you add the variable to a watch window. In Visual Studio 2010 you can pin the DataTip so it stays on the screen throughout the session, and even add a comment.
Visual Studio is highly extensible, and can be used as a platform for Windows development tools. The new Extension Manager makes it easier to find and install extensions. The online gallery lists what is available, complete with user ratings, within a Visual Studio window, so there is no need to visit a Web site. You can download and install an extension in a few clicks. Many of them are free, or have both free and paid-for versions.
Finally, online help has been completely re-done. The new system is Web-based, with pages served either from a local embedded Web server or from MSDN online. The primary means of navigation is search, but in Service Pack 1 Microsoft restored tree view navigation following many user requests.