[HOWTO] Leverage naming conventions to assign a specific type to implicitly-declared variables

clock January 14, 2011 09:27

One of our customers came up with the following question:

I have some code in my project that was developed by a person used to Fortran naming conventions. In his code, variables starting with letters I to N are meant to be integers while others are Double. Ideally, there would be a pragma such that we can indicate that undeclared variables starting with letters I to N are to be declared as integer while other undeclared variables should be declared double. Is this possible?

The short answer to this question is that the original developer could have used the DefInt and DefDbl VB6 directives to force the type of all undeclared variables. Adding these directives just before migration wasn’t an option, however, because they might introduce very subtle bugs if the developer failed to adhere to the naming rule in some cases. Also, the approach based on Defxxx directive can’t be applied if the naming convention is based on multiple-character prefixes, as such “int” for integers and “dbl” for Double.

Even though VB Migration Partner doesn’t provide a pragma that perform the requested task, what our customer asked for is quite in reach for it. In fact, if you use the DeclareImplicitVariables pragma, then all variables that weren’t explicitly declared are rendered as “Object” variables and are prefixed with 05B1 warning “The xxx variable wasn’t declared explicitly”. Thanks to this detail, using a PostProcess pragma to replace the variable type isn’t hard at all:

'## PostProcess "(?<=05B1\): The '(?<name>[I-N].*?)'.+\r?\n\t+Dim )\k<name> As Object( = Nothing)?", "${name} As Short", True, False, ""
'## PostProcess "(?<=05B1\): The '(?<name>[A-Z-[I-N]].*?)'.+\r?\n\t+Dim )\k<name> As Object( = Nothing)?", "${name} As Double", True, False, ""

If the developer used the “int” and “dbl” prefixes, the pragmas become:

'## PostProcess "(?<=05B1\): The '(?<name>int.*?)'.+\r?\n\t+Dim )\k<name> As Object( = Nothing)?", "${name} As Short", True, False, ""
'## PostProcess "(?<=05B1\): The '(?<name>dbl.*?)'.+\r?\n\t+Dim )\k<name> As Object( = Nothing)?", "${name} As Double", True, False, ""

Just another example of how super-flexible our VB Migration Partner can be Laughing



VB6 Migration LinkedIn group is now open

clock December 27, 2010 11:22

An interesting new feature for LinkedIn: discussion groups can now be public, so that their contents is visible to all Web surfers, searchable via Google, Bing, and other search engines, and sharable on other social network such as Twitter. (This is also for future posts, past discussions stay private)

We updated our VB6 Migration Linkedin group and opened it to even more people. See you there!

 



Welcome our new partner Datamatics Global Services

clock December 15, 2010 11:11

I am proud to announce our partnership with Datamatics Global Services, a leading service company with offices in US and India. Datamatics Global Services has an impressive success story and can claim over 10,000 man/years of software migration services.

The fact that such an experienced group of developers has choose Code Architects' VB Migration Partner as the main tool for converting VB6 to .NET is yet another confirmation of the high power and flexibility of our software.

Read more about our partners here.

 



Updated VB migration booklets

clock November 27, 2010 11:00

A couple months ago I posted about two e-books by David Ross Goben, a must-read for all serious developers facing a VB6-to-VB.NET migration task.

David just let us know that he has reviewed and updated his e-books with a lot new material.

You can download Navigating Your Way Through Visual Basic 6.0 to Visual Basic.NET Application Upgrades and  Visual Basic.NET Enhancements Compared to Visual Basic 6.0 e-books from SlideShare or Google Docs.



[NEW RELEASE] VB Migration Partner 1.32 is available

clock November 18, 2010 14:59

Earlier this week we made VB Migration Partner v.1.32 available to all registered users.

Unlike some competitors of ours, who attempt to generate hype by releasing a new major version every few months - and nevertheless are still far from matching the core functionality of VB Migration Partner - we prefer to stay with version 1.xx and yet adding new important features at every new release.

As with all previous versions, all the new features were inspired by customers' requests. In spite of this being a "minor" new release, the list of added features is really impressive:

  • Save time during the test stage with the new Trace-Match feature: you can now easily produce a trace both under VB6 and the converted VB.NET program, compare the two trace files, and quickly spot behavioral differences between the two. More info here.
  • the new SetOption ExcludeMethodBody pragma is an important addition that permits to migrate subsets of large VB6 projects. You can now convert projects with hundreds and hundreds forms and classes, by focusing on just 5 or 10 forms/classes each time. No more the dreaded "Too many compilation errors" warning!
  • the new PreProcess and PostProcess pragmas allow you automatically launch external programs before or after the migration, thus providing the ability to customize the converter's behavior with no need to create a specific extender. 
  • Partial support for the ObjPtr undocumented VB6 function
  • Partial support for the DrawMode property of Form, Picturebox, and UserControl objects. You can now do rubber-banding in .NET, no need for manual fixes!
  • Ability to export and save the contents of the Activity Log pane
  • Menus in MDI forms have been enhanced and now behave exactly as in VB6.
  • OLE drag-and-drop now works also between TreeView nodes, and we added support for the DropHighlight property of both TreeView and ListView controls
  • ... and counting.

As usual, all the details are in the VERSION HISTORY.TXT file that comes with the new setup, including the complete list of all the bugs that we caught since last release.

To download the new version, just lauch VB Migration Partner on a computer connected to the Internet: a message will alert you that a new version is available and will bring you to the download page on our website.



WE DID IT ! VB6 migration session at TechEd 2010 Europe

clock November 6, 2010 15:01

In my previous post I asked you to vote for my VB6-to-.NET Migration: Myths, Truths, and Real-World Experiences session at TechEd 2010 Berlin, so today I am very happy (and grateful) to announce that the session has been accepted. I will be speaking on Tuesday 9 November, 1.20 pm, in Hall 3.2 Interactive 6. Here's the session's abstract:

Microsoft official support for VB6 has expired in March 2009 yet there are many billions lines of VB6 code waiting to be converted to VB.NET. Many companies have postponed this step but it’s now time to take a decision. Should they convert their code with the help of a tool or rewrite everything from scratch? What about converting to a language other than VB.NET? In this informal talk we will discuss all the available options and talk about some real-world migrations.

Thanks to all of you who voted my session. If you attend TechEd, I hope to see you there!



Vote for a VB6 migration session at TechEd Europe 2010

clock October 14, 2010 16:45

I submitted a BoF session at TechEd Europe 2010, entitled "VB6-to-.NET Migration: Myths, Truths, and Real-World Experiences".

There is a poll on these Birds-of-Feathers sessions, and only the ones that get most votes will be accepted.

Regardless of whether you attend TechEd, you can help by voting for my session. In addition to having me speak at TechEd, a lot of votes on this session will hopefully convince Microsoft that VB6-to-.NET migration is a hot topic and that they should invest more in that direction.



Deliver error-free migrated apps faster with Trace-Match

clock October 8, 2010 13:45

We are very proud to announce that a new great feature will be introduced in forthcoming version 1.32.

Trace-Match is both a technical feature and a methodology to generate functional equivalent .NET application in less time and with less effort.

In a nutshell, from a technical perspective Trace-Match is the combination of the following elements:

  • a VB6 trace library (VB6TraceLib.dll) that allows you to determine what method is entered/exited, the value of your variables, the contents of controls, etc. It can send output to file or to any utility that can display debug data (e.g. SysInternal's DebugView utility), profile your code, and more. It even works correctly if a method is abruptly exited if an unhandled error occurs. You need to install this library only on the computer where you do your migrations.
  • a .NET trace library that works in the same way as the VB6 library. These .NET classes have been included in our main support library, therefore there is no need to distribute an additional DLL to your customers. As with the VB6 library, you can easily enable or disable tracing as it is more convenient for you.
  • two new commands in VB Migration Partner, which allow you to quickly insert and remove trace statements in any VB6 project or project group.

Trace-Match gives you two priceless benefits:

Full functional equivalence: by comparing the trace files produced by the original VB6 program and the migrated .NET application, you can have an "objective" evidence that the latter is 100% functionally equivalent to the original VB6 code. All you have to do is running a set of test cases against the VB6 and .NET executables, and using a file Diff utility such as WinMerge to verify that the trace files are identical.

Integrated debug features: if the converted .NET is being used by your customers or your collegues, you might want to leave trace enabled, so that you can easily see what went wrong if they notice a malfunctioning. If everything works fine, we even provide you with a simple Visual Studio macro that can remove all the trace statements from the .NET project.

We developed the Trace-Match methodology for internal use some time ago, and since them we have successfully used it to migrate many VB6 applications for our customers. By making Trace-Match available to all VB Migration Partner users, we are sure their productivity will dramatically increase. Read our whitepaper to learn more.

... and yes, you aren't going to find this great feature in any other VB6 conversion tool on the market! Cool



Basta! 2010 slides available

clock September 27, 2010 15:45

We just uploaded the two slide packs of my session at Basta! 2010 in Frankfurt, Germany.

VB6 to .NET Migration: Myth, Truth, and Real-World Experiences

VB6 to .NET Migration: Tips, Traps, and Techniques

Happy reading!



Two migration e-books all serious developers should read

clock September 17, 2010 10:51

In our quest to provide useful info to our users and readers, we periodically surf the Internet looking for articles, books, whitepapers, tools, etc. related to VB6 to .NET migration.

This week the search has been quite fruitful, and we have added two great items to our Articles page:

Navigating your way through Visual Basic 6.0 to Visual Basic.NET Application Upgrades
This 62-page e-book is one of the best collection of problems & solutions you can find on the Internet, with tons of detailed examples and code samples. It is obviously based on first-hand experience of the author with Microsoft Upgrade Wizard, and the solutions he proposes are valid and functional.

Visual Basic .NET Enhancements Compared to Visual Basic 6.
This e-book focuses on many differences between VB6 and VB.NET and in many cases it goes much deeper than the other articles mentioned in this page. It’s not the best place to start from when learning VB.NET, but it’s surely a must-read for the serious developer facing a complex migration project. (148 pages).

Both e-books are by David Ross Goben and are written in a clear and bright style. A must-read for all serious VB6 and VB.NET developers.

NOTE: Interestingly, virtually all the issues that David found when migrating his VB6 apps are handled automatically by our VB Migration Partner. (More on this in a subsequente post.)