Sunday, July 17, 2016

Embracing .NET with RemObjects Hydra

If you're a Delphi shop and find yourself (sometimes) jealous of all the .NET goodies have a look at RemObjects Hydra (more details here). It's a framework which allows you to mix and use VCL, FireMonkey and .NET code modules in a single mixed-mode application. (They've recently started the "Escape from Delphi" offer.)

Your host application can be an unmanaged 32-bit or 64-bit Delphi VCL or FireMonkey application (written in Delphi 7 or later), or a managed WinForms .NET application (written in any CLR-compliant language like C#, Oxygene, VB.NET, etc).
Your plugin libraries (loadable by the host dynamically at runtime) can implement non-visual or visual plugin modules which can be unmanaged Delphi VCL or FireMonkey, or managed .NET WinForms, WPF or Silverlight DLLs. The host and the plugins can communicate with each other through interfaces. IDE support with templates and wizards to create the hosts and the plugins, for both Visual Studio and Delphi, is included.

If your trusty old Delphi codebase comprises millions of lines of code the idea of porting that code over to .NET might be intimidating. It probably seems completely out of question, an investment of huge amount of time and effort into a project with uncertain benefits. The development of new features during the transition might be stalled or limited, and you're going to have a period of time when nothing works. In short, probably a nightmare.

With Hydra now, you can think about it again: You can start with a skeleton host application, quite simply rebuilding your existing Delphi units into plugin modules, keeping all your existing code working as before. You can then port the modules to .NET one by one, at your own pace, if at all. Simultaneously, you can develop new modules in .NET already. All of a sudden, it's not so bad anymore, it's definitely doable, and probably fun.

Below is a screenshot of a very quick exercise in rebuilding the SearchBox VCL sample as a Hydra plugin. It took me only a few minutes to resolve some issues: to include the VCL styles, the DLL must link in the sample's resource file, and use the VCL.Styles unit. I also had to adjust the form slightly: remove border icons and make it visible. Here's the result: