Matrix Design Group – Mining Equipment Tracking System (VB6)
Matrix Design Group (MDG) designs, manufactures, and sells innovative technological products that help keep people safe. Their Mining Equipment Tracking System (METS) is a wireless communications, electronic tracking, and CO monitoring system. METS is widely used to help ensure the safety of underground coal mines in the USA. In this project Great Migrations (GM) provided tools and services to help MDG complete a Custom Upgrade of the METS product.
Baseline Metrics
Metric | Comments |
FILES | 180K LOC Logic and 26K LOC GUI in 331 Files |
BINARIES | 10 EXEs |
MEMBERS | 2,917 unique subprograms: 943 subroutines, 441 functions, 51 properties, 167 externs, 1,309 handlers, and 6 events. |
UI | 43 unique UI containers containing 2,504 instances of 37 different kinds of controls. |
COM | 6,688 calls to external COM components. |
WIN32 | 270 calls to 60 unique entry-point APIs from 13 libraries. Win32 API Calls are made from 132 different user procedures. |
Project Phases
GM assisted with the following three phases of the project:
- An Assessment, Definition, and Planning engagement
- A Standard Upgrade Phase resulting in an integrated, build-complete code of the entire system using a direct C# translation generated from the VB6 code and a C# stub framework generated for the external COM platform dependencies
- A Custom Upgrade Phase implementing over 20 custom upgrade features and providing a runnable .NET system ready for functional testing and optimization
We followed the Tool Assisted Rewrite Methodology. All three phases were completed in nine months with a staffing level of one part-time GM resource and one part-time client developer.
The Custom Upgrade Phase was conducted over a six months period and produced a Custom Upgrade Solution that could be used to automatically rewrite the METS codebase to C# applying all of the custom upgrade features listed above. On a fast Windows 10 development machine, the custom upgrade process runs, from start to finish, in about 30 seconds generating the 11 application projects and integrating them in a VS2019 solution.
Custom Upgrade Features
The collection of features integrated and delivered in the Custom Upgrade Solution are summarized below:
COM API/Control Upgrades
- ADODB: upgrade to System.Data and SqlClient [+]
- CCRPDTP6. ccrpDtp: upgrade to WinForms.DateTimePicker
- CCRProgressBar6.ccrpProgressBar: upgrade to WinForms.ProgressBar
- ccrpTimers6.Timer, StopWatch: upgrade WinForms.Timer to System.Diagnostics.StopWatch
- CPShapeL.ShapeLabel: uprade to MigrationSupport.ShapeControl
- MSComCtl.ListView: upgrade to WinForms.ListView
- MSComCtl.StatusBar: upgrade to WinForms.StatusBar [+]
- MSComCtl.TreeView: upgrade to WinForms.TreeView
- MSComCtl.ProgressBar: upgrade to WinForms.ProgressBar
- MSComCtl2.UpDown: upgrade to WinForms.NumericUpDown
- MSComDlg: upgrade to WinForms CommonDialog classes
- MSWinsockLib: upgrade sockets code to use System.Net.Sockets [+]
- OSSMTP_Plus: upgraded to System.Net.Mail [+]
- RichTextBox: upgrade to WinForms.RichTextBox
- Scripting: upgrade to System.IO
- TabDlg: upgrade to Winforms.TabControl [+]
- vbAcceleratorSGrid6: upgrade to WinForms.DataGridView [+]
[+] .NET classes and controls were extended for better compatibility providing cleaner application code
Language Upgrades
- Style: use optional parameters and named arguments
- VB.Shape: upgrade to MigrationSupport.ShapeControl
- VB.Line: upgrade to MigrationSupport.LineControl
- Drag and Drop: upgrade to .NET Drag and Drop
- Error handling: upgrade to Try/Catch; simplify On Error GoTo
- ByRef/ByVal: optimize parameter marshaling
- Variant/Object Type Inference: optimize
Structural Matters
- Shared Files Consolidation: consolidate over 44 shared files into a new assembly referenced from the generated application projects
- Remove unused content: remove unused/obsolete files, methods, and related content
- Integrate hand-coded content: replace 10 code files and 32 functions with hand-coded content
- VS2019 Solution: generate a solution file integrating the full application stack: 11 generated projects and 6 hand-coded .NET projects
Win32
- Replaced Win32 wrapper functions with functionally-equivalent hand-coded functions or reworked calling code to use intrinsic framework APIs
Value Added Features
- Rework inter-process communication for event logging
- Integrate with hand-coded .NET function library
- Accept 12 updates of the entire VB6 codebase. No code freeze was required; the VB6 codes were changing for maintenance and to improve translation results throughout the effort.
Tracy Hayford | Director of Technology – Chief Architect