Thursday, December 13, 2007

Visual Studio 2008: New Features worth Mentioning

There are tons of new features in Visual Studio 2008. If you have been paying attention, you know it comes out this month. Of the many new features, I would put the following at the top:

  • Multi-Targeting Support
  • Javascript Debugging
  • Javascript Intelligence
  • Web Design and CSS Support
  • Performance Improvements
  • Access to .NET Framework Source Code

Multi-Targeting Support

As with many of the features, you can read about Multi-Targeting Support on Scott Guthrie's blog. In past releases, Visual Studio only supported the current version of the runtime while Visual Studio 2008 will support .NET 2.0, 3.0 and 3.5. You can open up an existing project .NET 2.0 without upgrading it while benefiting from many of the features in this updated IDE. And within a Solution you can even have one class library using .NET 3.5 for LINQ but still have a website running as a .NET 2.0 website. This aspect opens up many possibilities. Just be careful. You may be better off sticking to all .NET 2.0 or jumping completely to .NET 3.5. (Hint: A clean way to mix .NET 2.0 and .NET 3.5 is using WCF which is on-the-wire compatible across runtime versions so your .NET 2.0 website can use LINQ indirectly.)

Javascript Debugging

Perhaps the most sought after new features is Javascript Debugging. It was not until Visual Studio 2005 was out that AJAX really started to take off and it was too late to augment the IDE for rich Javascript support. It had some support, but nothing like you can do with Firebug. Now with the ASP.NET AJAX implementation fully integrated with .NET 3.5 the IDE will provide debugging capabilities that were not possible before. It really is amazing what it can do. Microsoft actually created an inference engine for dynamic scripting languages which works with Javascript and other languages which allows the debugging experience to provide contextually correct information. It comes in handy with debugging, but also with the next feature.

Javascript Intellisense

Using the inferencing engine, Visual Studio 2008 is capable of providing Javascript Intellisense. If you set a variable to an integer the Intellisense shows methods and properties related to a number, but if you change the value to a string the inferencing engine will cause the suggestions to switch to values that make sense for a string. If you are doing even just a little Javascript work, this additional feature should be invaluable. Along with this basic support, you can enhance it by embedding comments within your own Javascript libraries to provide Intellisense. All of the libraries provided by Microsoft will be updated with .NET 3.5 with inline comments for this purpose. It will go a long way towards making coding in Javascript feel as rich as C# or VB.

Web Design and CSS Support

Also when Visual Studio 2005 was released, support for CSS was not seen as a priority feature. Instead an emphasis was put on themes and skins in order to abstract away what may happen in the future. With CSS and XHTML firmly taking hold, Microsoft has added new Web Design and CSS Support to Visual Studio 2008. What is really powerful about the new features is CSS refactoring. You can introduce a CSS class to a page, defined at the page level, and later automatically move that rule to a stylesheet for use across many pages. I have wanted this capability for a long time now and I look forward to using it all the time.

Performance Improvements

The one feature that I feel trumps all others is performance. You may recall many times where you open up a simple web page and it takes several seconds, or even over a minute, to allow you to start editing the documents. Thanks to people like Rico Mariani, Cameron McColl and others, there are some very welcome Performance Improvements in Visual Studio 2008. In the case of the delay when opening files, they simply delayed the color coding and syntax checking for a moment just so the plain text can be displayed and edited quickly. Normally it takes just a fraction of a second to apply the coloring, but they discovered how it was doing extra busy work that was not necessary and then eliminated the busy work. I hope that they have poured over many performance bottlenecks throughout the IDE and resolved them. These improvements alone make it worth the upgrade. Still, I want them to back-port these improvements to Visual Studio 2005 in an SP2 update because there may be times I need to use the older IDE due to client requirements and will not want to go back to these painful delays.

Access to .NET Framework Source Code

An unexpected bonus announced recently is Access to .NET Framework Source Code. Basically all of the core libraries for things such as the GridView, TextBox and Hashtable will be available during debugging. As you step into a property or method in a framework class, Visual Studio will pull down the necessary source code from the Microsoft source and symbols servers and allow you to walk through the actual code. Now when you experience something you simply cannot explain, you can walk through all of the code and find out why. And if you feel it is not working as it should you can create a temporary workaround and submit feedback to Microsoft to hopefully get it fixed in a future release or hotfix. Perhaps what most developers will do is debug through the classes they always wanted to understand better and start writing code much more like the framework code. Seeing that unfold will be very interesting as I have seen a few different coding standards followed across a few of the more popular .NET projects on CodePlex and if seeing framework source code encourages a higher level of consistency I welcome it. My rule has always been, if it looks like I pasted if off MSDN, then it is valid code. Now I can make sure my code looks like the framework code. I am also one of those people who learn more from digging than just reading, so digging through the guts of the GridView will give me a better understanding of how a CompositeDataBoundControl actually works.