views:

84

answers:

4

i want to migrate one of the application from vb6 to .net with visual studio 2010.At present the application is windows based application. i want to make web application. i guess i have to rewrite the code in .net. could you please advice me while i rewrite the code in .net.

A: 

It depends very highly on how well-structured the original application is. A well-structured application could be translated from desktop to web with a fairly high amount of reuse. Unfortunately, the vast majority of VB6-era code is not well-structured and that makes life much harder for you.

Visual Studio is able to import a VB6 project and convert it to VB.NET, but the mapping is not perfect. Coupled with the badly-structured code that I mentioned above that's common to a lot of VB6 code, you may be better off just totally scrapping the original project and starting anew.

It's highly dependent on a lot of factors, of course. You might be lucky and be working with one of those rare gems: a well-structured VB6 project with clear separation of views and code.

Dean Harding
Scrapping the original project and starting anew is superficially attractive, but it can lead to failure. "Many companies I worked with in the early days of .NET looked first at rewriting driven in part by a strong desire to improve the underlying architecture and code structures at the same time as they moved to .NET. Unfortunately many of those projects ran into difficulty and several were never completed. The problem they were trying to solve was too large" By a Microsoft insider http://blogs.msdn.com/goto100/archive/2008/11/03/rewrite-vs-migrate-vs-reuse-vs-replace.aspx
MarkJ
@MarkJ: Sometimes you have no choice but to start all over. Converting a desktop app to a web based one is a prime example. The best way I've seen to transition is to wrap up development on the old one and start fresh. Expect this to take a while. Before you start though take a cold hard look at the features the desktop app actually has. Do all of those need to be replicated? More to the point, which ones have to be replicated with version 1.0 of the web app.
Chris Lively
That said not every desktop app needs to be converted and you should only go down that path if there is a valid business reason. We went through this a couple years ago in a move from classic asp to c# and asp.net. It was a full rewrite and highly successful. We didn't take all of the old features just the "had to have" ones and launched it. Since then we've already caught up to and surpassed the previous feature level. One thing in our favor is that the team that wrote the original version was the same team to do the rewrite.
Chris Lively
+2  A: 

If your VB6 application is composed of multiple COM objects with clean interfaces, then you should be able to reuse those components which do not touch the UI. You might want to take advantage of the VB6 expertise at your company to separate any UI code from business logic. The business logic can then be reused in the web application.

John Saunders
+2  A: 

There's lots of advice on strategies for conversion. One strategy that might work well (as John said) is to use Interop to mix a VB6 back-end with a .Net web front end.

Some other resources:

MarkJ
A: 

VBDepend can help to understand the existing vb6 code before migration, and accelerate the process during migration.

Issam