06/06/22 Copyright Great Migrations LLC 1 Meeting Objectives • Your Objectives – Understand the challenges of migrating VB6/ASP/COM to .NET – Understand the role of translation technology as part of a .NET adoption effort. – Understand the tool-assisted approach to Migration. • Great Migrations’ Objectives – Educate you on the challenges of migrating VB6/ASP/COM to .NET and potential solutions – Help you get started!
Intro to Semantic Translation Tools Contact me for a live demo or proof of concept
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
04/08/23 Copyright Great Migrations LLC 1
Meeting Objectives
• Your Objectives– Understand the challenges of migrating
VB6/ASP/COM to .NET– Understand the role of translation technology as part of a
.NET adoption effort. – Understand the tool-assisted approach to Migration.
• Great Migrations’ Objectives– Educate you on the challenges of migrating
VB6/ASP/COM to .NET and potential solutions– Help you get started!
04/08/23 Copyright Great Migrations LLC 2
• gmBasic 101
• Technical Demonstration– A Sample VB6 Application
– Demo: Migration to C# / VB.NET
– Demo: Source Code Analytics
– Demo: Source Code Restructuring
• The Great Migrations Methodology– The Tool Assisted Re-Write
• Wrap Up
Agenda
04/08/23 Copyright Great Migrations LLC 3
Comprehensive Semantic System Model
gmBasic 101
What is gmBasic?
A highly configurable, robust VB6/ASP/COM compiler
that produces source codes instead of binaries.
How does it work?
– Compiler: Builds a comprehensive semantic model of the codebase implementation.
– Analyzer: evaluates and restructures the model to fit the desired architecture patterns.
– Author: processes the optimized model to generate clean, correct code that meets custom standards and conventions.
Compiler Analyzer! Author
04/08/23 Copyright Great Migrations LLC 4
gmBasic 101
Semantic Model• Symbol Trees
– External Components– Language Elements– Source Structures
Assertions• Solving the semantics problem is the key
• Semantic translation can be achieved systematically by combining linguistic theories for natural language processing with proven principles of compiler and interpreter design
• Source and target language/syntax differences are trivial in comparison to runtime differences
04/08/23 Copyright Great Migrations LLC 6
gmBasic 102
Compiler
• Preparation– Load Language Description
– Load Source Codes
– Load Interface Descriptions
• Recognition– Pass 1: create symbol tables of all
identifiers in the codebase
– Pass 2: create initial semantic model of all low level operations performed by each codeblock.
Compiler
Analyzer!
Author
InitialSemantic
Model
SourceCodes
Config
04/08/23 Copyright Great Migrations LLC 7
gmBasic 102
Analyzer
• Interpretation– Type Inference
– Coding Analysis
• Restructuring– Create Migrated
Semantic Model
– Add/Remove/Change Operations
– Optimizations/Cleanup
– API Replacements
Compiler
Analyzer!
Author
Migrated Semantic
Model
Config
04/08/23 Copyright Great Migrations LLC 8
gmBasic 102
Author • Code Generation
– String Machine
– Executes the migrated model
• Reporting
– Boilerplate
– File Deployment Instructions
Compiler
Analyzer!
Author Migrated Symbol Tables
Migrated Semantic Model
Config
TargetCodes
04/08/23 Copyright Great Migrations LLC 9
Demo: Overview
• A Sample Application• VB6 to C#, VB6 to VB.Net (externs interoped)• VB6 to C#, VB6 to VB.Net (externs taken to .Net)• Look at Code, Build, Report, Run
MigrationToolset
LanguageConfig
InterfaceConfig
VB6COM
VB.NetManaged
VB.NetInterop
C# Interop
C#Managed
04/08/23 Copyright Great Migrations LLC 10
A Sample VB6 Application: ScanTool
• Two VBPs: UI.exe and LIB.dll• Lib talks back to UI via events• 4 External COM APIs• Win32 APIs• Many VB Intrinsics• Object Polymorphism• Error Handling• Over 2000 LOC
ScanToolUI
ScanToolLib
COMScripting
COMMSXML
COMTypelib
Info
COMCommon
Dialog
04/08/23 Copyright Great Migrations LLC 11
Project References Report
Project Structure Report
ScanTool Metrics
• Project Structure– A very crude metric– Conceptual Design– Completeness– Iceberg Report
• Project References– Rough idea of
external dependencies
– Some Internals Details
• VB6 Build Test
04/08/23 Copyright Great Migrations LLC 12
– Migration Set: DemoScanTool
– Dialect = C# (csh)
– Migration Mode = std
– Run Translation
– Deploy Translation
– Build Translation
– Inspect Translation
– Run ScanTool.NET
Demo: Migration to C#
gmStudio
04/08/23 Copyright Great Migrations LLC 13
– Migration Set: DemoScanTool
– Dialect: VB.Net (vbn)
– Migration Mode = std
– Run Translation
– Deploy Translation
– Build Translation
– Inspect Translation
– Run ScanTool.NET
Demo: Migration to VB.Net
04/08/23 Copyright Great Migrations LLC 14
Analytics-References Report
Source Code Analytics
• What really matters:– How you actually use
COM/VB6 APIs
AND– How you intend to
replace them on the new platform.
• All API replacements are NOT created equal!
04/08/23 Copyright Great Migrations LLC 15
Scrrun.dll.xml
Source Code Restructuring
Managed Interface Descriptions
• Template Generated from COM
• Map source API to target API
MSXML4.dll.xml
MigrationToolset
LanguageConfig
InterfaceConfig
VB6COM
VB.NetManaged
VB.NetInterop
C# Interop
C#Managed
04/08/23 Copyright Great Migrations LLC 16
Demo: Source Code Restructuring
ScanToolUI
ScanToolLib
.NETSystem
.IO
.NETSystem
.Xml
COMTypelib
Info
COMCommon
Dialog
04/08/23 Copyright Great Migrations LLC 17
• Rules for mapping of COM/Win32 APIs to .NET replacements
• Rules for mapping ASP/VB6 coding patterns to .NET coding patterns
• Processing order for a multi-component translation
• Instructions to address problems or anomalies in the source codes
• Rules for target file names, folder names, etc.
• Rules for target Visual Studio project files (resx, assemblyinfo, *proj)
• Special processing instructions that control details of translator operation
Sidebar: Translation Flexibility
04/08/23 Copyright Great Migrations LLC 18
Demo: BuildSet
BuildSet (n): A collection of VB6 code and COM binaries migrated to .NET such that the VB6 code becomes .NET code and the COM binaries become 100% managed code (a prototype object model). This is a good starting point for teams that want to avoid COM interop while preserving the general aspects of their original design.
MigrationToolset
LanguageConfig
InterfaceConfig
VB6CODE
COMExternals
BuildSet
.NetCode
.NETStubs
Interop
04/08/23 Copyright Great Migrations LLC 19
Sample 2: A Web Application
• Six VBPs (2500 LOC)– 2 VBPs Data Access– 4 VBPs Business Objects
• 33 ASP pages (2300 LOC)– 5 includes (nested and stacked)– 28 pages
• Poster Child DNA Web App– Portfolio Management– Research/Buy/Sell Stocks– On-line Store– Forms-based Login
Web Pages (ASP/VBS)
Business Objects
Data Access Objects(ADODB)
Stored ProcsSQL Server
04/08/23 Copyright Great Migrations LLC 20
Project References Report
Project Structure Report
FMStocks Metrics
• Project Structure– A very crude metric– Naming Standards– Completeness– May reveal some
design concepts
• Project References– Rough idea of external
dependencies– Some Internals Details– May reveal design
• VB6 Build Test
04/08/23 Copyright Great Migrations LLC 21
Demo: Migrating ASP to ASP.Net
ASP is quite different from VB6• Include Files• VBScript nuances• Most COM References are implicit• Weak typing everywhere
What can we do today?• Produce clean, correct ASP.NET