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 : Page 3

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

CONTINUE TO USE USER DEFINED INTERFACES

It took me a long time to start enjoying user-defined interfaces, but after a couple of minutes I saw the light. Ever since then, I’ve been using them a lot and definitely think I’ve benefited a lot from them.



I don’t know if it’s because of my instinct for adjusting myself or something else, but the last few years I haven’t missed implementation inheritance much and that is mostly because of VB’s support for separating the interfaces from their implementation by using user-defined interfaces.

At one period in time, I thought that Microsoft told us about the problems with implementation inheritance in large real world applications because they didn’t have the support for it in COM and VB. Then I read Szyperski’s book Component Software. Beyond Object-Oriented Programming and understood that the problems were well-known in the academic research since a long time back.

Yes, I know that we will have implementation inheritance in VB.NET, and I will definitely use it. (As I understand it, Microsoft has at least partly solved some of the classical problems with implementation inheritance.) I also know that I will definitely use user-defined interfaces a lot in the future too. Since VB.NET won’t have support for multiple inheritance, you will give added support to classes by implementing interfaces. You will also use user-defined interfaces in situations similar to when you use them today.

BTW, Microsoft has also refined the support quite a bit for user-defined interfaces in VB.NET, but that is another story.


SIMULATE TRY CATCH FINALLY

Finally VB.NET will have support for structured error handling with Try, Catch and Finally! In the Try-block you write the ordinary code, in the Catch-block you take care of errors and in the Finally-block you have code that you want to be executed no matter if there is an error or not.

Even though the error handling in VB6 is quite primitive you can get close to the semantics of Try, Catch and Finally and by doing that you will get a solid structure for the methods in your components already today.

In the article Example of code structure for COM+ component I describe a code structure for a complete COM+ component, but most of the attention is being paid to the error trapping and how to simulate Try, Catch and Finally.

BUILD FOR COM+ AND ITS PROGRAMMING MODEL

COM+ Component Services is dead! Long live .NET Component Services! What I’m saying is that the COM+ programming model that you’ve come to love, seem to be more or less exactly the same with .NET. (The rumor says that the way to use .NET Component Services will change a bit in beta 2, but that is as far as I know today just rumors.)

As a VB-programmer you will with VB.NET get access to more component services than before so it will just be more fun tomorrow. I’m sure you will enjoy COM+ Component Services today also (and also see a lot of benefits in using them) so my recommendation is clear. Get accustomed to them and use them if you haven’t yet!

SUMMARY

Hopefully this article has added a whole bunch of tips to your collection of information for how you can prepare yourself but also your VB6 components already today for upgrading to VB.NET. The more design-aware you are and the more well-designed your VB6 components are, the more possible it will be to port you and your components to VB.NET. That is my summarized guess!

RELATED



Jimmy Nilsson is the owner of the Swedish consultant company JNSK AB (www.jnsk.se). He has been working with system development since late 1988 (with VB since version 1.0) and, in recent years, he has specialized in component-based development, mostly in the Microsoft environment. He has also been developing and presenting courses in database design, object-oriented design, etc. at a Swedish University for six years. Jimmy is the author of ".NET Enterprise Design with Visual Basic .NET and SQL Server 2000" and he often speaks at VSLive conferences.
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