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

Post on 20-Aug-2015

1.350 Views

Category:

Technology

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Francesco Balena – Code Architects, Italy

VB6 Migration:Myth, truth, and real-world experiences

Me.About the Programming Microsoft

Visual Basic series

MSDN Regional director, Italy

VB Migration Partner

www.vbmigration.com

Code Architects Visual 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

glossaryconvert or migrateport & extendrewrite

“language impedance”functional equivalencestaged (phased) migrations

myth

automatic migration tools can’t really handle the complexity of VB6

“language 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

“language 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

“language 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

truth

rewriting from scratch can deliver the best quality code

( sad but true )

myth

rewriting from scratch always delivers the best quality code

truth

the sooner we start, the better

myth

the sooner we start, the better, therefore let’s 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 we’re ready to ship

myth

nearly all migration projects fail miserably

truth

nearly all migration projects fail miserably if they weren’t planned accurately

( like any software project... )

what you need, what you have• a goal

– what goes to .NET, what stays in VB6– architectural changes– target language, 3rd-party controls

• a migration tool (if any)• a deadline• a team

– VB & .NET expertise, familiarity with the code base, migration skills

the assessment step VB6 to VB.NET Upgrade Assessment Tool

http://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 Analyzer

http://www.vbmigration.com/Resources/VB6Analyzer.aspx

look at estimations with great suspect always prepare a Proof-of-Concept

truth

all .NET language are equally powerful, therefore it doesn’t really matter which language we select for our software projects

myth

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

VB.NET challenges

• Variants• Null propagation in expressions• ActiveX EXE components• Gosub, VarPtr, StrPtr, ObjPtr

C# challenges

• Variants• Null propagation in expressions• ActiveX EXE components• Gosub, VarPtr, StrPtr, ObjPtr• optional 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 doesn’t really matter whether we select VB.NET or C# in our migration projects

...unless you are paid by the hour

myth

migrated code runs slower than hand-written code

(half) truth

migrated apps should never use a support library

myth

migrated apps must never, ever use a support library

a support library can

• dramatically reduce compile and runtime errors

• closely mimic VB6 behavior and UI• hide the complexity of .NET• produce concise and neater code• optimize your app for size/speed• simplify bug fixes• offer interoperability with VB6 apps• ... (read more reasons here)

VB6 migration: myth, truth, and real-world experiences knowledge base, videos, code samples,

articles, links, and resources atwww.vbmigration.com

slides available atwww.slideshare.net/VBMigrationPartner

blogwww.vbmigration.com/blog

LinkedIn Group on VB6 Migrationwww.linkedin.com/groups?gid=3074090

Facebook Fan Page on VB6 Migrationfacebook.com/FrancescoBalenaOnVB6Migration

Get free advice Each 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

top related