VB Migration Partner featured on Microsoft Corp's MSDN Flash newsletter

clock February 3, 2010 09:36

The title says it all.

You can read this month's issue of MSDN Flash Extras here:



Migration reports and ease of customization

clock January 19, 2010 06:24

One of the most powerful weapons to win the migration war is to produce significant and detailed reports both before and after the migration.

You need good reports before you even start the migration process to plan your effort, size your team, and provided a reasonable set of deadlines. You need them after you run the conversion software on a given VB6 project because you need to estimate the time needed to fix each individual compilation error and migration warning.

VB Migration Partner is quite versatile on the report side. In fact, it generates as many as seven different types of reports, including:

  • Migration issues and warnings – can be sorted by location or warning number
  • List of compilation errors - VB Migration Partner can automatically compile the generated VB.NET and display the compiler’s results inside the VB Migration Partner’s IDE
  • Assessment report – in the form of a customizable Excel spreadsheet that allows you to estimate the time and money needed to fix all migration warnings.
  • Code metrics – with information such as the size of each project/file, number of forms/controls, percentage of remarks, down to more sophisticated stats such as cyclomatic index (which gives you a measure of how long it takes to test the migrated code)
  • XML report – list of migration warnings and compilation errors in XML format, which is then easily imported in external program for further analysis, converted to HTML using a custom format, and so forth.

For a thorough description of each report, please read our “Migrating a VB6 application in 10 easy steps” whitepaper.

We are aware that the value of reports is even greater to companies who offer migration services based on our VB Migration Partner, because a comprehensive report is essential to prepare a detailed offer for the end user. For example, XML reports can be run in batch mode over all the VBP projects that make up an application. One of our largest customers is migrating an application with 1200+ projects, thus this report is a real lifesaver.

The beauty of XML reports is that they are produced by means of an extender DLL, written in plain VB.NET and whose source code is freely available to all registered users. Unlike other VB6 migration tools which are based on proprietary languages, VB Migration Partner can be easily extended by any .NET developer. This feature allows any developer to easily create custom reports that contain exactly the information they need.

Recently, one of our customers asked to extend XML reports to include code metrics and thus provide a mix of the last two report types outlined above. Well, it took less than one hour to tweak the extender’s source code and have the job done. This is what we mean by ease of customization.



[NEW RELEASE] Version 1.22 is available to registered users

clock December 22, 2009 01:59

We have just released VB Migration Partner v. 1.22. In addition to fixing a few minor problems with several controls - including the PictureBox, CommonDialog, and ListBox controls - this new releases further improves the VB6Variant class (which now behaves closer and closer to the original VB6 Variant type) and the support for DBCS character sets (Japanese users take note).

The portion of the translation engine has been improved and omit to generates many unnecessary warnings. More specifically, all previous versions of VB Migration Partner emit the 0354 warning when assigning a Variant or Object variable to a scalar variable, as in this example:

   Dim source As Object
   Dim
dest As Integer
   ' some statements here

   ' ...

   ' UPGRADE_WARNING #0354: Unable to read default member of symbol 'source'. Consider using the GetDefaultMember6 helper method."
   dest = source

Starting with version 1.22, if source is a Variant variable, VB Migration Partner uses a more sophisticated algorithm and checks whether the variable is ever the target of an assignment by means of a Set keyword. If it isn't the case, then VB Migration Partner omits the 0354 warning, because the source variable can only contain a scalar value and the GetDefaultMember6 helper method is never necessary. This smart behavior dramatically decreases the number of generated warnings that you have to carefully check to ensure that the VB.NET version behaves like the original VB6 code. In a medium-sized migration project, this feature alone can save you one or two days of review work.

As usual, registered users will be alerted that a new version is available the next time they fire up VB Migration Partner.



[CASE STUDY] SIS-Evolution becomes official Microsoft Corp case study

clock December 14, 2009 03:42

I am very glad and proud to announce that Microsoft Corp just published a world-wide case study based on the successful SIS-EVOLUTION migration project, of course based on VB Migration Partner.

The migration was carried out by SIS, an Austrian software company who converted a mission-critical Visual Basic 6 application counting 950,000 lines of code (LOCs) in about 9 months. It is noteworthy that the total effort included software selection, code review and refactoring tasks that weren't directly related to the actual migration stage.

It is interesting what SIS found during the software selection stage and the reason why they chose VB Migration Partner:

SIS evaluated six products before choosing VB Migration Partner. To ensure an auto-mated migration to the greatest possible extent, SIS conducted an inventory of the existing code base, identified critical and “difficult” functions, and identified 25,000 lines of code to run through each con-version tool. “It took 2.5 hours to get a project that would compile and run using VB Migration Partner, and 13 hours with the closest competitor,” says Wiegele. “VB Migration Partner also required 50 percent less rework to precisely duplicate the UI of the old application.

Thanks to VB Migration Partner, each of the three developers working on the project was able to correctly migrate around 50K LOCs per month, a number that confirms VB Migration Partner as the most productive and cost-effective VB6 conversion tool on the market.

This excerpt has to do with Code Architects' tech support:

While VB Migration Partner can be customized for even greater levels of efficiency, it’s noteworthy that SIS achieved its results using a standard, noncustomized copy of our software,” says Francesco Balena, Chief Executive Officer at Code Architects. “Thanks to our extensive online documentation and knowledge base, the only technical support SIS required was handled through a half-dozen e-mails.

Here's one more quote from SIS's Otto Wiegele, which emphasizes that VB Migration Partner's ability to closely reproduce the VB6 user interface saved the customer a lot of time and money, because no retraining was necessary:

SIS was able to ensure that all Visual Basic–related methods and controls work identically in the new application. VB Migration Partner prevented the incidental intro-duction of subtle differences in the application’s look and feel, enabling the client to minimize retraining of the system’s 350 users.

You can read the entire case study here.



11 false myths about support libraries

clock October 31, 2009 05:07

Some developers may be concerned about support library and would prefer not to distribute an additional DLL with their migrated apps. This is understandable, but we believe that these concerns are negligible if compared to the many advantages that a well-written, comprehensive library gives you.

Such benefits stand out so clearly that even our competitors can’t deny that an extensive library can speed up a migration project. To counter this evidence, however, they try to convince that a library has many shortcomings. Fortunately, we can easily prove that all these “issues” are groundless, as we do in our 17 reasons for using a support library in migration scenarios whitepaper.

The point is, a comprehensive support library is the key factor in achieving 100% functional equivalence and in keeping migration time and cost as low as possible. Just read what one of our customers has to say:

“An initial migration compared migration tools from six vendors. It showed superior results for VB Migration Partner, which delivered fewer compilation and runtime errors than all its competitors… It took 2.5 hours to get a compilable and runnable VB.NET project with VB Migration Partner, and 13 hours with its closest competitor.”

The higher productivity that a complete support library gives you is a sure fact, and our competitors haven’t found yet a way to obtain different results in similar rigorous productivity tests. In the absence of objective measurements, they attempt to scare potential customers away from VB Migration Partner by making vague statements about its supposed shortcomings.

These statements never mention VB Migration Partner or Code Architects, yet the target is undoubtedly our product because we are the only VB6 conversion software vendors who use an extensive support library:

1)    …other vendors charge a runtime fee for their support library.

FALSE! VB Migration Partner users can freely distribute its library with their apps.

2)    …other vendors don’t make their library’s source code available to customers.

FALSE! VB Migration Partner users can license the library’s code.

3)    … apps that rely on a support library might not work on future versions of the operating system.

FALSE! VB Migration Partner’s library is written in pure VB.NET and uses only documented features of the .NET Framework. As such, the library is guaranteed to work on all future Windows versions that support .NET Framework 3.5 binaries.

A closer examination reveals that this line of reasoning is illogical. Just for the sake of discussion, let’s assume that Microsoft releases a Windows or .NET Framework version breaks compatibility with existing .NET 3.5 programs. In such a highly unlikely case, your own VB.NET applications will stop working correctly and the support library will be the least of your problems.

A support library actually helps to preserve compatibility. Should a future version of Windows have minor problems in running .NET 3.5 code, Code Architects will promptly fix the problem and release a new support library that all users can download for free. You’ll still have to solve compatibility problems of your main app, but at least you don’t have to worry about the support library.

4)    …other vendors may charge a subscription fee for using the library in the future.

FALSE! VB Migration Partner’s EULA states that users will be allowed to download any future 1.xx version of the library at no additional cost. Future 1.xx releases include fixes for all the problems that might be discovered in the future by Code Architects or its customers.

5)    … if your migrated apps depend on a 3rd-party library, you might be in trouble if the vendor decides to stop supporting it in the future

FALSE! VB Migration Partner’s EULA states that – should Code Architects stop supporting the product – all customers will receive the library’s source code at no additional cost. In this respect, choosing Code Architects is as safe as, or safer than, choosing any 3rd-party control, such as the grid or the report component that you might be using in most of your forms.

6)    … a support library can slow down your code

FALSE! VB Migration Partner’s library is carefully optimized and often runs much faster than the code that most VB.NET or C# developers usually write, especially if they are put under pressure by near deadlines. For example, our VB6Collection class runs many times faster than the standard VB.NET Collection object, and our StringBuilder object allows you to automatically speed up string concatenations by a factor of 100x without having you modify the generated VB.NET code.

Keep in mind that VB Migration Partner’s library has been authored by a team of expert developers, including two Microsoft Regional Directors who have written 7 top-selling Microsoft Press books on VB and .NET programming, routinely give lectures in US and Europe, and consult for Microsoft and its largest customers.

7)    …other migration tools generate inefficient code that retains its VB6 flavor

FALSE! VB Migration Partner’s conversion engine uses very sophisticated refactoring techniques and generates code that takes full advantage of VB.NET features, including Try/Catch blocks, short-circuiting (the AndAlso operator), the IDisposable interface, variable initializes, compound operators (e.g. x += 1), and much more.

Interestingly, VB Migration Partner can apply many refactoring techniques that no other VB6 conversion tool currently supports, e.g. Gosub refactoring, Declare overloads, faster string concatenations inside loops, enforcement of ByVal keyword if possible. Our competitors should think twice before drawing developers’ attention to this point.

Finally, consider that VB Migration Partner’s developers wrote Practical Guidelines and Best Practices for VB and C# Developers (Microsoft Press), perhaps the definitive textbook on this topic, and VB Migration Partner’s generates code that abides to all those rules. Additionally, VB Migration Partner is able to rename members to comply with .NET coding guidelines. If you don’t like standard .NET rules you can easily customize the rename engine by modifying an XML file. No other conversion software supports customizable rename rules.

8)    …the code produced by other VB6 converters that adopt a support library is hard to maintain

FALSE! A support library can make your migrated code more readable and easier to maintain, as I demonstrated in a previous post.

9)    …projects produced by other VB6 converters are difficult to evolve

FALSE! VB Migration Partner library doesn’t limit you in any way, because all its classes inherit from native .NET classes and you can therefore leverage the .NET Framework full potential.

10)    …you can’t mix .NET native forms and controls with forms and controls defined in a support library

FALSE! After you’ve converted a VB6 project to VB.NET using VB Migration Partner, you can extend the application by adding .NET native forms, and you can drop .NET native controls onto a migrated form. The one thing you can’t do is using a control defined in our support library in a standard .NET form, an action that would be meaningless anyway.

11)    …you can’t use Visual Studio 2008 Test Wizard to generate unit tests for VB.NET projects that use a support library.

FALSE! We describe this apparent problem – and its solution - in this KB article.



[NEW VERSION] VB Migration Partner 1.21 has been released

clock October 23, 2009 09:03

We have just made VB Migratio Partner 1.21 available to all registered users.

The new version fixes a few minor bugs and adds some interesting features:

  • the TabEnable and TabVisible properties of the SSTab control
  • hotkeys in SSTab captions, and the ability to change the alignment of SSTab captions by means of the new TabCaptionAlignment property, so that you can perfectly emulate VB6 appearance if you wish
  • the new Collection6 class can optionally replace a plain Collection object if you want to preserve the VB6 semantics when adding arrays to a VB.NET collection
  • the code generator generates the correct code for Erase keywords that work on static arrays
In addition to these technical detais, we wanted to improve the user experience and reduce the need for our customers to contact our tech support. The first time you convert a VB6 project, VB Migration Partner 1.21 displays a message box that invites to generate a report for all the migration warnings and issues in the converted VB.NET project. This simple trick will help first-time users to correctly decode all migration messages and apply the right pragma to fix all most common issues.

As usual, registered customers will be alerted that there is a new version available the next time they run VB Migration Partner (provided that they have a working Internet connection, of course).



How support library REALLY affects long term code maintainability

clock October 23, 2009 04:05

VB6 and VB.NET are similar languages that differ for a myriad of major and minor details. Even keywords, methods, and controls that have the same name in both environments may have a completely different behavior, as we exhaustively show in our Resource section.

A tool that aims at preserving functional equivalence with the original VB6 code should account for all or at least the majority of these differences. All the VB6 conversion products on the market, including VB Migration Partner, fill this gap with a combination of these two elements:

  • code transformation techniques, to generate VB.NET code that behaves like the original VB6 code
  • support library that expose methods and controls that aren't found in the .NET Framework or in the Microsoft.VisualBasic namespace

Even the Upgrade Wizard included in Visual Studio, arguably the least sophisticated conversion tool around, relies on TWO support libraries - Microsoft.VisualBasic.Compatibility.dll and Microsoft.VisualBasic.Compatibility.Data.dll - to support VB6 features that have no direct correspondence in VB.NET, such as control arrays and the ADODC, DriveListBox, DirListBox, and FileListBox controls.

One of VB Migration Partner's strengths is its comprehensive support library. Its dozens of classes and hundreds of methods ensure that the generated VB.NET code always performs like the original VB6 app, an important factor in dramatically reducing the time and cost of the migration process. No other conversion tool comes with such a complete library and in fact no other conversion tool can compare to VB Migration Partner in its support for VB6 features.

Our competitors are aware of the many advantages of this approach, therefore some of them are adopting a twofold strategy: on one hand they are expanding *their* support library, on the other they publish strongly biased whitepapers where they claim that that extensive libraries compromise the maintainability of the generated VB.NET project.

Notice that VB Migration Partner is never explicitly mentioned in these documents, therefore authors don't feel compelled to back up their claims with any sort of evidence.

In this article I'll focus only on the supposed lack of readability and maintainability of converted VB.NET that use a support library. But unlike our competitors, I'll build my assertions on actual code snippets and compare the code that VB Migration Partner generates with the result from a “traditional” VB6 conversion tool that comes with a less powerful support library. Consider the following KeyPress handler written in VB6:

Private Sub Text1_KeyPress(KeyAscii As Integer)
   ' convert the pressed key to uppercase, but ignore spaces
   If KeyAscii = 32 Then KeyAscii = 0 : Exit Sub
   KeyAscii = Asc(Chr(KeyAscii))
End Sub

VB Migration Partner converts it as follows:

Private Sub Text1_KeyPress(ByRef KeyAscii As Short) Handles Text1.KeyPress
   ' convert the pressed key to uppercase, but ignore spaces
   If KeyAscii = 32 Then KeyAscii = 0 : Exit Sub
   KeyAscii = Asc(Chr(KeyAscii))
End Sub

The resulting VB.NET code is basically identical to the original code, and many VB6 developers understand how to read and maintain this code. Obviously there is no maintainability problem here.

Let’s see now the code produced by another conversion tool that doesn't rely on an extensive support library. The name the tool in question isn't really important, because the same concepts apply to any conversion tool that attempts to fill the gap between VB6 and VB.NET exclusively by means of code transformation techniques:

Private Sub Text1_KeyPress(ByVal eventSender As Object, _
      ByVal eventArgs As KeyPressEventArgs) Handles Text1.KeyPress
   Dim KeyAscii As Integer = Strings.Asc(eventArgs.KeyChar)
   ' convert the pressed key to uppercase, but ignore spaces
   If KeyAscii = 32 Then
      KeyAscii = 0
      If KeyAscii = 0 Then
         eventArgs.Handled = True
      End If
      Exit Sub
   End If

   KeyAscii = Strings.Asc(Strings.Chr(KeyAscii).ToString()(0))
   If KeyAscii = 0 Then
      eventArgs.Handled = True
   End If
   eventArgs.KeyChar = Convert.ToChar(KeyAscii)
End Sub

In the attempt to preserve functional equivalence of the original 3 statements inside the method, the tool generated as many as 13 (thirteen!!) statements. 

You might believe that the KeyPress event is a special and unique case, so let’s see another code snippet, a simple VB6 method that defines two optional parameters:

Public Sub TestOptional(Optional x As Variant, Optional y As Variant)
   If IsMissing(x) Then
      If IsMissing(y) Then
         x = 10
         y = 20
      End If
   End If
   MsgBox x * y
End Sub

This is how VB Migration Partner correctly translates it to VB.NET:

Public Sub TestOptional(ByRef Optional x As Object = MissingValue6, _
      ByRef Optional y As Object = MissingValue6)
   If IsMissing6(x) AndAlso IsMissing6(y) Then
      x = 10
      y = 20
   End If
   MsgBox6(x * y)
End Sub

Thanks to its support library, VB Migration Partner can generate code that is as readable and maintainable as the original VB6 method. Well, the generated code is actually more readable, because our software merged the two nested IFs, however this improvement is achieved by means of its sophisticated conversion engine and isn't a consequence of using a library.

Let’s now look at the code that our competitor's tool generates for the same method (for brevity's sake I removed 4 upgrade warnings):

Public Sub TestOptional(ByRef x_optional As Object, _
      ByRef y_optional As Object)
   Dim y As Object = Nothing
   If y_optional Is Nothing OrElse Not y_optional.Equals(Type.Missing) Then _
      y = TryCast(y_optional, Object)
   Dim x As Object = Nothing
   If x_optional Is Nothing OrElse Not x_optional.Equals(Type.Missing) Then _
      x = TryCast(x_optional, Object)

   Try
      If Not (x_optional Is Nothing) AndAlso _
         x_optional.Equals(Type.Missing) Then
         If Not (y_optional Is Nothing) AndAlso y_optional.Equals(Type.Missing) Then
            x = 10
            y = 20
         End If
      End If
      MessageBox.Show(CStr(CDbl(x) * CDbl(y)), Application.ProductName)
   Finally
      y_optional = y
      x_optional = x
   End Try
End Sub

Public Sub TestOptional(ByRef x_optional As Object)
   Dim tempRefParam As Object = Type.Missing
   TestOptional(x_optional, tempRefParam)
End Sub

Public Sub TestOptional()
   Dim tempRefParam2 As Object = Type.Missing
   Dim tempRefParam3 As Object = Type.Missing
   TestOptional(tempRefParam2, tempRefParam3)
End Sub

Now ask yourself: Which code would you like to maintain in the future? The concise adn readable 7-line method produced by VB Migration Partner or the 3 methods and 28 statements produced by the other tool?

Bottom line: never ever trust marketing literature that don't provide real-world examples and accurate comparisons.



A subtle collection behavior

clock October 21, 2009 17:09

Consider the following, apparently innocent piece of VB code:

' create and initialize an array
Dim arr(10) As Integer
arr(0) = 100
' store it into a collection
Dim col As New Collection
col.Add(arr)
' modify the array, compare with the array in the collection
arr(0) = 200
If arr(0) = col(1)(0) Then
    txtResult.Text = "Equal"
Else
    txtResult.Text = "Not equal"
End If

The question: what will be displayed in the txtResult control: "Equal" or "Not Equal?

Surprisingly, the correct answer is "It depends on the Visual Basic version you are using!" In fact, it displays "Not Equal" under VB6 and "Equal" under VB.NET.

In fact, when passing the array to the Collection.Add method, VB6 performs a copy of the array, therefore the subsequent assignment to arr(0) doesn't affect the copy already stored in the collection and the two arr(0) elements are now different. Vice versa, VB.NET passes a reference to the System.Array object, therefore there is only one array in memory and the assignment to arr(0) affects the same array as seen from the Collection.

This behavior can be the cause of a very subtle bug when converting a complex VB6 application to VB.NET, and neither Upgrade Wizard (included in Visual Studio) nor any VB6 conversion tool on the market can automatically solve this problem. The first time we bumped into this problem it took us hours to track it down, and we wanted to save our customers such headaches.

Once you see where the problem is, you can fix it by simply cloning the array being stored to the collection

        col.Add(arr.Clone())

VB Migration Partner also offers an alternative solution to this problem, in the form of the VB6Collection class, which offers this and several other enhancement over the Microsoft.VisualBasic.Collection object.



Software modernization company Transoft chooses VB Migration Partner

clock October 14, 2009 01:46

Transoft is a UK company that has a long tradition in software modernization. They offer both tools and services to migrate and modernize legacy apps written in Visual Basic, OpenVMS, IBM AS400, HP e3000, ICL VME, and others. They offer their products and services to both Europe and US and have an impressive list of achievements and customers of the caliber of DaimlerChrysler, DowChemical, and L'Oreal. 

Transoft is part of IRIS, a leading software company with over 1,000 employees worldwide. IRIS is the largest UK privately owned specialist software business with an exceptional reputation for delivering market leading solutions to more than 60,000 organizations, ranging from the micro to the multinational business and including major charities and membership organizations.

For all these reasons that we are VERY proud that, when looking for a software capable to automate most phases of the migration from VB6 and reduce migration time and cost, Transoft choosed Code Architects' VB Migration Partner over other similar and less powerful tools available on the market. 

If you are a US or UK company looking for a fast, cost-effective way to migrate and modernize your VB6 code, or just need support for your work with VB Migration Partner, you can contact Transoft or another of our partners that operate in your area.



[HOWTO] Fix ReDim statements that change the rank of an array

clock October 9, 2009 03:09

Not all developers know that VB6 permits to dynamically change the rank (i.e. the number of dimensions) of an array, as in this code snippet:

' this array can have 1 or 2 dimensions
Dim arr() As Integer
       
Sub InitArray(rank As Integer)
   Dim i As Integer, j As Integer
        
   If rank = 1 Then
      ReDim arr(100) As Integer
      For i = 1 To UBound(arr)
         arr(i) = i
      Next
   Else
      ReDim arr(100, 20)
      For i = 1 To UBound(arr, 1)
         For j = 1 To UBound(arr, 2)
            arr(i, j) = i * j
         Next
      Next
   End If
End Sub

VB.NET doesn’t allow you to change the rank of an array, therefore the converted VB.NET code would raise one instance of the following error:

Number of indices exceeds the number of dimensions in the indexed array

for each statement where the array is accessed with two indexes. These is no definitive solution to this problem, however VB Migration Partner allows you to significantly decrease the number of this compilation error, using a combination of pragmas:

    '## ParseReplace Dim arr() As Integer, arr2() As Integer
    Dim arr() As Integer
    '## arr2.ArrayRank 2
    '## PreProcess "arr(?=\([^,)]+,[^,)]+\))", "arr2"
    '## PreProcess "(?<=(LBound|UBound)\()arr(?=,)", "arr2"


An explanation of each pragma is in order. The ParseReplace pragma causes VB Migration Partner to realize that there are actually two arrays (arr and arr2) and the ArrayRank pragma specifies that arr2 is a 2-dimensional array. The first subsequent PreProcess pragma changes arr into arr2 if the array reference is followed by two indexes that are separated by a comma – as in arr(1,2)  - whereas the second PreProcess pragma changes array references that appear in LBound and UBound method calls. The result is this piece of error-free VB.NET code:

Private arr() As Short
Private arr2(,) As Short
    
Public Sub InitArray(ByRef rank As Short)
   Dim i As Short
   Dim j As Short
        
   If rank = 1 Then
      ReDim arr(100)
      For i = 1 To UBound6(arr)
         arr(i) = i
      Next
   Else
      ReDim arr2(100, 20)
      For i = 1 To UBound6(arr2, 1)     
         For j = 1 To UBound6(arr2, 2)
            arr2(i, j) = i * j
         Next
      Next
   End If
End Sub

This approach isn't bulletproof, though. In fact, it works only for array occurrences whose indexes aren't function calls. For example, it doesn't work in the following case:

      arr( GetIndex(1), GetIndex(2) )

However,  you can easily take care of these residual errors by means of additional ParseReplace or PreProcess pragmas.