home
blogs
Expand/Collapsephoto album
Expand/Collapsedownloads
Expand/Collapsefeatures and specials
Expand/Collapseyear 12 2003
Expand/Collapsenotes and course materials
guestbook
Expand/Collapsehelp and about

 

Note: This page has been retained for archive purposes only, and is no longer maintained. Enoch Lau's current site can be located at http://www.nointrigue.com/.

Microsoft Visual Studio .NET 2003

(December 2003)

Evaluation:

Eventually, there will come a time when all Windows developers will have to embrace Microsoft's new flagship programming model, the .NET Framework and its associated development environment, Visual Studio .NET. Benefits promised include easier access to functions once handled by the cumbersome Win32 API, and integrated XML Web Services support, but are there oversights and potholes in Microsoft roadmap? I take Visual Studio .NET 2003 for a test run from the perspective of a Visual Basic 6.0 programmer.

The Pros to Microsoft Visual Studio .NET 2003: Things I like

Brand-new interface

The interface, vital for productivity, has been refreshed to give it the same familiar appearnace as Microsoft Office XP. The toolbox tabs now slide in and out with smooth animation, and you can use the Clipboard Ring tab to store code snippets that you can then reuse. You simply drag code on and off the Clipboard Ring from the code editor, which allows you to add common code such as control blocks (for each, while, etc...) at the click of a button. In addition, the new Start Page and integrated create a neat browser-style interface.

New Controls and Libraries

One of the most obvious benefits of programming with .NET is the access you have to powerful and rich libraries that utilise modern programming concepts usch as OOP missing from the clumsy Win32 API. For example, in the dark ages, to find out something like the username of the security context that you're running under, you had to declare a buffer of spaces, pass it to a Win32 API function that may or may not crash your program and also pray that you'll get meaningful data back. Now, such things can be retrieved as native Strings using .NET functions. Using VB.NET, it's actually probably more difficult to call Win32 API functions, as in many cases you'll need to use such as marshals due to data type differences, but the .NET framework often provides functions that negate the need to use API functions.

Although the .NET platform is radically different from the old COM/ActiveX-based environment, you are (theoretically) supposed to be able to use most of your old controls, although I haven't had much success in this area (they crash!!!). However, this need to use ActiveX controls is reduced as .NET comes with a large number of intrinsic controls, such as TreeView, OpenFileDialog and Splitter, that actually have better functionality than their old counterparts.

What's also an incentive to migrate is the ability to Windows XP style controls. While you could achieve this using Visual C++ 6.0, getting them to work in VB6 was a hit and miss affair. Now, you set the FlatStyle property of the control to System and create a manifest file in your application folder and your controls will take on the new appearance. Another cool visual aspect that I love is the form Opacity property that allows you to make forms see through; using the Win32 API to do this is rather difficult.

Console applications are now fully supported in VB, and reading and writing from the command line is now as easily as it used to be in QBasic.

Coding Changes

For Visual Basic developers, the major concern will be the changes in the language itself. However, the syntax is still Basic and will forever be Basic. The changes lie in the object model, and are often quite commonsense changes. For example, the Set keyword is no longer supported because VB.NET no longer uses default properites, which was a bad programming practice in anyone's book.

If you used to spend hours upon hours writing repetitive and boring resize code, you can chuck it out. By setting the Anchor and Dock properties, you can have controls that move and resize as the user changes the dimensions of the form. However, I find that when the controls move, the result is often quite jerky and visually unappealing. However, even if you manually write resize coding, the result is the same; it's probably because the .NET paints its controls slower than before.

You now have access to full inheritance, an aspect of object-oriented programming that was never part of VB6. For example, if you don't set the Font property of a control on a form, and you change the Font of your form, the control will take on the new Font of the form automatically. This can be be both a blessing and a curse. In addition, you can extend the functionality of built-in controls simply by using the Inherits keyword after the Class declaration, and then writing custom event handlers.

I also love the ability to define code regions that can be collapsed by clicking the + and - signs on the left hand margin (this is called outlining). This allows me to write documentation in the source file, but collapse it when I don't need to refer to it. You can also collapse other levels such as classes and procedures.

PocketPC Emulator

This doesn't have much to do with developing for the amateur programmer but it's pretty cool play around with. Keep in mind it's not as good as Palm OS's emulator: the PocketPC one is slow as snails and lacks interactivity with your actual computer (such as you can't run ActiveSync on the emulator).

The Cons to Visual Studio .NET 2003: Things I Don't Like

The Migration Wizard Sucks

I try to be objective when I write articles, but I can't help but complain about this. I tried to migrate all of my projects and only two simple projects migrated properly without any problems. The twip to pixel conversion often left controls out of line, and there were so many build errors that it might have been easier for me to copy the basic algorithms and recreate the UI from scratch. Because of the major changes in the way .NET handles graphics, no graphics code was upgraded, and because controls don't have a BorderColor property anymore (which is rather stupid), it is excruciatingly difficult to give controls a border that isn't black.

I wish Google came with MSDN Library

The Microsoft search engine that you use in the Search pane in the IDE or in MSDN Library also completely sucks. The results are generally irrelevant, and I find it easier to either use MSDN 6.0, or use Google to search msdn.microsoft.com (the online version).

The Compilation Experience

Because the .NET system requires the files to be compiled all at once (like Visual C++), compiling and running your program now takes a significantly longer time than before. For example, to compile a simple application on a relatively fast computer, it would take on the order of five seconds before the first form comes up.

In Visual Studio .NET 2003, if you change a line of code, you need to recompile for the changes to be reflected in your application. However, Edit and Continue will be reintroduced in version 2004, a welcome change.

Immediate Window Not So Immediate

The immediate window for some strange reason does not work as expected. I don't know whether this is intentional or there's just something wrong VS.NET 2003. You type a statement into the immediate window, and even if it something as simple as arithmetic, the IDE tells you that you can't run it in Design mode when you're in Design mode, and that you can't run it in Run mode when you're in Run mode. Is there a third mode I don't know about? The Crashed mode?

The only way I've got it to respond so far is to create a console app and break it. Even then, it seems strangely restricted to arithmetic statements (such as ?1+2) and access to .NET objects won't work! I guess the problem lies in that VB is no longer interpreted by the IDE.

Another thing, the old bastion of QBasic programming, PRINT "Hello World", no longer works. VB now only accepts the question mark operator, as demonstrated in the previous paragraph.

Evaluation

I have lots more to say, but I'm finding it hard to type at the moment as Dreamweaver MX is lagging so much (as it does with large files). Anyway, you'd probably want to get to the point.

Visual Studio .NET is a solid development package, and has potential to vastly improve your efficiency by introducing such features as OOP into VB, something that developers have been wanting for ages. In addition, unnecessary coding is cut down at every step, from simplifying access to the computer system to the creation of your user interface. For developers hoping to future-proof their skill base, it is a vital package to include in your repertoire, as you will be able to create world-class applications for a variety of smart devices with the minimum of effort.

As for the downsides to VS.NET, and in particular to VB.NET that were examined here, the major pothole is the migration from the older platform. I would expect that this would prove to be an enormous task for any developer, especially for applications that relied on the intricacies of VB6, and many Windows apps can remain in VB6. However, once migrated, the experience of .NET outweighs the negatives. The only thing was that .NET just takes a little getting used to at first.

Reviewed using Microsoft Visual Studio .NET 2003 Academic Edition (International English) that for some reason connects to the Japanese-language online resources...

 

Copyright © 2002-2006 Enoch Lau. All Rights Reserved. Terms of Use / Privacy Policy