Migrating from Visual Basic 6 to Visual Basic .Net/2005

Posted by dragon on Friday, 9 September 2011


As a Visual Basic 6.0 programmer, what is the roadmap forward for your applications? As Visual Basic 6.0 becomes ‘deprecated technology’ what will you do with your enterprise class applications written in Visual Basic 6.0. This article is the musings of a developer that has been looking at migrating existing enterprise-class Visual Basic 6.0 applications to Visual Basic 2005.
If you have been a serious Visual Basic 6.0 programmer with very sizeable code investments in Visual Basic (we have 22 enterprise level applications), at least 18 of which are written with Microsoft Visual Basic, crunch time comes when you begin to think or when you decide to advance your applications to new versions. Crunch time comes when all of a sudden, your Visual Basic 6.0 projects don’t open properly anymore in the Visual Basic 6.0 IDE (especially when running on Windows Vista with Visual Studio 2005 installed). Crunch time comes most especially when it dawns on you that you are basically using ‘deprecated’ technology, that between Visual Studio 6.0 (which contained Visual Basic 6.0) and Visual Studio 2008 (the latest version of Microsoft’s Visual Studio development suite), they have been 4 (four) new versions of Visual Basic.
Crunch time is the realization that for your software business to live, you will have to do something about your existing Visual Basic 6.0 applications. Our purpose in writing this article is to share our experiences of what we found as we endeavored to start to upgrade our Visual Basic 6.0 applications, and to discuss some of the touch decisions and choices that will undoubtedly have to be made.
Appraising the current Visual Basic situation!
What made Visual Basic special was its power, elegance and simplicity! It largely retained the style and syntax of the Basic language as we knew it i.e. if you had been using GW Basic, QBasic, Microsoft Basic Professional Development System (we shall call of these ‘Microsoft’s Basic’), etc, you could look at Visual Basic code and read it and understand it. Changing over from those early flavors of Microsoft’s implementation of the Basic programming language to Visual Basic was thus not difficult. In fact, the skills you learnt from using those early implementations of Basic made it easy and possible to immediately start building Windows database applications on Microsoft Access 2 using then Access Basic as implemented on those versions of Microsoft Access even though you had to learn a few new keywords and perhaps had to deal with the situation that some language features you knew had been removed!
Further evolutions of Microsoft’s Basic implementations ensured that the Basic language as we knew it was preserved and skills of the Visual Basic programmer were further enhanced when Microsoft made Visual Basic the ‘unified programming/macro environment’ for its leading Microsoft Office suite of productivity applications as well as the premier scripting language for its ASP (Active Server Pages) Web development system. Despite the very slight variations between Visual Basic, Visual Basic for Applications (VBA), and VBScript, Microsoft’s Basic was Microsoft’s Basic and it was not difficult for the Visual Basic Programmer or someone with skills in some other implementation of Basic for that matter to be able to switch between any of these three core environments or implementations of Microsoft’s Basic!
Now coming to Visual Basic 6, the most powerful and elegant release of these flavors (prior to the .NET flavors) of Microsoft’s Basic, the Microsoft Solutions Framework (MSF) emphasized a componentized systems design and development approach in which the meat of your application (data access code, data manipulation code and business rules) could all be built as COM (Component Object Model) components hosted on MTS/COM+. Your application front-end (Visual Basic Forms or ASP Web Pages) could then call these components to obtain any services required. The backend could be any database system that had an ODBC Driver or OLE DB provider. The front-end as already noted could of course be Visual Basic Forms (if you wanted your application to run as a Windows application) or ASP (if you wanted your application to run as a Web application).
Your data-aware classes could easily establish connections to the database and then create recordset objects in its Init event that could then be returned to a calling application by calling the GetDataMember method of such a class.
Even in terms of data access technology, if you had been using DAO (Data-Access Objects) or RDO (Remote Data Objects) in versions of Visual Basic prior to version 6, changing over to using ADO (ActiveX Data Objects) was not very difficult since both technologies had similar terminology and interface (e.g. A recordset object in DAO was similar in concept to a Recordset Object in ADO) and methods of processing the objects returned.
This then is a general and short summary of what Basic programmers using Microsoft’s implementation of that language have had to deal with until the arrival of Visual Basic .NET flavors of Basic.
What is all the Hullaballoo about?
Visual Basic programmers expected Microsoft to maintain the look and feel of Microsoft’s Basic that we had always known (especially in the language implementation). But behold! What did Microsoft choose to do?  They decided to fulfill the biblical prophecy recorded at Zephaniah 3:9 which states ‘For then I shall give the peoples a change to a pure language, in order for them to call upon the name of Jehovah, in order to serve him shoulder to shoulder’.
The attempt to fulfill this biblical prophecy resulted in Microsoft’s attempt to create the New Jerusalem (the .NET Framework) and of course as we now know it, the .NET Framework languages! The result has been a massive genetic modification of the Visual Basic language and an attempted premature extinction of ‘perceived dianosaurs’ (e.g. Visual FoxPro).
If you are a lover of ‘game meat’ and Visual Basic prior to .NET was a charming wild mountain goat (an Ibex on the Highlands of Ethiopia), and you were then given the ‘new ‘ Visual Basic (i.e. the .NET Flavors of Visual Basic), you would not want to eat the meat at all because the color of the animal has changed, its size has changed (it looks more bloated), its natural smell has changed (it smells not like Basic but like C/C++), even its meat tastes different (not the C/C++ like syntax for writing code)…the grand creator (Microsoft) says it is the same or better but we all (aspiring citizens of the New Jerusalem) can see it is not! You cannot even open a Visual Basic 6.0 project in Visual Basic 2005 and expect it to run…it is that bad!
Crunch Time!
The million dollar question then is ‘If you are a Visual Basic 6.0 Programmer with significant code investments, what would you do?’ Should you migrate to other implementations of the Basic Programming language such as REALbasic 2009 (from Real Software Inc) or Liberty Basic? Should you try Visual Basic 6 lookalikes that also offer multi-platform compatibility such as Jabaco 1.4 (by Manuel Siekmann) or should you just rewrite your code in Visual Basic 2005/.NET? What alternatives did we find and what choices will have to be made?
Jabaco: Jabaco is startlingly like Visual Basic 6.0. Even the startup forms, property windows, toolbox, project explorer are astonishingly like Visual Basic. What is more, even the code syntax you write is pure VB 6-like! We made a copy of our Fixed Assets Software system and then opened it in Jabaco (we are using Windows Vista Home Basic) and the conversion process was seamless. To run the code, we made some minor changes (e.g. Converting Currency to Double) or removing Windows Controls such as the toolbar control and that was that! The structure of the Jabaco code, its keywords, its syntax, the functions and procedures are Visual Basic 6 alike. Even the way you make your Exe’s after writing your program was simple and straight forward. If you are a Visual Basic 6.0 programmer, and you are looking for a secure non-Microsoft way forward for your projects, you will feel instantly at home with Jabaco 1.4 from the very minute you start the application…you can start writing tons of code immediately! When we tried to run our program (both on Windows XP SP2 and Windows Vista Home), we were pleased to see that it could run without hitches! Jabaco would compile your application to Java byte code. In addition, Jabaco is free! The big cat is certainly prowling – power, elegance, speed, simplicity, multi-platform capability by compiling to Java plus a pure preservation of the spirit of Visual Basic…this is Jabaco!
Liberty Basic: Liberty Basic appear to offer a nice RAD look and feel! The method for building your application is reverse to what you normally do with Visual Basic 6 where you would draw your form’s on a Canvas! Liberty Basic is indeed a free-spirit, a true implementation of the Basic Programming Language! We did not test drive this tool! You would definitely have to look at this one for yourself…we have not evaluated this tool closely!
True Basic: True Basic is another viable alternative to Visual Basic! This implementation of the Basic programming language is touted as the true descendant of the original Dartmouth Basic and is available in Silver, Bronze and Gold editions. Again, we could not test drive this tool but product descriptions sure make it look like a powerful alternative to Visual Basic!
REALbasic 2009 R3: What about REALBasic 2009! We had known of this tool for sometime, having come across a white paper that we downloaded on the Internet! We downloaded a 30-day evaluation of the REALbasic 2009 R3 from the product website (www.realsoftware.com)! As with Jabaco, installation was a breeze! If we can consider Visual Basic 6.0 to have been a charming wild mountain goat on the highlands of Ethiopia, you may consider REALbasic as beautiful and dainty wild goat variety such as those found on the forests of Cyprus -  a beautiful and tasty variety indeed! A powerful viable alternative to Visual Basic .NET/2005! A Visual Basic 6.0 programmer could look at REALbasic code and readily enough read it understandably despite some minor differences in code structure! Both languages (Visual Basic 6 and REALbasic 2009) share many keywords and reserved words in common even though! Even though the IDE is different, it is readily enough understandable! Unlike Jabaco, REALbasic will not allow automatic conversion of Visual Basic 6.0 projects (or perhaps we did not look deeply enough) but rewriting your Visual Basic 6.0 code in REALbasic should definitely not be as difficult as doing a rewrite in Microsoft’s own Visual Basic 2005! Another attraction to REALbasic was that it ships with its own Client/Server SQL Database so that you can be up, building database applications quickly! This would mean that if you are using REALbasic, you would be obtaining a complete applications development studio (everything you need in the package)! And then to boot, REALbasic is multi-platform capable, allowing you to compile directly to Machine code (for windows, MAC OS and several other OS’s) thus achieving significant performance gains similar to those of C/C++ flavors that also compile to machine code! We think that the differences between REALbasic and Visual Basic can be accounted for in the motivation behind the creation of the language…the fact that the creators of REALbasic are in this for real…they are offering a genuine, powerful, viable, non-Microsoft alternative to Visual Basic.
Microsoft Visual Basic 2005: And what about Microsoft’s Visual Basic 2005 (this is what we have installed to enable us start conversion of our programs)? We cannot pretend that we are happy with the fact that we are required to re-write major league enterprise applications almost bottom up! As very experienced Visual Basic developers, we had expected to get up and quickly using the new Visual Basic (but that was not to be)!
 Be that as it may, Microsoft’s pioneering efforts in programming language design and innovation cannot be just discounted! The new Visual Basic 2005 is not Visual Basic 6 but it does stand shoulder-to-shoulder with C# (Microsoft’s new toy), J# and Visual C++ in terms of syntax and programming constructs! The New Visual Basic 2005 also includes expanded project types and language capabilities! It also has enhanced language constructs and new data types that will easily put you at par with the C# or C++ programmer while providing tools to rapidly create Web applications and access the latest versions of Microsoft’s own SQL Server 2008 and Oracle 10g/11g.
If it is name recognition that you want (Microsoft is a known name world-wide and their marketing power is unmatched); if you want to be a developer building applications with tools from an ‘approved supplier’ then you will have to embrace the new Visual Basic 2005 (Visual Basic 2008 has already been released as at the time of writing)…learn to eat genetically modified meats with a slightly different taste and feel so that you do not starve to death!
I think it is worth mentioning if you must stick with Microsoft that C#, Microsoft’s new C-like language that Microsoft created specifically for .NET Framework programming can also be a powerful contender! We found that mastering C# was both exciting and fun, probably because I was aware that I was learning a completely new programming language and therefore had no preconceptions of what to expect! On the contrary, learning Visual Basic 2005 was not so much fun perhaps because I approached the language as a Visual Basic programming veteran! I expected the language and keywords to be familiar enough! I expected the program structure to be familiar! I expected programming constructs and abstractions to be familiar! If you are a Visual Basic 6.0 programmer hoping to mater Visual Basic 2005 quickly, be forewarned – simply disabuse your mind! Approach Visual Basic 2005 as if you knew nothing at all about Visual Basic, approach it as if you are learning a completely new language that you have never really used for large-scale commercial projects (like say C/C++)and you will master Visual Basic 2005 soon enough!
All the options I have examined will involve some amount of code re-write! They can be no avoiding that no matter how little and I guess that is the risk attendant to our trade is it not?  If you want to keep your VB6 code almost as pure as it is, Jabaco is it! Otherwise, REALbasic is the next best alternative! If you want to stick with Microsoft, you would have no choice but to go Visual Basic 2005 because alas! Microsoft’s massive marketing machine ensures that most companies requesting new software (especially for those of us in the bespoke) software market are all requesting their projects in Visual Studio .NET! Also, it is a reality that the next generation of programmers being trained are being trained in Microsoft’s Visual Studio .NET as exemplified by the new popularity of C#
And what about us? We are taking a serious look at Visual Basic 2005, learning to like and desire the new meat so to speak! But we plan to also be delivering cross-platform solutions in Jabaco! Our quest for a solution brought us in touch with great tools out there being built by little known companies…it is worth checking out!

{ 0 comments... read them below or add one }

Post a Comment