View
946
Download
0
Category
Preview:
DESCRIPTION
Intro to Semantic Translation Tools Contact me for a live demo or proof of concept
Citation preview
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
• P-Code Tables– Operations– Expressions– Source Mappings
04/08/23 Copyright Great Migrations LLC 5
gmBasic 101
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)
• Rules for formatting – blank lines, comments, indenting, boilerplate code
• 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
• Create a Web Application Project
• Restructure Pages• Consolidate Declarative Script
to CodeBehind files• Translate Render Functions
to Response. Write in Codebehind Files
• Restructure #Include toWeb UserControls
• Translate VBScript to C# or VB.NET• Propagate COM replacements across
VB6/ASP as needed• Strong Typing everywhere• Deal with different semantics of
ASP intrinsic collections (Response, Request)
04/08/23 Copyright Great Migrations LLC 22
Source Code Analytics -- ASP
<%@ Language=VBScript %><%option explicit%><% Response.Buffer = true%><OBJECT RUNAT=server
PROGID=FMStocks_Bus.Ticker id=ObjAccount> </OBJECT><OBJECT RUNAT=server
PROGID=FMStocks_Bus.Broker id=ObjBroker> </OBJECT>...
<%...Function PlaceBuyOrder()
On Error Resume NextPlaceBuyOrder = 0 ' assume it fails 'this will be a long to represent the number of shares.Dim lngShares
'convert to a long incase of fractions of shares.lngShares= clng(Shares)
PlaceBuyOrder = ObjBroker.BuyStock(g_AccountID, Ticker, lngShares)if Err.number <> 0 or PlaceBuyOrder = 0 then MainPrompt = BUYSTOCK_PURCHASE_FAILED
' PlaceBuyOrder = 0 doesn't necessarily mean there was an error if Err.number <> 0 then
BuildErrorMessage() end if
Exit Functionend if
End Function...%>
Analytics-References Report
04/08/23 Copyright Great Migrations LLC 25
Great Migrations Methodology
The Great Migrations Methodology balances automated translation and other techniques
to improve the conversion process to deliver high quality results with less risk and less effort.
Balanced
04/08/23 Copyright Great Migrations LLC 26
Great Migrations Methodology
Preparation: organizing the source codebase, defining migration requirements.
Translation: converting the source codebase to the target codebase
Verification: inspecting the target codebase for functional an architectural quality
Cut Over: taking the target codebase through final testing and deployment to production
Iterative
PreparationSemantic
Translation
Verification
Cut-OverV B 6 /A S P .NET
Design
04/08/23 Copyright Great Migrations LLC 27
Great Migrations Methodology
Translate
Test
VB6/ASP/COMCodebase Run
Resolve Translation Issues
Resolve Build Issues
Resolve Architecture Issues
Resolve Functional Issues
.NET Code Level 1
.NET Code Level 2
Translation Tuning
Phase 1
.NET Code Level 3
.NET Production Code
Fit & Finish
Phase 2
UpgradeTool
Build
ArchitectureRequirements
Code QualityLevel 1: Translation CompleteLevel 2: Build CompleteLevel 3: Production Ready
04/08/23 Copyright Great Migrations LLC 28
Great Migrations Methodology
04/08/23 Copyright Great Migrations LLC 29
Great Migrations Methodology
Translation Tuning
Code SnapShot
Prepare
Translate
Verify
Iterate
Partial System Tests
Design
Conversion Guides
Revised Estimates
Deployment
Limited Deployment
Full Deployment
Conversion
Code SnapShot
CutOverTranslation System
Test
Fix & Finish Load
Test
Scope Set & Estimates Refined
Test Environment Established
DevFreeze
CutoverTranslation
DevThaw
UpgradeComplete
Readyfor Cutover
04/08/23 Copyright Great Migrations LLC 30
The Great Migrations Difference
Clean, Correct, Custom Translation
• Tools– Translation Solutions
– Choice of .Net Language
– Flexible Restructuring
– Multi-Project Capability
– Analytics
• Processes– Migration Methodology
– Automation
– Control
• People– Migration Expertise
Preparation
Translation
Verification
Cut Over
VB Codebase
.NET Codebase
MigrationStudio
ASPASPASP
VB
VBVB
VB VBVB
COM Framework .Net Framework
VB6/ASP Application Portfolio .NET Application Portfolio
promulaBasic
CustomConfiguration
ASP
ASPX ASPXASPX
.NET
.NET
.NET
.NET .NET.NET
ASPX
04/08/23 Copyright Great Migrations LLC 31
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 32
Thoughts?
Recommended