简体   繁体   English

将PowerBuilder应用程序移植到.NET

[英]Porting a PowerBuilder Application to .NET

Does anyone have any advice for migrating a PowerBuilder 10 business application to .NET? 有没有人有任何建议将PowerBuilder 10业务应用程序迁移到.NET?

My company is considering migrating a legacy PB application to .NET (C#) and I am just wondering if anyone has any experience - good or bad - that you would like to share. 我的公司正在考虑将传统的PB应用程序迁移到.NET(C#),我只是想知道是否有人有任何经验 - 好的或坏的 - 你想分享。

The application is rather large with 10 PBL libraries, some PFC as well as custom frameworks. 该应用程序相当大,包含10个PBL库,一些PFC以及自定义框架。 There are a large number of DLL calls being made as well. 还有大量的DLL调用。 Finally, it uses a Microsoft SQL Server database. 最后,它使用Microsoft SQL Server数据库。

We have discussed porting the "core" application code to .NET and then porting more advanced functionality across as-needed. 我们已经讨论过将“核心”应用程序代码移植到.NET,然后根据需要移植更高级的功能。

When I saw the title, I was just going to lurk, being a renowned PB bigot. 当我看到这个头衔时,我只是潜伏着,成为着名的PB bigot。 Oh well. 那好吧。 Thanks for the vote of confidence, Bernard. 感谢Bernard的信任投票。

My first suggestion would be to ditch the language of self-deception. 我的第一个建议是放弃自欺欺人的语言。 If I eat half of a "lite" cheesecake, I'm still going to lose sight of my belt. 如果我吃一半“精简”芝士蛋糕,我仍然会看不到我的皮带。 A migration can take as little as 10 minutes. 迁移只需10分钟。 What you'll be doing is a rewrite . 你要做的是改写 The time needs to be measured as a rewrite. 需要作为重写要被测量。 The risk needs to be measured as a rewrite. 风险需要作为重写来衡量。 And the design effort should be measured as a rewrite. 设计工作应该作为重写来衡量。

Yes, I said design effort. 是的,我说设计工作。 "Migrate" conjures up images of pumping code through some black box with a translation mirroring the original coming out the other side. “迁移”通过一些黑盒子让人联想到泵送代码的图像,翻译镜像原来的另一面。 Do you want to replicate the same design mistakes that were made back in 1994 that you've been living with for years? 你想复制1994年你曾经生活多年的同样的设计错误吗? Even with excellent quality code, I'd guess that excellent design choices in PowerBuilder may be awful design choices in C#. 即使有优质的代码,我猜想PowerBuilder中出色的设计选择可能是C#中糟糕的设计选择。 Does a straight conversion neglect the power and strengths of the platform? 直接转换会忽略平台的强大功能吗? Will you be living with the consequences of neglecting a good C# design for the next 15 years? 你将忽略一个很好的C#设计,为未来15年的生活后果?


That rant aside, since you don't mention your motivation for moving "to .NET," it's hard to suggest what options you might have to mitigate the risk of a rewrite. 除此之外,由于你没有提到你转向“.NET”的动机,因此很难说明你可能有哪些选择来降低重写的风险。 If your management has simply decided that PowerBuilder developers smell bad and need to be expunged from the office, then good luck on the rewrite. 如果您的管理层只是认为PowerBuilder开发人员闻起来很糟糕并且需要从办公室中删除,那么祝您好运。

If you simply want to deploy Windows Forms, Web Forms, Assemblies or .NET web services, or to leverage the .NET libraries, then as Paul mentioned, moving to 11.0 or 11.5 could get you there, with an effort closer to a migration. 如果您只是想部署Windows窗体,Web窗体,程序集或.NET Web服务,或者利用.NET库,那么正如Paul所说,迁移到11.0或11.5可以帮助您实现迁移。 (I'd suggest again reviewing and making sure you've got a good design for the new platform, particularly with Web Forms, but that effort should be significantly smaller than a rewrite.) If you want to deploy a WPF application, I know a year is quite a while to wait, but looking into PowerBuilder 12 might be worth the effort. (我建议再次检查并确保你已经为新平台设计了一个好的设计,特别是使用Web Forms,但是这个工作应该比重写要小得多。)如果你想部署一个WPF应用程序,我知道一年是等待很长一段时间,但是看看PowerBuilder 12可能是值得的。 Pulled off correctly, the WPF capability may put PowerBuilder into a unique and powerful position. 正确拉出,WPF功能可能使PowerBuilder成为一个独特而强大的位置。

If a rewrite is guaranteed to be in your future (showers seem cheaper), you might want to phase the conversion. 如果保证将来重写(淋浴似乎更便宜),您可能希望逐步进行转换。 DataWindow.NET makes it possible to to take your DataWindows with you. DataWindow.NET使您可以随身携带DataWindows。 (My pet theory of the week is that PowerBuilder developers take the DataWindow for granted until they have to reproduce all the functionality that comes built in.) Being able to drop in pre-existing, pre-tested, multi-row, scrollable, minimal resource consuming, printable, data-bound dynamic UI, generating minimal SQL with built-in logical record locking and database error conversion to events, into a new application is a big leg up. (我本周的宠物理论是,PowerBuilder开发人员认为DataWindow是理所当然的,直到他们必须重现内置的所有功能。)能够放入预先存在的,预先测试的,多行的,可滚动的,最小的资源消耗,可打印,数据绑定的动态UI,生成最小的SQL,内置逻辑记录锁定和数据库错误转换为事件,进入新的应用程序是一个很大的问题。

You can also phase the transition by converting your PowerBuilder code to something that is consumable by a .NET application. 您还可以通过将PowerBuilder代码转换为.NET应用程序可以使用的代码来分阶段转换。 As mentioned, you can produce COM objects with the PB 10 you've got, but will have to move to 11.0 or 11.5 to produce assemblies. 如上所述,您可以使用您已获得的PB 10生成COM对象,但必须移至11.0或11.5才能生成程序集。 The value of this may depend on how well partitioned your application is. 这个值可能取决于您的应用程序的分区程度。 If your business logic snakes through GUI events and functions instead of being partitioned out to non-visual objects (aka custom classes), the value of this may be questionable. 如果您的业务逻辑通过GUI事件和函数进行窃取而不是被分区到非可视对象(也称为自定义类),那么这个值可能会有问题。 Still, this is a design faux pas that should probably be fixed before a full conversion to C#; 不过,这是一个设计失礼应可能是一个完全转化为C#前固定; this is something that can be done while still maintaining the PowerBuilder application as a preliminary step to a phased and then a full conversion. 这是可以完成的,同时仍然将PowerBuilder应用程序作为分阶段然后完全转换的初步步骤。

No doubt I'd rather see you stay with PowerBuilder. 毫无疑问,我宁愿看到你留在PowerBuilder。 Failing that, I'd like to see you succeed. 如果做不到这一点,我希望看到你成功。 Just remember, once you take that first bite, you'll have to finish it . 请记住,一旦你吃了第一口, 你就必须完成它

Good luck finding that belt, 祝好运找到腰带,

Terry. 特里。


I see you've mentioned moving "core components" to .NET to start. 我看到你提到将“核心组件”移动到.NET开始。 As you might guess by now, I think a staged approach is a wise decision. 正如你现在可能猜到的那样,我认为分阶段的方法是一个明智的决定。 Now the definition of "core" may be debatable, but how about a contrary point of view. 现在,“核心”的定义可能是有争议的,但如何相反的观点。 Food for thought? 深思熟虑? (Obviously, this was the wrong week to start a diet.) Based on where PB is right now, it would be hard to divide your application between PB and C# along application functionality (eg Accounts Receivable in PB, Accounts Payable in C#). (显然,这是错误的一周开始节食。)根据PB现在的位置,很难在应用程序功能上划分PB和C#之间的应用程序(例如PB中的应收帐款,C#中的应付帐款)。 A division that may work is GUI vs business logic. 可能有效的部门是GUI与业务逻辑。 As mentioned before, pumping business logic out of PB into executables C# can consume is already possible. 如前所述,将业务逻辑从PB中抽入C#可以消耗的可执行文件已经成为可能。 How about building the GUI in C#, with the DataWindows copied from PB and the business logic pumped out as COM objects or assemblies? 如何在C#中构建GUI,从PB复制DataWindows并将业务逻辑作为COM对象或程序集抽出? Going the other way, to consume .NET assemblies in PB, you'll either have to move up to 11.x and migrate to Windows Forms, or put them in a COM callable wrapper . 换句话说,要在PB中使用.NET程序集,您要么必须升级到11.x并迁移到Windows窗体,要么将它们放在COM可调用包装器中

Or, just train your C# developers in PowerBuilder. 或者,只需在PowerBuilder中培训您的C#开发人员。 This just may be a rumour, but I hear the new PowerBuilder marketing tag line will be "So simple, even a C# developer can use it." 这可能只是一个谣言,但我听说新的PowerBuilder营销标签将是“如此简单,即使是C#开发人员也可以使用它”。 ;-) ;-)

I think gbjbaanb gave you a good answer above. 我想gbjbaanb给了你一个很好的答案。

Some other questions worth considering: 其他一些值得考虑的问题:

  • Is this PB10 app a new, well-written PB10 app, or was it one made in 1998 in PB4, then gradually converted to PB10 over the years? 这款PB10应用程序是一款全新的,写得很好的PB10应用程序,还是1998年在PB4上制造的应用程序,多年来逐渐转换为PB10? A well-written app should have some decent segregation between the business logic and the GUI, and you should be able to systematically port your code to .Net. 一个编写良好的应用程序应该在业务逻辑和GUI之间进行一些适当的隔离,并且您应该能够系统地将代码移植到.Net。 At least, it should be a lot easier than if this is a legacy PB app, in which case it would be likely that you'd have tons of logic buried in buttons, datawindows, menus, and who knows what else. 至少,它应该比这是一个传统的PB应用程序容易得多,在这种情况下,很可能你有大量的逻辑埋在按钮,数据窗口,菜单,谁知道还有什么。 Not impossible, but more difficult to rework. 并非不可能,但更难以返工。
  • How well is the app running? 该应用程序的运行情况如何? If it's OK and stable, and doesn't need a lot of new features, then maybe it doesn't need rewriting. 如果它可以稳定,并且不需要很多新功能,那么它可能不需要重写。 Or, as gbjbaanb said, you can put .Net wrappers around some pieces and then expose the functionality you need without a full rewrite. 或者,正如gbjbaanb所说,你可以将.Net包装器放在一些部件上,然后在没有完全重写的情况下公开你需要的功能。 If, on the other hand, your app is cantankerous, nasty, not really satisfying business needs, and is making your users inefficient, then you might have a case for rewriting, or perhaps some serious refactoring and then some enhancements. 另一方面,如果您的应用程序是恶劣的,令人讨厌的,不是真正令人满意的业务需求,并且使您的用户效率低下,那么您可能会有重写案例,或者可能是一些严重的重构,然后是一些增强功能。 There are PB guys serving sentences, er, I mean, making a living with the second scenario. 有PB人服刑,呃,我的意思是,用第二种情景谋生。

I'm not against rewrites if the software is exceedingly poor and is negatively affecting the company's business, but even then gradual adjustments and improvements are a less risky way to achieve system evolution. 如果软件非常差并且对公司的业务产生负面影响,我不反对重写,但即使这样,逐步调整和改进也是实现系统发展的风险较小的方法。

Also, don't bail on this thread until after Terry Voth posts. 此外,在Terry Voth发布之后,不要保释这个帖子。 He's on StackOverflow and is one of the top PB guys. 他在StackOverflow上,是最顶尖的PB之一。

If its rather large, you might have better results writing a front-end for it in .net (or a web-based GUI) and using that to interact with your PB code, assuming you can expose the functionality it as an API. 如果它相当大,那么在.net(或基于Web的GUI)中为它编写前端并使用它与PB代码进行交互可能会有更好的结果,假设您可以将其作为API公开。

If you're using PB 9 or greater, you can generate COM or .NET dlls , that you can then consume by a C# GUI. 如果您使用的是PB 9或更高版本,则可以生成COM或.NET dll ,然后可以通过C#GUI使用它们。 I'd recommend this over a rewrite in any new language. 我建议用任何新语言重写。

Remember, rewrites are never a silver bullet, they always end up more time-consuming, difficult, and buggy than you first expect. 请记住,重写永远不是一颗银弹,它们总是比你最初期望的更耗时,更困难,更多。

You might want to spend some time investigating PowerBuilder 11.5 (recently released) which adds some significant .NET integration. 您可能需要花一些时间来研究PowerBuilder 11.5 (最近发布),它增加了一些重要的.NET集成。

Migrating to PowerBuilder 11.5 in order to make use of new .NET code will certainly be a lot easier than completely rewriting the entire app in C#. 迁移到PowerBuilder 11.5以便使用新的.NET代码肯定比在C#中完全重写整个应用程序容易得多。

我不知道它是否好,但请查看这个(商业)产品: PB.Net

My pet theory of the week is that PowerBuilder developers take the DataWindow for granted until they have to reproduce all the functionality that comes built in. 本周的宠物理论是,PowerBuilder开发人员将DataWindow视为理所当然,直到他们必须重现内置的所有功能。

I'd back that theory. 我支持这个理论。 I went though an attempted conversion from PB8 to Java on a project several years ago that failed miserably, even using the first-gen HTML DataWindow. 几年前,我尝试将一个项目从PB8转换为Java,即使使用第一代HTML DataWindow也失败了。 My current employer is hell-bent on moving to C#, not using Datawindow.NET despite > 2K DWOs in our current product. 我现在的雇主一心想转向C#,尽管我们目前的产品中使用了> 2K DWO,但并没有使用Datawindow.NET。 I'm not looking forward to the day when the realization sets in. (the entire product consist of several user applications, more than a dozen services, and use about 70 PBDs) 我不期待实现的那一天。(整个产品包括几个用户应用程序,十几个服务,并使用大约70个PBD)

OP - unless your application is unusually well-structured (originally written for EA Server maybe?), this will not be a port. OP - 除非您的应用程序结构异常结构(最初是为EA Server编写的?),否则这不是端口。 Things work too differently in the PB & .NET environments for a plain port to work satisfactorily. 在PB和.NET环境中,事情的工作方式完全不同,以便普通端口能够令人满意地工作。 I cannot stress this enough - if you're really using the PB event model, a "port" will likely be a failure. 我不能强调这一点 - 如果你真的使用PB事件模型,“端口”可能会失败。

You need to look at logic flow (intertwined UI & process), control flow (who owns the process or data right now ), data access (UI, data layer, ??) and the parts of the DW event model you're using from code. 您需要查看逻辑流程(交织的UI和流程),控制流程(谁现在拥有流程或数据),数据访问(UI,数据层,??)以及您正在使用的DW事件模型的各个部分来自代码。 If you're thinking about ASP.NET (as we are), your whole user interaction experience will have to change, and that will feed back into the other considerations. 如果您正在考虑ASP.NET(就像我们一样),您的整个用户交互体验将不得不改变,这将反馈到其他考虑因素。

Not directly related to code, build automation will change (we use PowerGen for consistent PB builds; MSBuild is very different) as will your installation & setup. 与代码没有直接关系,构建自动化将发生变化(我们使用PowerGen进行一致的PB构建; MSBuild非常不同)以及安装和设置。

我认为任何考虑将其用于大型应用程序的人都会非常疯狂,不要非常认真考虑使用DataWindow.NET,以免失去对DW的投资。

PHB's at major corporations think that Powerbuilder is a toy language and migrating to a new language like C# is trivial and can be done at a low cost. 大公司的PHB认为Powerbuilder是一种玩具语言,并且迁移到像C#这样的新语言是微不足道的,并且可以以低成本完成。 In fact, migrating a PB application to any other language will cost at least as much as developing an entirely new application on the new language. 实际上,将PB应用程序迁移到任何其他语言所花费的成本至少与在新语言上开发全新应用程序一样多。 The resulting app will generally lose functionality compared to the original and will result in user dissatisfaction. 生成的应用程序通常会丢失与原始应用程序相比的功能,并会导致用户不满意。 I have seen a number of attempts - all have failed because of the difficulty and the user issues. 我已经看到了许多尝试 - 由于困难和用户问题,所有尝试都失败了。

If it ain't broke, don't fix it. 如果没有损坏,请不要修理它。

Yes, it`s doable now without rewriting service components period. 是的,现在没有重写服务组件的时间是可行的。

PB 12.5> PB 12.5>

And target GUI and service component migrations and integrations to c#. 并将目标GUI和服务组件迁移和集成到c#。

Migration/Integration strategy may vary depending your project scope, scalability, resources and timeline. 迁移/集成策略可能因项目范围,可伸缩性,资源和时间线而异。

You can use these target and project types in PowerBuilder .NET. 您可以在PowerBuilder .NET中使用这些目标和项目类型。 Refer this link Sybase_PB .Net 请参阅此链接Sybase_PB .Net

  • WPF Window Application WPF Window Application, WCF Client Proxy, or REST Client Proxy WPF窗口应用程序WPF窗口应用程序,WCF客户端代理或REST客户端代理
  • PB Assembly WCF Client Proxy, REST Client Proxy, or PB Assembly PB程序集WCF客户端代理,REST客户端代理或PB程序集
  • .NET Assembly WCF Client Proxy, REST Client Proxy, or .NET Assembly .NET程序集WCF客户端代理,REST客户端代理或.NET程序集
  • WCF Service WCF Client Proxy, REST Client Proxy, or WCF Service WCF服务WCF客户端代理,REST客户端代理或WCF服务

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

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