Less time: rewriting or converting an application from VB5 to C #

I have a contract where I need to continue development and the old application package that was programmed in VB5 back in those days.

I have a fix and a new feature for development.

So, I have several options:

  • Continue programming in VB5 (NOOOOOOOOOOOOOOOO !!!!)
  • Convert VB5 to C # (how ??? is it possible without losing your mind?)
  • Rewrite the entire application package (A lot of time)

Are there any other options? What should I do?

EDIT: Ah, and also it uses the ACCESS database, which I would like to move to SQL EXPRESS. Because this is a crazy database made illogically by a stupid programmer from the 90s.

thanks

+4
source share
7 answers

The choice I made every time was to simply rewrite or buy a suitable replacement if I could find it.

I tried doing incremental updates from VB6 to VB.NET, but I don't like this approach because it comes out of ActiveX controls that I would not use. Overwriting is cleaner.

I don’t think there is a converter from VB5 to C #. You may be able to switch from VB5 to VB.NET and then convert to C #, but in my experience it takes less time to overwrite than trying to update and play with broken code.

+3
source

There is no reliable way to do 2), so this is 1) or 3).

And I don’t think your client wants to pay for 3). But maybe you can sell it for reliability, support, etc.

Otherwise you are stuck with 1)

+1
source

One approach would be to tactfully rewrite sections of code in C # - you could start with areas that are most likely to be most efficient, create C # assemblies to reflect functionality, and then put them into VB5 code through COM Interop.

A good set of unit tests is recommended for this approach.

I heard that Michael Persian's Effective Work with Obsolete Code is the best book to understand how best to cut a problem, like this.

+1
source

The answer definitely depends on many factors. I recently had a similar project (a 10-year-old plus an old VB6 application for Windows with a large spaghetti code base) and accessed it using a β€œhybrid” approach:

  • Errors have been fixed in VB6
  • New features were developed in .NET 4 using COM interoperability.

We developed several WPF dialogs and designed them to work with the old interface to handle the new user interface.

This option only works when new features are quite independent of the main application, but it has the advantage of at least leveraging the performance of new technologies and also paving the way for future conversion.

+1
source

I recently finished a project where we converted many old VB6 applications to C # using the Artinsoft VB Upgrade Companion .

It is a difficult challenge to decide which approach is better. In many cases, code conversion can be very painful, especially if there is a lot of logic based on functions that differ significantly between the two platforms (for example, single-index arrays or error handling through the Information.Err object instead of exceptions).

On the other hand, if you try to record it from scratch, there is a good chance that you accidentally change some subtle behavior that does not immediately become apparent when viewing the VB5 source code. Such things can be difficult to track.

A good compromise is to use a converter to port the code, and then use it as a guide to write things from scratch, because I hope there will be places where you can just pick up the converted code directly into a new code base. At the same time, you get the opportunity to write more convenient code everywhere.

With all that said, if the original VB5 is well written and (relatively) well structured, then I would recommend against any kind of update. You will spend much more time trying to match the existing behavior of the old application than just working on the old code.

Good luck with what you decide to do - you'll need it :)

+1
source

Maybe you need to convert to vb.net first and then to C #?

0
source

If you just need to fix the error, and this is a fairly simple error, and you do not expect much more work outside it, stick to VB5. Anything else will present a lot more work.

However, if this is a truly live product that you expect to work hard in the future, I will probably start from scratch. I assume that you have learned a lot about design and architecture since you wrote the application, so you could take the opportunity to write a more convenient application. (You probably also found out which design decisions in the original application turned out to be errors.)

0
source

Source: https://habr.com/ru/post/1347548/


All Articles