My thoughts on VB.NET
I'll state at the beginning of this story that I think that they have fixed VB.
I really like the VB.NET language. I wouldn't teach classes with it otherwise.
I've been a Visual Basic developer for a number of years. It has been my
preferred development languages for about 6 years now. I work in C++, Delphi,
Java and a number of other languages, depending on what I'm trying to do and
what the job calls for, but when I get a choice....
VB.NET introduces the largest changes to the VB language since VB3 to VB4. It's
been so dramatic that many VB developers have vowed not to use it and have
called it VB.NET or Visual Fred, just anything except VB.
I have to admit that I was among them at first. I had gotten my hands on the
VB.NET Tech Preview released at TechEd 2000. I cut work early to go home and
try it. I was so excited about the new features that I had heard about, I ran
home early to try it out.
I had a spare machine at home that I could install it on. I threw in the CD, and
installed. It went flawlessly. I couldn't believe it.
I fired up the IDE and started coding. The simple WinForms (now Windows Forms)
project that I created looked on the surface to look like the VB6 Standard EXE
project. The form was drag and drop and very much like the old VB.
The first thing that I wanted to try was the new inheritance stuff. I added a
class to the project that I had created. This was again, very much like VB6.
Except that it wasn’t a .cls file, it was a .vb file, just like the form. Cool.
I realized that I could start adding new classes into the same code file. Now,
the C++ guys are saying, “So what?”. But this is exciting to a VB programmer.
Trying to be a good programmer, I decided to add a private member variable and
expose it through a property. Sounds easy enough… These are the famous last
words of many a great programmer. Forty-five minutes and much less hair later,
I gave up. I couldn’t figure out the new property syntax. I couldn’t find it
anywhere in the help. I couldn’t find any samples online. You have to remember
that this was the tech preview. Nobody else had even seen it, so there weren’t
any sites up about it yet. Now it’s easy to find things and the help is great.
Never-the-less, I was frustrated. They had broken my favorite language! I yanked
the CD out of the tray and it joined the aero-space program in a hurry. But you
see, I have the dog, Jake, who is an Australian Shepard. Yes, those are the
dogs that often win the Frisbee catching contests. He caught and retrieved that
CD without even slobbering on it badly.
I took it as a sign and decided to give it one more try. Once I figured out the
property syntax, I started to like the language. No, I don’t like everything
about it, but it is much more powerful that VB6 could ever have been. I no
longer need to work in a dozen different languages to accomplish a three tiered
architecture. I don’t know how I ever got along in VB6.
I recently had a contract that called for VB6 again. That was the most
frustrating contract that I have ever been on. I had been shown the Promised
Land and then was jerked back with amazing force. It wasn’t fair.
There are too many things that they have fixed to list in this small article.
But here is a short list.
| VB6 |
VB.NET |
| Parameters default to ByRef |
Parameters default to ByVal |
| Error Handling never good enough |
Structured Error Handling as C++ and Java have had all the time.
Try
Catch ex As Exception
End Try
|
|
Interface Only Inheritance |
Full Implementation Inheritance |
|
Heavy use of optional parameters |
Function Overloading is much cleaner and easy to debug |
|
Auto Conversion of variables would lead to many runtime errors |
Option Strict disallows implicit conversions to over variable types |
|
Variable Declaration and Initialization required two lines of code |
Inline initialization of variables |
VB.NET Resources
|