Applied Visual Studio 2005 Enhancements In WeFly247#

Introduction

As we're embarking on the journey that brings us to the next major version of the Microsoft .NET Framework, which is taking the productivity and power of the platform to an even more mature level, let's take a look at the enhancements that have been incorporated in this 2.0 release, and how they've been applied throughout the WeFly247 project that's part of the Beta Experience.

So starting from scratch, how do you go about creating a project in - and actually, in the case of WeFly247: for - a vastly improved development environment such as Visual Studio 2005? By taking a good look at all the various enhancements, absorbing the changes, and applying them throughout an entire project wherever deemed appropriate, the new environment will become part of your developer backpack and save you time and money.

Some of the new things in the 2005 release of the .NET Framework don't really belong to a certain type of platform like the web or a mobile device, or to a logical or physical tier in the solution's architecture, they span the entire project. They're language enhancements, IDE enhancements, patterns, ideas, models and methodologies.

One of them that truly stands out as a general design goal behind .NET 2.0 and Visual Studio 2005, as you probably heard everybody on any .NET team related say, is developer productivity. This basically means that you can do the same things you could do before, but easier and faster. In this case, much easier and faster. By removing the need to write loads of boilerplate code, you get to spend more time on your actual business problem, not on gluing up the machinery to get ASP.NET Forms Authentication to work against your own database, for example. In fact, increasing developer productivity has just been the evolution of any software development platform ever, since somebody decided to stop programming the machine by flipping hardware switches.

So one of the "invisible features" of WeFly247 is the missing code: it's safe to say that massive amounts of code have become redundant because they were now integrated into the framework. The other thing you can't see in the shipping bits is the total time spent programming it all. To get good metrics, I'd have to do it all over in Visual Studio 2003 and compare the two, but I'd actually rather rewrite Microsoft Word in assembler using notepad than go back to .NET 1.x and re-implement this entire project in six years time (I type slowly).

Apart from that, I'd like to highlight some others enhancements that I've applied throughout WeFly247, which regularly made my day... Most of these enhancements aren't even "just features" in their own mind; they've become extensibility platforms for you to build your own improvements on. It's not just that you get Code Snippets (also called Expansions), for example, you can very easily define your own snippets to have your often-used coding constructs available to you all the time.

Reducing Complexity

There are lots of new tools available in Visual Studio that will help you manage your complex environments, such as the way your classes work together, how your projects are deployed, how your logical datacenter looks, ... All these tools are made available as designers to help you model and understand your entire solution better.

Refactoring

It's finally safe to change that private variable name you were never happy with (no more textBox1), or to quickly extract some recurring code into its own proper method. Even better, when you just start changing the variable name in the IDE, a Smart Tag will appear to give you one-click access to the refactor menu. This is an invaluable time-saver that will continuously help you improve the quality of your code!

DataTips & Visualizers

If you were getting painful eyes from scrolling the Immediate window every time you put a DataSet.GetXml( in there to try and make sense out of the actual data, you'll love the fact that you can now get an inline view of the data behind a variable (through DataTips), or a custom visualizer window for an item in your Watch Window. This will just show you your XML string or DataSet in an Internet Explorer-like view or a DataGrid, respectively. And as I said, this is an extensible platform, so you can build your own visualizers by simply inheriting your custom visualizer class from a base class, in which you retrieve the object to visualize and show it in any way you feel is most appropriate. Registration of the visualizer is done by simply copying its assembly in a specific Visual Studio directory! No more looking at the buckets of that dreaded Hashtable!

Generics

I wish I had seen more opportunities to build some generic classes (or type parametrization) into WeFly247 but nevertheless, I'm very excited by all the possibilities offered by generics in the runtime. If only for the fact that it'll reduce the number of ArrayList instances in any code that needs to store a list of something, but their power goes way beyond the typical strongly-typed collections they enable.

Partial Classes

Finally, you're able to see the code you're writing all in one place, without being distracted by all the designer-generated code like in the InitializeComponent method. This new system works because the code is placed in what's called a Partial Class that lives in a second file. The compiler will then merge the two files into one runtime class definition.

IntelliSense

With IntelliSense now moving beyond the code window, into the formerly opaque realms of the script, CSS, HTML and XML editors (including the configuration file editor), you'll find yourself searching through the MSDN documentation much less because all the information you need is now at your fingertips. In fact, IntelliSense even pops up as soon as you start typing and helps you with language keywords, filters out types that can't be used in the current context (e.g. it only shows exceptions in a catch statement), and knows about Generic Types and Partial Classes.

Nullable Types

Nullable Types provide the option to store null values in simple value types (such as int, boolean, DateTime, ...). As with generics, the number of places in WeFly247 where it was actually useful to use value types that can hold the value null was fairly limited - but as soon as you know it's possible, it will hurt if you need a nullable type in a .NET 1.x project but can't use it...

Provider Model

The Provider Model is the pattern that abstracts away the implementation of a certain API into a configurable implementation. It's the pattern that allows ASP.NET Personalization to work with any backend store (like a SQL Express database or a custom Web Service backend) without touching the consumer code - but the pattern is much more widely applicable and gives a clean separation between a Provider of a service, and the actual code that runs to implement that service.

Smart Tags

When dragging controls onto a form or a web page, there are certain tasks that always come back which require you to perform some steps in the Properties Window. Now in Visual Studio 2005, a Smart Tag appears alongside the control, which allows you to perform these common tasks, such as docking the control or adding buttons to a toolstrip.

Even in code, there are certain tasks that can be automated, such as implementing an interface, refactoring common code into its own method, ... In the cases where Visual Studio recognizes one of these actions, a Smart Tag appears to quickly enable these commands. For example, if you start changing a method name, the Smart Tag will pop up with the option to refactor this method name across the entire project.

Etcetera

These various enhancements are only the tip of the iceberg, but as you get Visual Studio 2005 in your hands and start playing with it, you'll soon find your own favorite features that you'll never want to let go of. Just beware of the addictive power, as you'll probably have to go back to 1.x at some point, and believe me: it can be painful.

Therefore, one final tip: even if you're not using Visual Studio 2005 as your main development environment yet, you can still use some of its tools (such as refactoring) to modify the source files that you compile under 1.x too!

If you want to learn more about the upcoming release of the Microsoft .NET environment, check out "A Sneak Preview of Visual C# Whidbey" or "A Sneak Preview of Visual Basic 2005", "Productivity Enhancements In Visual C# 2005" or any of the numerous other articles on Visual Studio 2005 up on MSDN.

Enjoy Visual Studio 2005!

Published July 27th 2005

All content © 2010, Jelle Druyts
On this page

Recent Photos
www.flickr.com
This is a Flickr badge showing public photos from Jelle Druyts. Make your own badge here.
Advertising
Top Picks
Statistics
Total Posts: 350
This Year: 4
This Month: 2
This Week: 2
Comments: 526
Archives
Sitemap
Disclaimer
This is my personal website, not my boss', not my mother's, and certainly not the pope's. My personal opinions may be irrelevant, inaccurate, boring or even plain wrong, I'm sorry if that makes you feel uncomfortable. But then again, you don't have to read them, I just hope you'll find something interesting here now and then. I'll certainly do my best. But if you don't like it, go read the pope's blog. I'm sure it's fascinating.

Powered by:
newtelligence dasBlog 2.0.7226.0

Sign In