简体   繁体   English

迁移VB6应用程序

[英]Migration of a VB6 application

Migation of a VB6 application to .NET platform is almost like a rewrite, no matter it is VB.NET or C#. VB6应用程序与.NET平台的结合几乎就像重写一样,无论是VB.NET还是C#。 Do you think it will require more effort to do it in Java platform, when compared to .NET platform, since it is a rewrite anyway? 与.NET平台相比,您是否认为在Java平台上进行此操作需要更多的努力,因为它无论如何都是重写? Please share your thoughts! 请分享你的想法!

No offence, but you are wrong. 没有冒犯,但你错了。 Porting to .Net is usually far easier than a rewrite. 移植到.NET是通常远比重写容易。

Here's the official advice from Microsoft UK : 以下是Microsoft UK的官方建议:

Performing a complete rewrite to .NET is far more costly and difficult to do well [than converting] ... we would only recommend this approach for a small number of situations. 对.NET执行完全重写要花费更多,并且难以做好[转换] ...我们只会在少数情况下推荐这种方法。

From a blog post by a Microsoft guy who consulted on rewrites: 来自微软咨询重写的人的博客文章

Many companies I worked with in the early days of .NET looked first at rewriting driven in part by a strong desire to improve the underlying architecture and code structures at the same time as they moved to .NET. 我在.NET早期工作的许多公司首先考虑的是重写,部分原因是他们在迁移到.NET的同时强烈希望改进底层架构和代码结构。 Unfortunately many of those projects ran into difficulty and several were never completed. 不幸的是,许多项目遇到了困难,有些项目从未完成。 The problem they were trying to solve was too large 他们试图解决的问题太大了

I recommend the following two steps in this order. 我按此顺序推荐以下两个步骤。

  1. Write down the reasons for migration or rewriting. 写下迁移或重写的原因。 What benefits will it bring? 它会带来什么好处? The benefits might be just to keep the development team happy - that might even be a good enough reason, I don't know. 好处可能只是为了让开发团队满意 - 这可能是一个足够好的理由,我不知道。 Make sure you know, and your managers/users agree. 确保您知道,并且您的经理/用户同意。
  2. Check out the Microsoft UK advice with a screencast explaining the 5 basic options for .Net migration. 通过截屏视频查看Microsoft UK 建议 ,解释.Net迁移的5个基本选项。 Decide which is best. 决定哪个是最好的。 It may be rewriting, but go into it with your eyes open. 它可能是重写,但睁着眼睛进入它。

In answer to your actual question: would a complete rewrite be easier in .Net or Java? 回答你的实际问题:在.Net或Java中,完全重写会更容易吗? That mainly depends on which one your team knows best. 主要取决于你的团队最了解哪一个。 It also depends a little on whether the application interacts with COM, just like SLaks says. 它还取决于应用程序是否与COM交互,就像SLaks所说的那样。

The effort of rewriting a VB6 app is more than just a question of which language you're targetting. 重写VB6应用程序的努力不仅仅是您要针对哪种语言的问题。 VB apps often rely on COM objects and certain VB-specific library methods which may not have equivalents in Java - but may have some portability in .NET. VB应用程序通常依赖于COM对象和某些特定于VB的库方法,这些方法可能没有Java中的等价物 - 但可能在.NET中具有一些可移植性。

Unless you are willing to abandon all of the dependences of the project, you may find .NET an easier target to re-write for , especially if you need to preserve some of the behavior of the existing application which derives from libraries or other dependencies. 除非您愿意放弃项目的所有依赖性,否则您可能会发现.NET更容易重写 ,特别是如果您需要保留现有应用程序的某些行为,这些行为源自库或其他依赖项。

Another consideration will be which platform your team is most familiar with - if you have a lot of Java expertise but little or no .NET expertise, then perhaps Java is a good choice for you. 另一个考虑因素是您的团队最熟悉的平台 - 如果您拥有大量的Java专业知识但很少或没有.NET专业知识,那么Java可能是您的不错选择。

There are tools available that will migrate from VB6 to VB .Net, including the one built into Visual Studio. 有些工具可以从VB6迁移到VB .Net,包括Visual Studio内置的工具。 This tool migrates VB6 to C#. 此工具将VB6迁移到C#。 Whatever tool you use, you will still need to do a lot of manual work on the code that the tool outputs, however this is likely to be less work than a complete java rewrite. 无论使用什么工具,您仍然需要对工具输出的代码进行大量手动工作,但这可能比完整的Java重写工作少。

Depending on your existing application's architecture, and how well the code is structured, you may decide it is better to completely re-design and rewrite it anyway, in which case there may not be much to choose between .Net and java. 根据您现有应用程序的体系结构以及代码的结构,您可能认为最好完全重新设计和重写代码,在这种情况下,.Net和java之间可能没有太多选择。

It is important to reduce not just the total effort during migration but also the cost of maintenance after migration. 重要的是不仅要减少迁移过程中的总工作量,还要减少迁移后的维护成本。 Many factors drive TCO, but all things being equal I think the .NET tools, community, framework, and C# language meet or beat Java in terms of developer productivity, operational managability, and performance -- assuming your are targeting windows OS. 许多因素推动了TCO,但在所有条件相同的情况下,我认为.NET工具,社区,框架和C#语言在开发人员生产力,操作可管理性和性能方面达到或超过Java - 假设您的目标是Windows操作系统。

I do not think ease of keeping COM should be the deciding factor either. 我不认为保持COM的容易性也应该是决定因素。 In fact, I think migrating VB6 to .NET but keeping COM when you do not have to defeats a critical purpose of doing a VB6 migration in the first place: to reduce development costs and risks by moving to a well-supported and viable platform. 事实上,我认为将VB6迁移到.NET,但是当你不必首先打破VB6迁移的关键目的时就保持COM:通过转移到一个支持良好且可行的平台来降低开发成本和风险。 I will tell you why: 我会告诉你为什么:

  • Most of the popular COM libraries and controls that were used with VB6 have not evolved in many years; 与VB6一起使用的大多数流行的COM库和控件多年来都没有发展过。 many of the smaller vendors have disappeared or if they are still supporting their wares, they now also offer new and improved .NET versions. 许多较小的供应商已经消失,或者如果他们仍在支持他们的产品,他们现在也提供新的和改进的.NET版本。

  • Living with old COM after migration means living with additional complexity in terms of debugging, builds, and deployment. 迁移后使用旧COM意味着在调试,构建和部署方面更加复杂。 Also beware that COM components do not really "speak" .NET (ie they do not use .NET types and conventions) so their use with .NET usually results in added complexity in the coding and design. 还要注意COM组件并不真正“说”.NET(即它们不使用.NET类型和约定),因此它们与.NET的使用通常会导致编码和设计的复杂性增加。

  • There still are a few hold-outs and exceptions to this rule and a .NET replacement is not the always best choice, but in general, migration teams will be able to find at least one .NET replacement option for almost every COM component they use. 这个规则仍有一些缺陷和例外,.NET替换并不总是最好的选择,但一般来说,迁移团队将能够为他们使用的几乎每个COM组件找到至少一个.NET替换选项。 Taking the time to thoughtfully evaluate, select and upgrade to one of those options will pay off after the migration. 花时间仔细评估,选择并升级到其中一个选项将在迁移后获得回报。

  • You will not want to interop anything that is VB6 you plan to migrate. 您不希望互换任何您计划迁移的VB6。 Interoping your own code will lead to a longer, complex transition and typically requires back-tracking and reworking/retesting already migrated codes. 干预您自己的代码将导致更长,更复杂的转换,并且通常需要对已迁移的代码进行反向跟踪和重新测试/重新测试。 Clearly this is not the most efficient and understandable upgrade path. 显然,这不是最有效和可理解的升级途径。

One more point about having to do "a lot of manual work on the output". 还有一点就是必须“对输出进行大量的手工操作”。 The Great Migrations product is a new, programmable migration tool. Great Migrations产品是一种新的可编程迁移工具。 It is designed to help migration teams incrementally improve the quality of generated code and thus reduce the manual work required to complete the migration project. 它旨在帮助迁移团队逐步提高生成代码的质量,从而减少完成迁移项目所需的手动工作。 This includes making the translations more correct, dealing with complex multi-VBP migrations, and also automating the restructuring of VB6/COM code to use .NET components. 这包括使翻译更正确,处理复杂的多VBP迁移,以及自动重构VB6 / COM代码以使用.NET组件。 These features are particularly helpful if the VB6 codebase is very large, changing frequently, and being significantly re-engineered and cleaned up during the migration. 如果VB6代码库非常大,频繁更改,并且在迁移期间进行了重新设计和清理,则这些功能特别有用。 This is an agile migration methodology we call the tool-assisted rewrite. 这是一种敏捷的迁移方法,我们称之为工具辅助重写。

Disclaimer: I work for Great Migrations. 免责声明:我为Great Migrations工作。

If the application uses COM, it will be far easier to rewrite it in .Net than in Java. 如果应用程序使用COM,那么在.Net中重写它比在Java中更容易。 Otherwise, it will probably be somewhat easier to port to .Net. 否则,移植到.Net可能会更容易一些。

For a more specific answer, please provide more details about your application. 有关更具体的答案,请提供有关您的申请的更多详细信息。

You could also use Jabaco it is a Java Bytecode compiler and it has it's own IDE and syntax very similar to VB6 (nearly the same). 您也可以使用Jabaco它是一个Java字节码编译器,它有自己的IDE和语法非常类似于VB6(几乎相同)。
You can find more information at: 您可以在以下位置找到更多信息
http://www.jabaco.org/ http://www.jabaco.org/
http://www.jabaco.org/board/ http://www.jabaco.org/board/

使用像ArtInSoft这样的迁移工具将其迁移到.NET。

You can migrate the VB 6 application using the in built VS migration to VB.Net. 您可以使用内置的VS迁移将VB 6应用程序迁移到VB.Net。 Try to see if that helps you. 试着看看这对你有帮助吗。 If you are looking at migrating VB 6 to C# then I would also recommend what ScaleOvenStove user has recommended. 如果您正在考虑将VB 6迁移到C#,那么我还会推荐ScaleOvenStove用户推荐的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM