strategic guidance
DESCRIPTION
Strategic Guidance for AVR ClassicTRANSCRIPT
Strategic Guidance for AVR Classic legacy
applications
Presented by:Roger Pence
Education Director, ASNA
2Copyright © 2012 by ASNA.
4:20
A critical legacy dependency
• Many customers have developed substantial Windows applications with AVR Classic
• These applications…– Have enterprise dependence– Have been very custom-tailored to solving
unique business problems– Are widely deployed and used– Are usually several years old
• Most of these customers have one simple question…
3Copyright © 2012 by ASNA.
4:20
Now what?
4Copyright © 2012 by ASNA.
4:20
There isn’t a magic answer!
• Alas, there isn’t a magic answer to the question
• The answer depends on what your needs and motives are for the application
• So, yes, there isn’t a magic answer, but there are answers!
5Copyright © 2010 by ASNA.
4:20
COM has served us long and well
• COM is old and getting older!– COM was introduced in 1993—it is 18 years old– AVR 1.0 was released in 1994—it is 17 years
old
• Migrating code from COM to .NET is very troublesome (more on this later)– MS offers no tools for migrating VB COM to
VB.NET
• COM has served us long and well, but its role in modern application development is rapidly diminishing
Copyright © 2012 by ASNA. 6
COM will be with us for a long time, but make no
mistake, the sun is clearly setting on COM
7Copyright © 2010 by ASNA.
4:20
COM is the programming equivalent of Mick Jagger…
• Both have been with us for a long time
• Both are old friends
• Both have worked very hard for us
• Both are really starting to show their age
• Clearly, both have reached the end of their prime!
Copyright © 2012 by ASNA. 8
COM then COM now
9Copyright © 2012 by ASNA.
4:20
This session’s mission
• What you should or shouldn’t do is very dependent on lots of issues
• We can’t give you the answer
• What we can do is share some potential answers
• You don’t have to do anything we suggest
• But…
Copyright © 2012 by ASNA. 10
You have to do something!
11Copyright © 2010 by ASNA.
4:20
A rational plan now…
• Protects you from needing to make hasty decisions
• Keeps you from reacting to events beyond your control
• Lets you act with a well-crafted strategy to prepare for the future
• You need a rational plan…now!
12Copyright © 2012 by ASNA.
4:20
ASNA’s 5 R strategy for future-proofing AVR Classic
apps1.Relax
2.Refine
3.Restrain
4.Reinvest
5.Reimagine
13Copyright © 2012 by ASNA.
4:20
Relax
• We do know that COM is in the winter of its life, but…– COM isn’t going away anytime soon
• MS has a good long-term strategy in place for your COM investment protection
• After all, MS has the same problem you do…– Legacy COM code. Lots of it.
Relax > Refine > Restrain > Reinvest > Reimagine
14Copyright © 2012 by ASNA.
4:20
Don’t overreact
• We feel it’s very important that you craft a good long-term strategy for your AVR Classic apps
• But you don’t need to do it before 8pm this evening!
• The COM click is ticking but it’s nowhere near its final count down
• You have time to think through your decisions before you make them
Relax > Refine > Restrain > Reinvest > Reimagine
15Copyright © 2012 by ASNA.
4:20
Leaving XP behind? Win7 has your back
• MS had big problems with COM interoperability with Vista—but has learned from those mistakes– MS built a great COM-escape hatch into
Windows 7– Each copy of Windows 7 offers a free XP virtual
machine
• Each copy of Win 7 includes an XP license for the Win 7 XP VM mode
• You can launch the entire XP VM or launch XP VM-specific shortcuts from the Win 7 host
Relax > Refine > Restrain > Reinvest > Reimagine
16Copyright © 2012 by ASNA.
4:20
Windows 7 Windows XP mode with Virtual PC in
action• Show Windows XP mode in action
• Getting Windows XP mode for Win 7– Download what you need here:
• You’ll need both Windows XP Mode and Windows Virtual PC
http://www.microsoft.com/windows/virtual-pc/
Relax > Refine > Restrain > Reinvest > Reimagine
Copyright © 2012 by ASNA. 17
http://www.microsoft.com/windows/virtual-pc/
18Copyright © 2010 by ASNA.
4:20
Windows XP Mode
• To surface XP shortcuts to your Win 7 host:– Create a folder named “Programs on the XP
VM” user c:\Documents and Settings\All Users\Start Menu
• Then create shorts to your EXEs and other files with the Shortcut wizard – Dragged and dropped shortcuts won’t work! – These shortcuts are then automatically
surfaced in your Win 7 host’s Start Menu– Installed programs automatically surface in the
Win 7 host’s Start Menu
Relax > Refine > Restrain > Reinvest > Reimagine
Copyright © 2012 by ASNA. 19
Windows XP Shortcut wizard is available from the Windows Explorer context menu.
20Copyright © 2012 by ASNA.
4:20
Refine
• Get your AVR Classic applications to code complete status as quickly as possible– The goal is to be able to say, “This version is
done, with no new features planned or to be available for it.“
– Fixes may be added, but no new code!
Relax > Refine > Restrain > Reinvest > Reimagine
Code complete: A release is called code complete when the development team agrees that no entirely new source code will be added to this release.
21Copyright © 2012 by ASNA.
4:20
Minimize third-party dependencies
• Third-party components represent a weak spot in your exposure of what might continue to work in the future– Mabry and Graph Control are gone – Minimize your use of third-party controls– Minimize your use of programming with the MS
Office COM objects—Office version dependencies are a huge source of moving code forward!
Relax > Refine > Restrain > Reinvest > Reimagine
22Copyright © 2012 by ASNA.
4:20
Understand COM <-> .NET interoperability
• COM and .NET do coexist nicely – AVR Classic apps can consume .NET DLLs quite
easily– .NET apps can consume AVR Classic DLLs with
just a little effort– This might help you leverage .NET work as you
make your Classic apps code complete
• Current .NET DG versions also support Classic
• Tim Jannsen’s .NET and AVR Classic Interoperability session covers this in detail
Relax > Refine > Restrain > Reinvest > Reimagine
23Copyright © 2012 by ASNA.
4:20
Restrain
• When you have your AVR Classic apps code complete, restrain yourself from changing them or adding new features to them!
• You have to draw a line in the sand between the old and new! – That must be a part of your strategy!
• Also, restrain yourself from writing anything new with AVR Classic!
Relax > Refine > Restrain > Reinvest > Reimagine
24Copyright © 2012 by ASNA.
4:20
Reinvest
• As you chart your corporate and personal course for life after COM, consider the training and skills you and your team need to acquire
• Chart a specific course to learn:– .NET in general– Web development (both server-side and client-
side)– SOA architecture– Windows forms alternatives (more on this in a
moment)– Database design
Relax > Refine > Restrain > Reinvest > Reimagine
25Copyright © 2012 by ASNA.
4:20
Learn about good application architectures
and patterns• Many of the apps built with AVR Classic
owe more to serendipity than to engineering and architecture
• The application lifecycle was – Code a little – Deploy a little– Goto TOP
• Today’s applications require more discipline and design—and the application of solid programming fundamentals
Relax > Refine > Restrain > Reinvest > Reimagine
26Copyright © 2012 by ASNA.
4:20
Invest in your team’s skills• Recommended books– Robert Martin – Clean Code– Steve McConnell – Code Complete (2nd Edition)– Douglas Crockford – JavaScript: The Good Parts– Elisabeth Freeman – Head First Design Patterns– Martin Fowler – Refactoring: Improving the
Design of Existing Code– Cwalina and Abrams – Framework Design
Guidelines
Relax > Refine > Restrain > Reinvest > Reimagine
27Copyright © 2012 by ASNA.
4:20
Invest in your team’s tools
• Source control– Subversion, Git, SourceGear Vault
• Automated build process– MS Build, PowerShell, Cruise Control, Team City
• Formal bug logging– Bugzilla, BugTracker.NET, Fogbugz
• Unit testing– nUnit, xUnit
Relax > Refine > Restrain > Reinvest > Reimagine
28Copyright © 2012 by ASNA.
4:20
Don’t make this mistake!
• Don’t consider the need to migrate or rewrite your AVR Classic app in .NET an opportunity to learn .NET
• It’s vital that you learn .NET first! – As you move your COM app to .NET you’ll need
to make many informed decisions on the .NET platform
– You can’t make good decisions until you know and understand .NET
Relax > Refine > Restrain > Reinvest > Reimagine
29Copyright © 2012 by ASNA.
4:20
Reimagine
• We built AVR Classic apps with several, nearly universal, practices:– Monolithic – no separation of concerns between
UI, logic, and IO– Global variables all over the place– Very busy event handlers– Little or no modularity– Applications were very stateful
• All of which are the polar opposite of what any modern software construction book recommends!
Relax > Refine > Restrain > Reinvest > Reimagine
30Copyright © 2012 by ASNA.
4:20
Reimagine• You have an opportunity now to either:– Create a long-term software asset or…– Write another legacy application heavily
dependent on a specific UI
• Which would you rather do?
• Before you rewrite, migrate, or build around your existing applications, stop and think a bit about their longer-term purpose
Relax > Refine > Restrain > Reinvest > Reimagine
31Copyright © 2012 by ASNA.
4:20
Pocket computers are changing everything
• Everyone in the room today has a computer in their pocket or purse! Maybe two.
• The redistribution of computer availability is changing everything
• Make no mistake: mobile enterprise doesn’t loom on the horizon– It’s here – It’s doable– It’s important– And your competition is doing it
Relax > Refine > Restrain > Reinvest > Reimagine
32Copyright © 2012 by ASNA.
4:20
What UI should you target?• You shouldn’t target any UI!
• Build non-UI dependent services so that separate UI layers are possible
• Who knows what UI you’ll be asked for next?– Win forms?– Web forms?– HTML/HTML5 for mobile?– Silverlight for a Win phone?– Native mobile for Android or iPhone or iPad?– WPF? – Windows 8 Metro?
Relax > Refine > Restrain > Reinvest > Reimagine
33Copyright © 2012 by ASNA.
4:20
Architecture of most AVR Classic apps today
• There is little, if any, separation between the UI, DB, and business logic layers
• All three layers are heavily embedded with each other
• Virtually impossible to factor out the UI
Relax > Refine > Restrain > Reinvest > Reimagine
34Copyright © 2012 by ASNA.
Beware: legacy code.
This software has
limited future value!
35Copyright © 2012 by ASNA.
4:20
Creating an application with discrete layers
Relax > Refine > Restrain > Reinvest > Reimagine
• Writing your apps in discrete layers makes it more flexible
• Here there is a very clear separation of concerns between the layers
36Copyright © 2012 by ASNA.
4:20
Adding support for Web forms
Relax > Refine > Restrain > Reinvest > Reimagine
• With business logic and DB access as discrete layers, it’s possible to write a separate layer UI for Web forms
37Copyright © 2012 by ASNA.
4:20
HTML/HTML5
Relax > Refine > Restrain > Reinvest > Reimagine
• Using HTML5 is a good, general purpose strategy for mobile development
• Apps run in mobile device’s browser
• CSS media queries help structure UI layout
38Copyright © 2012 by ASNA.
4:20
Silverlight on the Win phone
Relax > Refine > Restrain > Reinvest > Reimagine
• Silverlight and WPF may or may not make it generally
• But it’s looking like Silverlight will at least persist as the Win phone UI for the enterprise
39Copyright © 2012 by ASNA.
4:20
Maybe even native mobile
Relax > Refine > Restrain > Reinvest > Reimagine
• Writing native mobile apps is a pretty hefty gamble
• But if you need it, a layered software approach makes it possible
40Copyright © 2012 by ASNA.
4:20
A layered architecture makes it possible to say
“Yes”
Relax > Refine > Restrain > Reinvest > Reimagine
• Without a good layered architecture, you simple don’t have a “yes” option in your programming kit bag
41Copyright © 2012 by ASNA.
4:20
Who knows what’s next? Be prepared!
Relax > Refine > Restrain > Reinvest > Reimagine
• A layered architecture turns what would have otherwise been a legacy asset into a long-term software asset
42Copyright © 2012 by ASNA.
4:20
The AVR Upgrade Assistant
• If you are on maintenance, and own AVR 4.1 and AVR for .NET, there is an Upgrade Assistant (UA) available in AVR 4.1
• The operative word here is “Assistant”!
• The UA isn’t an application migration facility, but, for the right apps, it can help lay the groundwork for converting an AVR Classic app to .NET
Relax > Refine > Restrain > Reinvest > Reimagine
43Copyright © 2012 by ASNA.
4:20
The UA requires intermediate .NET
knowledge• Don’t assume that you can use the UA to
learn .NET—you can’t!
• You must be well-versed in both AVR for .NET and AVR Classic to get good UA results
• The UA only gets you started, you must make lots of decisions as you remediate the app—those decisions require .NET knowledge
Relax > Refine > Restrain > Reinvest > Reimagine
44Copyright © 2012 by ASNA.
4:20
UA issues• Third-party controls are troublesome– Beware: many COM controls companies are
now gone!
• MS Office dependencies
• OSFile and MiscCtrls dependencies
• The UA doesn’t map things to .NET that required controls or DLLs in AVR Classic– Date and time conversions– String operations– Edit words and edit codes
Relax > Refine > Restrain > Reinvest > Reimagine
45Copyright © 2012 by ASNA.
4:20
UA issues• Subfiles are troublesome to migrate well– And subfiles are at the heart of many
applications– We’ve tried twice to automate subfile
migration– The “subfile” model is so fundamentally
different in .NET
• DB connections aren’t localized in .NET– Special care must be taken to keep from
launching many OS/400 jobs with migrated code (or even slopping .NET from-scratch code)
• Win forms are the only target—no browser UI target
Relax > Refine > Restrain > Reinvest > Reimagine
46Copyright © 2012 by ASNA.
4:20
The UA might work for you
• The UA is good for very small, well-focused applications
• But for larger applications we’re not sure it’s the best long-term answer to the question
• The UA imposes a fixed model that might be troublesome to grow out of
• We know that it is very hard to automate COM to .NET migrations– MS long ago gave up doing so with VB6
to .NET
Relax > Refine > Restrain > Reinvest > Reimagine
47Copyright © 2012 by ASNA.
4:20
General advice summary
• COM isn’t going away anytime soon– Use Win 7 XP mode when necessary
• Finish your COM apps and then freeze them– Develop the discipline to not write any new
AVR Classic apps
• Start now building .NET services that replace or augment your AVR Classic apps– Give very serious thought to persisting the Win
forms model– Learning .NET is high on your to-do list
48Copyright © 2012 by ASNA.
4:20
General advice summary
• Start building tangential apps using those services to augment your AVR Classic apps– These are front-end apps—your services should
do the heavy lifting– Maybe start with a browser-based UI
• Don’t over-expect what the UA can do– It’s usefulness is rather narrow and specific– Understand its model – Learn .NET before you use the UA– Identify things AVR Classic is doing that .NET
does very differently