Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am maintaining a VB6 application and we are studying how to migrate to .Net We are considering doing this gradually by implementing new features in COM visible .Net classes and migrating existing functionality slowly. I found some instructive 'Hello World' examples about how to do this and it works fine with our App. But how is the real world behaviour of these hybrid applications? Are they stable, maintainable? Particular of our program is that more users on the same computer will use it by switching user accounts.

EDIT: The VB6 app reads data from a USB connection and stores it in an Access database. The user can call up various views on the data. The data is cached in a hardware device, so interuptions in the reading of it are not fatal.

share|improve this question
1  
What does the 'legacy' application do? some more details would help in answering your question. –  Darknight Jan 24 '11 at 11:10
add comment

3 Answers

up vote 4 down vote accepted
+50

I have had amazing success exposing .NET to VB6 via COM interfaces. By doing this we were able to initially refactor out a huge amount of VB6 code and set up an upgrade path to .NET. Just keep in mind that idiomatic VB6 does not translate well to C# or even VB.NET so you'll want to tread carefully.

The one issue we had which was pretty annoying was the excessive amount of rebuilds we had to do because of changes to the public COM interface. This was alleviated by Visual Make.

share|improve this answer
    
Thank you. Could you please explain more about the problem that Visual Make solves. I am not sure I understand. –  Dabblernl Jan 24 '11 at 13:32
    
@Dabblernl - Visual Make allows you to create a project, which is a collection of VB6 projects, and it will build them in the proper order. –  ChaosPandion Jan 24 '11 at 14:47
add comment

FWIW, in my experience the need to upgrade a VB6 app to .Net provides the ideal excuse for a re-write. Unless the original coders were brilliant visionaries, the techniques prevalent in VB6 rarely port cleanly to .Net.

Some of the delights you'll encounter:

  1. You'll end up with references to Microsoft.VisualBasic that you really don't want.
  2. They'll be hard-to-find bugs, for example where the VB6 substring(a,b,c) quietly renders as a.SubString(b,c) and blows up in your face because it was 1-based in VB6 and 0-based in .Net.
  3. All those easy-to-code implicit conversions will come out of the woodwork, usually on the first PC that doesn't have "," as the list delimiter and/or "." as the decimal separator.
  4. Your converted classes won't have the desirable data-hiding that a re-design should bring.

HTH

share|improve this answer
    
You bring up some very good points. These are some of the reasons why an initial pass over the code to refactor out bad practices is a must have. Ideally you would make sure Option Explicit is turned on and all reliance on magical implicit conversions are removed. –  ChaosPandion Jan 24 '11 at 16:21
    
Thanks for cheering me up ;-) But it is not, at the moment, what I want to know. The real conversion nightmare is still to come. –  Dabblernl Jan 24 '11 at 16:27
    
@chaos Right. In fact I start with Explicit and when there are no errors left, I jack it up to Strict, which highlights many, many issues usefully –  smirkingman Jan 24 '11 at 16:37
    
I have heard of teams that went after VB6 code with flamethrowers. I believe that the reason this happens so much more for VB6 code is that so many VB "developers" had no programming experience when they started. This in turn created a myriad of poorly-designed and coded applications in the wild for this generation of professionals to deal with. –  It Grunt Feb 4 '11 at 22:11
add comment

It should work fine for you, there's nothing in particular about fast user switching/multiple sessions that should cause you any problems.

In terms of maintainability, keep in mind that hybrid VB6/VB.NET should only be a temporary solution: your plan should be to migrate fully to VB.NET over time.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.