Migrating Delphi – Case Studies Webinar

by Sep 30, 2016

On this webinar we learned how to migrate from older editions of Delphi with some stories of what to look for and how to update your code (including tools and resources to help you along the way)

This webinar focused on these three areas for migrating legacy Delphi to the current Delphi version: 
* Migrating 3rd Party Components / Libraries 
* Migrating Unicode 
* Migrations of Database and Middleware 


In this webinar, we looked at and learn how to:
* Use the new Getit Package Manager to allow you to browse, download, purchase, and install GetIt packages into the current Delphi version. 
* Use the Tech Partner Directory to find 3rd party libraries. 
* Use the Unicode Statistics Tool, to estimate time and effort for the Unicode migration 
* Modify non-Unicode code to Unicode for Delphi char, Read, String, Pointer, Length, MultiByteToWideChar, etc. 
* Migrate the Borland Database Engine (BDE) to FireDAC for SQL databases. 
* Move from MIDAS to DataSnap 
* Convert Your VCL to FireMonkey using Mida –VCL to FireMonkey Convertor

Benefits gained by migrating to current 10.1 Berlin version:

  • more sales,
  • new features in your application,
  • new platforms,
  • new markets and more happy users. 
 

10.1 Berlin gives you Business benefits:

  •  Greater Reach for your Applications – The reach allows you to reach more users, more platforms.
  •  International audiences with Unicode.
  • More platforms with OS X, iOS and Android.
  • Reach more memory on Windows with 64-bits support.
  • Reach more cores with the parallel programming library.

Let me first mention Embarcadero has created a new Migration and Upgrade Center Web page. This Upgrade and Migration Center is here to help you navigate your migration from older editions to the newer current editions.

 

We really want to know how you are doing with your legacy Delphi and C++ Builder migrations, so please try using the “Talk to Migration Specialist today" button, that will get you in contact with an Embarcadero resource to help with your migration and help answer any migration questions J

 

 

The web page focuses on these 4 main areas of Migration; Unicode, Migrating to 64bit, Migrations of Database and Middleware, and Migrating 3rd Party Components / Libraries, with each section providing tools and resources to help with your legacy code migration.

 

Migrate1

Migrate2

 

Migrating 3rd Party Components / Libraries 

One of the first questions to ask when migrating legacy Delphi code is:  What 3rd party libraries and /or components are you using in your older Delphi projects?
The 3rd party plug-ins (libraries) need to be rebuilt in the current Delphi version. Having the source code makes this easier. You will need to re-compile your 3rd party components / libraries from older Delphi using the current Delphi 10.1 version so the components and libraries can be used in current Delphi projects.

 

Any 3rd party components / libraries without the source code may need updated versions for the current Delphi 10.1 version.
To help you find legacy  3rd Party Components / Libraries start with this link for some of the third party components available with RAD Studio   
Here, you can find all the tools and components that have a version for the current Delphi 10.1 Berlin.  Check the Delphi 10.1 Berlin box., for all Platforms, all Industries, all Categories, and all Countries.  Click Search.  Over 160 (163) tools and components get returned.  Good chance you will find your 3rd party component / library to be used in the current 10.1 version of Delphi or C++ Builder!
 The current Delphi includes the new Getit Package Manager to allow you to browse, download, purchase, and install GetIt packages into the current Delphi version. GetIt currently includes 31 of the popular free packages such as libraries, components, IDE extensions, and SDKs, like Open Source “TurboPack” Components, JEDI Visual Component Library, etc., certified to work in the current Delphi version!
The New GetIt Package Manager includes:
  • ·       common open source libraries
  • ·       Free 3rd Party Libraries
  • ·       Add-in frameworks, like JEDI, etc.
  • ·       TurboPower libraries
  • ·       Quick and Easy install and uninstall
  • ·       New libraries frequently added.
 GetIt
How to use GetIt Package Manager video:  https://youtu.be/V51RhcRLZI8
 

 Migrating Unicode

 Unicode Statistics Tool

1. If you are looking for some kind of objective measure of the complexity of your Unicode migration, you can run this Unicode Statistics Tool on your Delphi application and check if any Unicode changes are needed.  
This evaluation tool for migrating applications will assist you in collecting useful statistics for the time and effort needed to migrate your Delphi applications to Unicode. 
The tool reviews your code and tells you where and what you will most likely have to change.  This will at least give you an estimate of how many lines need to be reviewed. 
But note that the tool does not know if any of your lines of code really needs to be modified or replaced at all.  It does tell you have at least some number of lines you should take a quick glance at.
It could be as little as 0 changes needed.   It really all depends on how you are using Strings and Chars in your application. 
The result is Delphi is 100% Unicode. The migration is easy, the Visual Component Library (VCL) and the compiler handle many things.   
The tool lists all used units, including Delphi units (and how many times each one was used), number of files, number of lines, and number of instances of String, Read, Write, SizeOf, etc.
One of the most relevant changes since version 2009 is that String types are now based on Unicode. Previously based on the ANSI standard, the AnsiString and WideString types still work the same way, except regarding their data size in bytes.
Unicode changes, in short:
  • String maps UnicodeString, no longer AnsiString
  • Char now maps WideChar (2 bytes, not 1 byte) being a UTF-16 character
  • PChar maps PWideChar
  • AnsiString maps the old String type
No changes were applied to:
  • AnsiString
  • WideString
  • AnsiChar, PAnsiChar
  • Short String contains AnsiChar elements
  • Implicit conversions still work.
  • The user's active code page controls the mode (ANSI vs. Unicode), so that ANSI strings are still supported.
Operations that do not depend on character size:
  • String concatenation
  • Standard String functions. E.g., Length, Copy, Pos, and so on.
  • Operators. E.g., , CompareStr(), CompareText(), etc.
  • FillChar ( )
  • Windows API
Operations involving the character size (measured in bytes) may require a few changes. Nothing too complicated, but here’s a tip: pay special attention to code in which you:
  1. Assume Sizeof (Char) is 1.
  2. Assume the size of a string equals the number of bytes in the string.
  3. Handle String or PChars directly.
  4. Saves or reads a string from/to a file.
Items 1 and 2 do not apply to Unicode, because in Unicode the Sizeof (Char) is 2 bytes and the size of a string is twice as big as the number of bytes. Besides, the code that reads and saves files must understand the right number of bytes to perform those operations, for a character is no longer represented as 1 byte.
As you can see, the Unicode migrating is very easy. The benefit of having Unicode support allows Delphi developers to distribute their applications worldwide!
 

Migrating Data Access (FireDAC)

If your application connects to a database or works with data, then you really need to look at FireDAC. FireDAC is a fantastic data access framework that supports a large variety of databases and has incredible in-memory features as well. It is based on the model that the BDE established, but much more robust and lightweight.

 

Move from MIDAS (DCOM) to DataSnap 

DataSnap (previously known as MIDAS) is a DCOM-based software technology that enables RAD creation of multi-tier database applications. DataSnap components approach allows Embarcadero software development tools such as Delphi or C++Builder to create data broker/client applications with TCP/IP, DCOM, HTTP or even SOAP transport protocols. The TCP and HTTP transport are implemented using respectively a server side service and an ISAPI dll that act as proxies for the DCOM server.

 

The first release (then known as MIDAS) appeared in Delphi version 3. The name was changed to DataSnap in version 6.

 

For those of you looking to convert old Midas remote provider based applications to the new DataSnap Rest remote dataset based approach, this may be one of the hardest functionalities to convert/migrate in old Delphi/C++Builder applications.” But David I has a blog post with these four resources that will help you migrate your legacy DCOM based DataSnap servers all the way up to the new Delphi 10.1 Berlin:

 

  1. Migrating Legacy DCOM based Datasnap Servers

  2. Bob Swart’s “Delphi 2009 Development Essentials book”DataSnap chapter by Dan Miser covers the topic “Reusing Existing [DataSnap] Remote Data Modules

  3. Migrating Delphi DCOM DataSnap Projects to Delphi 2009 DataSnap – Jon Robertson jmrSoftware

  4. White Paper: The New DataSnap in Delphi 2009 by Marco Cantu

  5. DataSnap 2009 Overview – By Steven Shaughnessy

Datasnap

CodeRage Webinar videos and white papers also exist to help you to move from Midas (DCOM) to Datasnap

 

Mida – Convert VCL to FireMonkey

When you have the need to target multi-device platforms (Win32, Win64, Mac OS X, iOS and Android), you will be able to leverage your existing VCL Windows Applications, and create multi-device, true native apps. 

 

 

The Mida –VCL to FireMonkey Convertor tool will help you to convert your VCL apps to FM apps. The Mida Converter is a third-party IDE extension that automates some aspects of migrating VCL applications to FireMonkey.

 

 

The Mida Converter is an application that can take your existing Delphi VCL apps which have legacy code in them and convert the code and the VCL so that it becomes a Firemonkey app.

 

 

You can configure the Mida tool to change properties like .caption to .text. It will even convert TImage components and their contents from VCL to Firemonkey.

 

 

Might be nice to have the Mida Converter in your tool chest even if you don’t have any legacy code you could use it convert VCL demos, code snippets, and maybe even components to work in Firemonkey for you.

 

 

You can look at the Mida Converter Home Page and try it out for yourself.

 

 

 

You can migrate VCL applications to FireMonkey either manually or using the third-party Mida Converter IDE extension.

 

Migrating VCL Applications to FireMonkey Manually

Although there is no direct migration path between the VCL and FireMonkey, you can:

2.Modify, cut and paste the content of your existing VCL application into your new FireMonkey application.

 

This method is essentially refactoring your VCL application so that it becomes a FireMonkey application. See Commonly Encountered Differences Between the VCL and FireMonkeyfor a list of issues that you might find during the conversion.

 

Mida 5.5 supports Delphi 10.1 Berlin and  C++Builder 10.1 Berlin

 

 

Resources

Here are a list of additional resources, papers and videos to help migrate your legacy Delphi and C++ Builder applications to the current 10.1 Berlin version.

Most, if not all of them you can get from the main new Migration and Upgrade Center Web Site.

 

Here we have the resources grouped by the main focus areas of this webinar; Unicode, Migrations of Database and Middleware and Migrating 3rd party Components and Libraries.

 

Migrating Delphi – Case Studies Video replay:  https://www.youtube.com/watch?v=7EnKXZ9-Pc8

 

 

Migration and Upgrade Center Web Site

Talk to a Migration Specialist Today

Unicode

Delphi and Unicode white paper

Stories and Advice from the Front Lines

Webinar: Migrating Legacy Applications to Unicode-enabled Delphi with Cary Jensen

Dr. Bob's Unicode page and 8 Unicode Tips

Unicode in RAD Studio

Unicode Statistics Tool

Migrating your project from older versions of Delphi. The Pitfalls 

Migrations of Database and Middleware

Borland Database Engine (BDE)

FireADC Getting Started

Migrating to FireDAC

Migrating 3rd Party Components / Libraries

third party components available with RAD Studio

search all tools and components on the Embarcadero Technology Partner Directory.

Getit Package Manager