Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

How To Prepare Yourself For Moving From VB6 To VB.NET

In this article, Jimmy Nilsson makes a few guesses of how you can change your coding style and prepare yourself for the transition to make it as smooth as possible. He will focus on components, especially for the server-side.


advertisement

In this article, I will make a few guesses of how you can change your coding style and prepare yourself already today for the transition, to make it as smooth as possible. In the article I will focus on components, especially for the server-side.

Moving from VB6 to VB.NET doesn’t seem to be a small step. Still, we will do the transition in the future because of more improvements than I had dared to hope for. Probably, you won’t port all your code day one and a lot of your code will probably benefit much more from a rewrite rather than a port. Anyway, perhaps you like to start to prepare yourself as early as possible.



Beta 1 has been out for a while, but what I write in this article is actually just guesses. In the history there have been several guesses that we are laughing at today. One example of such a guess (at the time it was created I don’t think they saw it as a guess) was something like "the world will not need more than five computers for all the computations in the future". Another one was something like "a PC will never need more than 640 KB of RAM". Hopefully my guesses will not be that funny in the future. In a year or so we’ll know.

A SHORT INTRO TO VB.NET

I’m not going to spend a lot of time describing what VB.NET is. I’d just like to give a short intro to it before the real article starts.

As you probably know by now, Microsoft is upgrading all its Visual Studio (VS) languages right now. One example of that is that VB6 will be changed to VB.NET. At first you will benefit from several techniques that are shared between all the VS languages such as a new ADO.NET, ASP.NET, WinForms, WebForms, Web Services and the .NET Framework (that is a rich class library with a lot of functionality). You will also find a new Integrated Development Environment (IDE) and a new debugger. Both are to be used for all the .NET languages.

VB.NET will be a full-fledged .NET-language and because of that it can use all the just mentioned functionality, plus a whole lot more. Old problems with VB will be gone such as only the single threaded apartment-model (STA) for multi-threading and VB.NET will also be a much more object-oriented language than before. The latter you will find in the shape of for example implementation inheritance, class methods and the possibility to send parameters to constructors. You will finally have structured error handling and the possibility to force explicit cast and to force declaration of datatypes for variables. Not a single day too early, right?

The code you write in VB will be compiled to Intermediate Language (IL). The IL will then be executed with the Common Language Runtime (CLR) (after it has been compiled to machine code). That is exactly what is happening with C# too for example and both those languages (and the rest of the .NET-languages) will probably have more or less the same performance characteristics. (It depends upon how efficient IL they will generate.)

AVAILABLE INFORMATION

There is a lot of information available already about VB.NET and also information about how to upgrade. A common tip is to be as explicit as possible in your code. An example of that is to write out both ByRef and ByVal in your parameter lists even though you will get the effect from ByRef if you don’t say anything else. The reason for this is almost to be called well known by now. In VB.NET, ByVal will be used if nothing else has been stated. So, it’s effectively the opposite from VB6. The upgrade wizard will hopefully take care of this well, but if you will need to directly change habit when you jump between VB6 and VB.NET projects (which most of us will have to do for a long time) it’s probably a very good idea to use this tip.

From now on in this article, I will not mention tips that I’ve read anywhere else so the rest will be my own guesses that I will have to be embarrassed for myself if they prove wrong.

RUSH TO UPGRADE?

Just one more thing before we get going. Will it be important to rush to upgrade your VB6 components to VB.NET components? As I see it, it will not. I will most probably let my components that are in production when VB.NET ships, stay in VB6 for a while (or perhaps for a very long time). The interoperability seems to be strong and therefore it will probably be perfectly alright to let your old VB6 components cooperate with new ones that you definitely (hmmm, should be perhaps) will rush to create in VB.NET. (Please note though that the interoperability layer will decrease performance slightly.)

An exception to this is if you have COM+ components that really would benefit a lot from those COM+ component services that you can’t use today such as object pooling. Anyway in most cases you don’t have to rush to the upgrading process. Even if that is the case, why not prepare yourself for the eventual upgrade? So, let’s take a look at what I think should be done today.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date