Migrating a Delphi 7 application to .NET

2020-03-17 04:25发布

Any advice on how to migrate an existing Delphi 7 business application to .NET 2.0 in Visual Studio 2005?

Visual Studio 2005 has already been purchased, the company wants to move away from the Borland/Codegear tools.

The application is a single client server executable, utilizing a number of 3rd party UI controls and Crystal reports 10 for reporting.

There is extensive business logic spread across Delphi types in the UI as well as many SQL Server 2000 stored procedures. Moving much of the stored proc logic into .NET classes is another goal.

To reduce impact on customers, a piece by piece approach rather than a complete re-write/conversion would be preferred, if possible. Thanks in advance.

[Update] Has anyone had any experience, good, bad or ugly, using Managed VCL for this type of scenario?

9条回答
在下西门庆
2楼-- · 2020-03-17 04:47

There has been a scientific report of a successfull transformation of a 1.5 million line Delphi Project to C# by John Brant, Don Roberts et al. He wrote a Delphi parser, a C# generator and lots of transformation rules on the AST. Gradually extending the set of rules, doing a daily build, lots of unit tests, and some rewriting of difficult Delphi parts allowed him with a team of 4, among which some of the original developers, with deep Delphi & C# knowledge, to migrate the software in 18 months. John Brant & Don Roberts being the original developers of the refactoring browser and the SmaCC compiler construction kit, you are unlikely to be able to go that fast.

Though this was a significant investment, it is nowhere 'the same size as the original development'. The authors note that a straightforward rewrite, without tools or with a single-shot tool, as noted by Jeroen, is very likely to result in that, especially if new requirements are taken into account.

The authors have done large scale refactorings while staying on the same platform for a different project, completely replacing the persistence infrastructure. This could be relevant for older (BDE?) based projects.

查看更多
我想做一个坏孩纸
3楼-- · 2020-03-17 04:48

For me the question would be: which language would you be using? I do hope C# and not VB.Net. (With all the awkward politics in this usecase this is not clear by any means.)

The next you will probably hear is that there are converters out there that will help you doing this. We just went through an evaluation of such converters (Delphi 7 to C#) and were very! disappointed.

May I suggest a compromise? How about Delphi Prism? It is Delphi in VS2008. Sure, you still have Delphi and therefore Codegear, but you also have VS (as your company expects you to).

查看更多
来,给爷笑一个
4楼-- · 2020-03-17 04:50

Moving away from CodeGear/Borland tools basically eliminates any Delphi .NET based solution and a total rewrite of your application.

I hope my answer below helps with your decisions.

From experience (having rewritten a Delphi application with a team of people) it boils down to either of two choices below.

But first a warning: you will take at least the total development effort it took to write your current Delphi application.

In our case, this effort was warranted since the old Delphi application (which in fact it was Kylix) had an end-of-life because of various reasons. Our rewrite consisted of two parts: rewrite with limited extra functionality followed by a lot of extra functionality (the design of the first part already took the second part into account).

Back to your choices:

1- a total rewrite in C# or VB.NET in Visual Studio

2- a partial reuse of your existing Delphi business layer code by using Oxygene from RemObjecs (a Visual Studio plugin with a syntax that is very similar to the Delphi syntax). CodeGear will offer Prism soon (likely before the end of 2008), which will also integrate into Visual Studio.

Because .NET data access and UI are totally different from Delphi, you will have to do these from scratch (both for scenario 1 and 2). Visual Studio 2008 offers a lot of benefits here over Visual Studio 2005.

There is no such thing as doing this migration gradually, since you do a complete platform change here, it is an all or nothing approach.

Both scenario's will take a considerable amount of time (even though you have Delphi experience, getting yourself accustomed in the .NET world will take time).

Visual Studio can interact with Crystal Reports, and goes well with SQL Server.

Since Visual Studio 2008 offers a lot of benefits (not only .NET 3.5, but also productivity wise), you'd better go with that. On the UI side, you need to make a balanced choice between WinForms (aka Windows Forms) and Windows Presentation Foundation (aka WPF).

If it is a 1-to-1 rewrite, you might want to stick with WinForms as it is familiar to what you have. You probably need to use some 3rd party components to get your UI going; DevExpress is a good choice here as they have similar components in Delphi and Visual Studio.

But if you want to go for future eye candy, then you might consider WPF. Be prepared for a steeper learning curve here than WinForms as it is very different from what you are used to.

If you decide to stay with Delphi, you might want to look into VCL for the Web (aka IntraWeb) and into Delphi 2009 (a lot has changed in the Delphi world since Delphi 7 was announced 6 years ago).

Good luck making your choices!

--jeroen

查看更多
登录 后发表回答