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

28
Francesco Balena – Code Architects, Italy VB6 Migration: Myth, truth, and real-world experiences

Upload: vb-migration-partner

Post on 20-Aug-2015

1.350 views

Category:

Technology


6 download

TRANSCRIPT

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

Francesco Balena – Code Architects, Italy

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

Page 2: Basta! 2010 - VB6-to-NET 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

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

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

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

glossaryconvert or migrateport & extendrewrite

“language impedance”functional equivalencestaged (phased) migrations

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

myth

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

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

“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

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

“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

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

“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

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

truth

rewriting from scratch can deliver the best quality code

( sad but true )

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

myth

rewriting from scratch always delivers the best quality code

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

truth

the sooner we start, the better

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

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

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

myth

nearly all migration projects fail miserably

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

truth

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

( like any software project... )

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

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

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

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

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

truth

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

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

myth

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

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

VB.NET challenges

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

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

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

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

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); }

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

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

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

myth

migrated code runs slower than hand-written code

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

(half) truth

migrated apps should never use a support library

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

myth

migrated apps must never, ever use a support library

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

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)

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

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

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

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