Migrating from VB6

Just starting out? Need help? Post your questions and find answers here.
axisdj
User
User
Posts: 20
Joined: Tue Dec 19, 2017 7:03 pm

Migrating from VB6

Post by axisdj »

Hello,

As I assume many here moved to PureBasic as vb6 is no longer supported.. I have been looking for a cross platform alternative to VB6 and it appears pureBasic now fits the bill!

I am looking to migrate 2 100k LOC projects from vb6 to Purebasic, has anyone had success doing this? Are there any tools that help with this? how close to VB6 is pureBasic ( general question... just looking for the gotcha's)

thanks
Olli
Addict
Addict
Posts: 1198
Joined: Wed May 27, 2020 12:26 pm

Re: Migrating from VB6

Post by Olli »

Tools, that's us.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 561
Joined: Tue Jan 04, 2011 6:21 pm

Re: Migrating from VB6

Post by SPH »

axisdj wrote:Hello,

As I assume many here moved to PureBasic as vb6 is no longer supported.. I have been looking for a cross platform alternative to VB6 and it appears pureBasic now fits the bill!

I am looking to migrate 2 100k LOC projects from vb6 to Purebasic, has anyone had success doing this? Are there any tools that help with this? how close to VB6 is pureBasic ( general question... just looking for the gotcha's)

thanks
https://www.purebasic.fr/french/viewtop ... chaumieres

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
dcr3
Enthusiast
Enthusiast
Posts: 181
Joined: Fri Aug 04, 2017 11:03 pm

Re: Migrating from VB6

Post by dcr3 »

Olli wrote: Post subject: Re: Migrating from VB6 Reply with quote
Tools, that's us.
So True. :lol: :lol:
axisdj
User
User
Posts: 20
Joined: Tue Dec 19, 2017 7:03 pm

Re: Migrating from VB6

Post by axisdj »

SPH wrote:
axisdj wrote:Hello,

As I assume many here moved to PureBasic as vb6 is no longer supported.. I have been looking for a cross platform alternative to VB6 and it appears pureBasic now fits the bill!

I am looking to migrate 2 100k LOC projects from vb6 to Purebasic, has anyone had success doing this? Are there any tools that help with this? how close to VB6 is pureBasic ( general question... just looking for the gotcha's)

thanks
https://www.purebasic.fr/french/viewtop ... chaumieres
Thank you, but that will convert from vb.net, I am looking for a solution for vb6. This will mean I will need a way to convert my classes to work in PB.

ANY further experienced guidance will be greatly appreciated, moving from a large VB6! project to PB.
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Migrating from VB6

Post by mk-soft »

Classes in VB6 ?

Purebasic is function (procedure) oriented and not class or object oriented.
You can program classes and object oriented with Purebasic, but it is not directly supported like VB6. But this is possible with more effort.

See for example in my signature OOP-BaseClass
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
deeproot
Enthusiast
Enthusiast
Posts: 284
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Migrating from VB6

Post by deeproot »

Hi axisdj

Please see my post in this thread - viewtopic.php?f=7&t=69952 - I still stand by those comments.

Further thoughts and personal observations :

-- PureBasic and VB6 are different languages (as indicated by mk-soft), even though some experience is transferable - best to embrace and enjoy that!

-- Avoid attempting to force your new PureBasic code to behave exactly the same as VB6 - do things the PureBasic way!

-- I do not believe there is any software tool that will effectively aid migration of large codes. Best to manually work through each section of the program to adapt and rewrite for PureBasic. Yes, it's slow but the end result will be good and very likely a better product that the original VB6.

-- Before starting a very time consuming conversion, assess if there are any functions of your application that are specially difficult or not directly possible using PureBasic. If so then either solve them first with small trial projects or else you may need to re-evaluate you language choice! I didn't find anything serious, it was always possible to make an equivalent solution.

In hindsight there is only one thing I would have done differently - start my migration earlier!
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Migrating from VB6

Post by Keya »

VB6 native code is generally very easily translated to PB, but it becomes tricky when translating things like ActiveX objects which VB6 natively supports but PB doesn't
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Migrating from VB6

Post by skywalk »

Same with many here. I migrated using self written VB6 to PB conversion code written in PB. That served 2 purposes. Learn PB and rewrite my big apps at same time. :)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
axisdj
User
User
Posts: 20
Joined: Tue Dec 19, 2017 7:03 pm

Re: Migrating from VB6

Post by axisdj »

@deeproot, I am no longer concerned about purebasic being popular enough.... I am at the point where I do see it as a viable option.

I have migrated some of my code as an initial small test project to Lazarus (cross plaform delphi style ide/compiler)(using vbTo converter, then hand correcting where needed) for a small mac app I wrote, and it worked out OK, but I just really prefer the BASIC syntax.

So let me ask a more direct question. As far as activeX, I really am not concerned about that, in all my new designs I try not to use any third party dll's or OCXs I do not have the source for.

What my main concern now is how I would convert my classes. I assume it requires a whole new perspective of possibly converting many of the classes into structs and in a functional manner writing functions that accept those structs as arguments. I do wonder how much my code base would need to change since I use objects allot. I suppose each object can be converted to a struct to hold variables, and all associated functions could reside in the same source file.

Am I somewhat understanding what would have to be done?

thanks
User avatar
TI-994A
Addict
Addict
Posts: 2698
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Migrating from VB6

Post by TI-994A »

axisdj wrote:...my main concern now is how I would convert my classes...
While integration with external/system OO code is not impossible, requiring emulation of class-based protocols and interfaces, it's easier to refactor our own class code into the procedural paradigm which PureBasic utilises.

Rather than speculating on the adaptability of your code into PureBasic, it might be best to post a sample of one of your classes, and see what the community comes up with. It'll be a good first step towards a decision.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Migrating from VB6

Post by Marc56us »

Hi axisdj,

I have migrated programs from time to time, and realized that the original pseudo-code and flowchart were far more useful than the code itself.

Indeed, every language has its strengths and raw conversion (when it exists) often gives bad results.

A migration is also often the opportunity to rid a program of unnecessary functions and to use simpler and more efficient methods.

Besides, with age, we write much cleaner, more concise and efficient code (Who hasn't had a big smile when we reread an old code 10 years later: "Who wrote this horrible algorithm? .... um, ohoh, me...uh? I was young. Del, del, del then 3 lines to replace 50.")

All this without forgetting that many external functions are often included in the language.

In PureBasic, Lists (once understood) are an extraordinary way (simple, fast, versatile) to manage masses of variable data, much more easily than the classical Dim.

:wink:
User avatar
deeproot
Enthusiast
Enthusiast
Posts: 284
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Migrating from VB6

Post by deeproot »

Marc56us wrote:Besides, with age, we write much cleaner, more concise and efficient code (Who hasn't had a big smile when we reread an old code 10 years later: "Who wrote this horrible algorithm? .... um, ohoh, me...uh? I was young. Del, del, del then 3 lines to replace 50.")
:) ..... This is so true!! All good comments Marc56us.
User avatar
spikey
Enthusiast
Enthusiast
Posts: 750
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Migrating from VB6

Post by spikey »

axisdj wrote:What my main concern now is how I would convert my classes. I assume it requires a whole new perspective of possibly converting many of the classes into structs and in a functional manner writing functions that accept those structs as arguments. I do wonder how much my code base would need to change since I use objects allot. I suppose each object can be converted to a struct to hold variables, and all associated functions could reside in the same source file.
The most important thing to realise up front is that although PB implements modules and they offer some of the same features as OOP - isolation, encapsulation - they aren't classes in the OOP sense and won't behave exactly as such, for example they don't "automatically" instantiate or dispose of "objects". They collate the code - not the objects.

Understanding this will prevent you from running up the "a module is a class" blind alley, which some OOP trained programmers have failed to spot in the past.

But once you realise that there really isn't any significant fundamental difference at the microprocessor level between the below; and that whether or not you want to fiddle about with virtual tables is entirely up to you - you should be on the way down the right path. From the way you mention structs and functions above suggests to me that you've been thinking about this already.

Code: Select all

Object = New ClassName(attribute parameters)
; isn't really any different to
*StructurePointer = SomeModule::CreateFunction(attribute parameters)
;
; also
;
Object.Method(method parameters)
; isn't really any different to
SomeModule::MethodName(*StructurePointer, method parameters)
The only thing I ever completely failed to migrate to PB that I would have liked to was a COM addin for Microsoft Office 2000. I'm reasonably confident that this wasn't because PB couldn't do it but because there was a lack of publicly available documentation on some of the aspects that get concealed from the programmer by VB/VC. These would have needed to be addressed by a PB programmer properly (specifically the low level details of the necessary interfaces). However I'm not sure that COM addins for Office is even a thing anymore!
Bitblazer
Enthusiast
Enthusiast
Posts: 761
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Migrating from VB6

Post by Bitblazer »

spikey wrote:Understanding this will prevent you from running up the "a module is a class" blind alley, which some OOP trained programmers have failed to spot in the past.
Modules are more like encapsulation attempts aka 'namespaces' (or a dll) to me, but thats just my subjective point of view from comparing my c# (OOP) and PureBasic experience.
Last edited by Bitblazer on Mon Jan 25, 2021 3:39 pm, edited 4 times in total.
Post Reply