12

My company has a major problem. We developed an application consisting of more than 1.000.000 lines of code in Delphi.NET. Because of this we are stuck with Delphi 2007 and .NET 2.0.

As technology and usecases are moving on we need to migrate to another development platform. So far we tried several tools which promised to convert Delphi.NET to C# code - each of this tools had several problems like wrong indexing of strings (Delphi 1 C# 0) or when types were used to declare array boundaries.

After that approach we tried to decompile the Delphi.NET assembly - the code that comes back from that is hardly readable and has hundreds of helper functions which call into Borland specific assemblies. I already looked at the possibility to write a transpiler myself, but the ambiguous syntax of Delphi is too hard to implement in a straight forward grammar.

So now the great question, is there any possibilty left that does not include translating all of the code by hand? Or maybe a migration path which allows to migrate partially and stepwise?

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
user3768733
  • 135
  • 4
  • _a migration path which allows to migrate partially and stepwise?_ To me this __sounds__ inviting; but of course I know absolutely nothing about your system except the line count. Is it modular, how is it partitioned etc..? – TaW Jun 23 '14 at 19:32
  • The application is splitted in about 200 units and serves old style WCF webservices on an IIS. The problem i see here is that although .NET allows language interop like combining VB and C# sourcefiles in one project - i don't know how this kind of interop could work for C# and Delphi.NET – user3768733 Jun 23 '14 at 19:39
  • Building the UI and calling all your Delphi DLLS via Interop can be a start. Then, start replacing each DLL function call with a proper method. Your result can be better loosely coupled system. – celerno Jun 23 '14 at 19:40
  • 1
    I think you'll need to re-write the application if you want a good job done. – David Heffernan Jun 26 '14 at 11:26
  • 1
    Recommended read: *Working Effectively with Legacy Code (Robert C. Martin)* – mjn Jun 26 '14 at 13:28
  • They say no one ever went wrong buying IBM/Microsoft. NO ONE EVER SAID THAT ABOUT BORLAND, CODEGEAR OR EMBARCADERO. :-) But have you considered Oxygene? RemObjects' Oxygene should be easier to port to than C#. – alcalde Jun 27 '14 at 02:28

1 Answers1

4

Check out tools like: http://www.9rays.net/TourStep.aspx?TourStepID=21

While it may not be as simple as running your entire Delphi app through it and getting C# source in return, these kind of IL translators / decompilers are pretty accurate. My advice would be to run a few assemblies through and regression test to spot check accuracy. Chances are very high that you'll have to do some remediation in the generated code, but it's better than rewriting the entire application.

Also: check out http://blogs.msdn.com/b/danielfe/archive/2004/06/15/156087.aspx

Serialize
  • 491
  • 5
  • 13