basta! 2010 - vb6-to-net migration: myth, truth, and real-world experiences

Download Basta! 2010 - VB6-to-NET Migration: Myth, Truth, and Real-World Experiences

Post on 20-Aug-2015

1.347 views

Category:

Technology

6 download

Embed Size (px)

TRANSCRIPT

Speaker | Company

Francesco Balena Code Architects, ItalyVB6 Migration:Myth, truth, and real-world experiences1Me.About the Programming Microsoft Visual Basic series

MSDN Regional director, Italy

VB Migration Partner

www.vbmigration.com

2Code ArchitectsVisual Studio Industry Partner (VSIP)

the only Microsoft ISVNXT partner specialized in conversion and modernization of VB6 apps

customers in Europe, United States & Canada, Australia and Asia

dozens of millions of lines of code migrated

official Microsoft Case study published on Microsoft.com, ERP system of about 1M lines of code

3glossaryconvert or migrateport & extendrewrite

language impedancefunctional equivalencestaged (phased) migrations

4mythautomatic migration tools cant really handle the complexity of VB65language impedance data types type-char suffix Array lower bounds Optional params As New variables Byval argument passing Defxxx array rank missing As As Any parameters block variables date as double array assignments callbacks in Declare As New arrays UDT initialization Variants default parameterless members Gosub On Goto/GoSub Byref ParamArray Fixed-length strings UDT assignments byte-oriented string functions enum/number conversions IsMissing Empty value Null propagation VarPtr, ObjPtr, StrPtr class termination IDisposable objects default members in late-binding OLE control Line and Shape controls control arrays graphic methods ScaleMode property DrawMode property DAO and RDO data-binding ADO data-binding ADO data-bound classes DataEnvironment VBControlExtender object PropertyPages UserDocuments classic drag-and-drop OLE drag-and-drop Extender and Ambient properties DDE WebClasses DHTML Pages Sub Main in DLLs SingleUse classes Global classes COM+ components class persistence Print and Printers App, Screen, Forms objects ActiveX EXEs popup menus

6language impedance (UW) data types type-char suffix array lower bounds Optional params As New variables Byval argument passing Defxxx array rank missing As As Any parameters block variables date as double array assignments callbacks in Declare As New arrays UDT initialization Variants default parameterless members Gosub On Goto/GoSub Byref ParamArray Fixed-length strings UDT assignments byte-oriented string functions enum/number conversions IsMissing Empty value Null propagation VarPtr, ObjPtr, StrPtr class termination IDisposable objects default members in late-binding OLE control Line and Shape controls control arrays ScaleMode property DrawMode property DAO and RDO data-binding ADO data-binding ADO data-bound classes DataEnvironment VBControlExtender object PropertyPages UserDocuments classic drag-and-drop OLE drag-and-drop Extender and Ambient properties DDE WebClasses DHTML Pages Sub Main in DLLs SingleUse classes Global classes COM+ components class persistence Print and Printers App, Screen, Forms objects ActiveX EXEs popup menus

7language impedance (VBMP) data types type-char suffix array lower bounds Optional params As New variables Byval argument passing Defxxx array rank missing As As Any parameters block variables date as double array assignments callbacks in Declare As New arrays UDT initialization Variants default parameterless members Gosub On Goto/GoSub Byref ParamArray Fixed-length strings UDT assignments byte-oriented string functions enum/number conversions IsMissing Empty value Null propagation VarPtr, ObjPtr, StrPtr class termination IDisposable objects default members in late-binding OLE control Line and Shape controls control arrays graphic methods ScaleMode property DAO and RDO data-binding ADO data-binding ADO data-bound classes DataEnvironment VBControlExtender object PropertyPages UserDocuments classic drag-and-drop OLE drag-and-drop Extender and Ambient properties DDE WebClasses DHTML Pages Sub Main in DLLs SingleUse classes Global classes COM+ components class persistence Print and Printers App, Screen, Forms objects ActiveX EXEs popup menus

8truth

rewriting from scratch can deliver the best quality code

( sad but true )9myth

rewriting from scratch always delivers the best quality code

10truththe sooner we start, the better

11myththe sooner we start, the better, therefore lets run the Upgrade Wizard, remove all compilation errors, debug the .net code, do some tests, fix bugs, polish the UI, create the setup, write the manual, and tell the boss were ready to ship

12myth

nearly all migration projects fail miserably

13truth

nearly all migration projects fail miserably if they werent planned accurately

( like any software project... )

14what you need, what you havea goalwhat goes to .NET, what stays in VB6architectural changestarget language, 3rd-party controlsa migration tool (if any)a deadlinea teamVB & .NET expertise, familiarity with the code base, migration skills

15the assessment step VB6 to VB.NET Upgrade Assessment Toolhttp://www.microsoft.com/downloads/details.aspx?FamilyId=10C491A2-FC67-4509-BC10-60C5C039A272&displaylang=en VB6 Code Advisorhttp://msdn2.microsoft.com/en-us/vbrun/ms789135.aspx VB6 Bulk Analyzerhttp://www.vbmigration.com/Resources/VB6Analyzer.aspx

look at estimations with great suspectalways prepare a Proof-of-Concept

16truth

all .NET language are equally powerful, therefore it doesnt really matter which language we select for our software projects17myth

all .NET language are equally powerful, therefore it doesnt really matter whether we select VB.NET or C# in our migration projects

18VB.NET challengesVariantsNull propagation in expressionsActiveX EXE componentsGosub, VarPtr, StrPtr, ObjPtr

C# challengesVariantsNull propagation in expressionsActiveX EXE componentsGosub, VarPtr, StrPtr, ObjPtroptional parameters (fixed in 2010)late binding (almost fixed in 2010)error handling

C# challengesOn Error Resume NextDoSomething(x)If CheckExpr(x) Then DoSomethingElse(x)

try { DoSomething(x); }catch (Exception ex) { SetError(ex); }bool test;try { test = CheckExpr(x); }catch (Exception ex) { SetError(ex); }try { if (test) DoSomethingElse(x); }catch (Exception ex) { SetError(ex); }

myth (revised)

all .NET language are equally powerful, therefore it doesnt really matter whether we select VB.NET or C# in our migration projects

...unless you are paid by the hour

22mythmigrated code runs slower than hand-written code23(half) truthmigrated apps should never use a support library24mythmigrated apps must never, ever use a support library25a support library candramatically reduce compile and runtime errorsclosely mimic VB6 behavior and UIhide the complexity of .NETproduce concise and neater codeoptimize your app for size/speedsimplify bug fixesoffer interoperability with VB6 apps... (read more reasons here)

26VB6 migration: myth, truth, and real-world experiencesknowledge base, videos, code samples, articles, links, and resources atwww.vbmigration.comslides available atwww.slideshare.net/VBMigrationPartnerblogwww.vbmigration.com/blogLinkedIn Group on VB6 Migrationwww.linkedin.com/groups?gid=3074090Facebook Fan Page on VB6 Migrationfacebook.com/FrancescoBalenaOnVB6Migration

27Get free adviceEach VB6 application is different and creates unique challenges in the migration to .NET.

To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file.

You will receive a detailed report on your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.www.vbmigration.com/getfreeadvice.aspx

28