As I mentioned at the beginning of the review, I simply cannot cover Visual Studio .NET 2003 in its entirety. To do so would require a book. In fact, I’m sure there are many books that do just that. Instead, I’m going to focus on what’s new in Visual Studio .NET 2003 over Visual Studio .NET 2002. Before that, however, I feel it would be beneficial to give a brief overview of the general feel of Visual Studio .NET 2003’s integrated development environment (IDE.)
The term IDE is thrown around quite a bit, but for the most part, it’s usually a misnomer. Visual Studio .NET, however, really and truly is an integrated development environment. You can develop multiple languages (VB.NET, C#, C++, J#, SQL, HTML, etc.), and even have multiple languages within a single application. You can develop both web (ASP.NET WebForms) and desktop (WinForms) solutions. You can develop XML Web Services. You can develop for embedded devices like Pocket PCs. You can develop for mobile phones. You can develop for… well, you get the point. The list goes on and on.
Drag and Drop Development
The IDE itself is centered on the idea that your development environment should bring everything to you, and let you join these separate pieces into a coherent application. For instance, you have the Server Explorer “slide” bar pictured below that lets you drag and drop resources from multiple servers (including localhost, of course) in to your application and then manipulate them programmatically.
Once you’ve dragged something from the Server Explorer (or any other place for that matter) onto your form, Visual Studio .NET automatically generates some code that allows you to access that object programmatically. For instance, the above screen shot shows that I had just dragged the security event log from the server “nails” on to my WinForm. This actually added four lines of code to my form’s CS source file. These lines are pointed out in the figure below.
Granted, those four lines are pretty simple code, but the more complicated the object being dragged onto your design surface, the more lines of code that Visual Studio .NET automatically generates for you. As you being to create projects that utilize resources from many different locations, both physically and logically, you’ll start to appreciate the work that Visual Studio .NET does for you. Whether it’s dragging a button onto a form, or creating a strongly typed dataset from a schema file, Visual Studio .NET saves you an enormous amount of time by doing the most highly repetitive and mundane coding tasks for you, and letting you instead concentrate on the business logical and architecture of your application.
In addition, most objects that can be dragged onto a design surface (or, rather, “components”, since those are the only kinds of objects that support drag/drop onto a design surface) also let you manipulate many of their properties from the IDE. For instance, the event log I dragged onto my form has several properties that I can view and modify via the properties tab in Visual Studio .NET.
Traditional Visual Basic developers will be very familiar with this kind of development, although VB only allowed you to set properties like this on UI objects, such as buttons, forms, textboxes, and other ActiveX controls. In Visual Studio .NET, anything that either implements the IComponent interface, or inherits from Component, has the ability to expose properties inside Visual Studio .NET.
This means any developer, even you, could create an object that can be dragged onto a Visual Studio .NET design surface and visually manipulated. In fact, it goes much further than that. It’s almost trivial to tap into Visual Studio .NET’s designer capabilities, letting you create objects that display wizards and dialog boxes that let developers manipulate your component in an infinite number of ways. This is a truly powerful capability, and one that I’ve never seen duplicated in any other IDE. The closest anything has come to this is the ability to create ActiveX controls for VB. Below is a screen shot of a custom control library that I’ve added to my Toolbox slider window, which I then dragged to my form.
While in this case it was a simple button control, I could have just as easily created “MyAwesomeBusinessComponent” that implemented IComponent, and dragged that onto my design surface.
Visual Studio .NET’s debugging is unparalleled in any competing IDE. In no other IDE can you seamlessly debug not only local applications, but applications that span multiple servers, multiple hosts (Windows, IIS, SQL Server, Internet Explorer, etc), and even multiple languages.
In a demo I once did for a college course, I demonstrated debugging by setting a break point in a SQL Server 2000 stored procedure on a server off campus. I then started the debugging process inside a C# WinForms application that called a VB.NET library. That VB.NET library then called an XML Web Service sitting on yet another remote server. This web service finally called the stored procedure on the SQL Server in which I set the break point. Visual Studio .NET happily let me step all the way across multiple languages, servers, and hosts, without so much as coughing. All the while I was able to mouse over variables, add watches, use the immediate window – everything you could do if you were just debugging a local application, even on SQL variables! People in the class actually clapped.
Below is a screen shot of me debugging from a C# WinForms application into a VB.NET library. The C# code is in the left tab group, while the VB.NET library’s code is in the right tab group. Notice the call stack window in the bottom right and how to notes what language the current call is in. Pretty neato.
Currently, you can’t just take any .NET language and expect Visual Studio .NET to be able to do all this. The language must have some additional supporting files that give hints to Visual Studio .NET on various topics so that it can do things like debug properly. As it is now, Visual Studio .NET supports C#, VB.NET, C++, and J#. There is nothing that prevents other language developers from adding Visual Studio .NET support to their .NET capable language, however, so I expect to see language packs coming out for the more eccentric .NET languages in the near future.
Intellisense, Regions, and XML Comments… Oh My!
Microsoft arguably has always made the best code editors available. Many accuse Microsoft of never innovating, but things like intellisense have done more to increase productivity for developers than I think any other single innovation in recent IDE history. Visual Studio .NET has VB/VC style intellisense, and much more.
For the Microsoft IDE uninitiated, intellisense is a technology that lets the IDE automatically complete what you’re typing, to automatically list methods and properties of an object, or to automatically list arguments for a method call. While typing, you can hit CTRL+space to bring up a list of matches to what you’ve typed so far. For instance, in the below image I typed “btn”, then hit CTRL+space.
In addition to helping you type in your code faster and more accurately, Visual Studio .NET lets you organize that code in a variety of ways. Two in particular, regions and collapsible methods, are extremely useful. Regions allow you define a start and end point, and the collapse all the code between the start and end point into a single line of text of your choice. For instance, the following two images show me defining a region called “My Awesome Code”, and then collapsing that region, thereby dramatically reducing the clutter in the code window.
Collapsible methods are identical in function (no pun intended), but are automatically created by the start and end points of a method.
Once you’ve written and organized your code, you’ll want to comment it. (Or, at least you should!) Commenting code has always been somewhat tedious, as there is often a great deal of copy/pasting and repetition, as well as the overwhelming feeling that nobody will ever be looking at these comments anyway. To alleviate some of this, Microsoft adding the ability to create XML comments directly within your code, and the C# compiler extracts these comments during compilation. You can create web pages with them automatically, or use style sheets to transform the XML into whatever format you want. Below is a screen shot of me documenting a method. Notice that there Visual Studio .NET provides intellisense for the XML comments.
XML comments are great, but they’re only available for C# programmers. This doesn’t particularly bother me, since I use C# almost exclusively, but if Microsoft is really attempting to bring VB developers into the category of 1st class developers, one would think they would have included something as incredibly useful as XML comments.
At any rate, none of this is new to
Visual Studio .NET 2003. So let’s get on to the new stuff, shall we?