古いバージョンのDelphi / C++Builderによって開発されたアプリケーションは、最新のWindows OSでの動作が保証されないだけでなく、最新のデータベースへの対応や昨今のマルチデバイス対応などのメリットを活かせないなど、いくつもの問題を抱えています。これらを移行する際に起こりうる問題を理解し、具体的な移行計画を立てられるように、技術的なポイントを学びます。
RAD Studio（Delphi / C++Builder）に搭載された最新のデータアクセスコンポーネント「FireDAC」。単一のコードでさまざまなデータベースにアクセスでき、Windows、Mac OS X、iOS、Androidというマルチデバイスに対応しています。FireDACは、配布も容易である上に、旧データアクセスエンジン「BDE（Borland Database Engine）」とも高い互換性を提供しています。今回、このFireDACを使ったプログラミング手法を、3回のWebセミナーシリーズで紹介します。新規データベースアプリケーション構築にも、既存アプリケーションからの移行にも役立つ内容です。
旧バージョンのDelphi / C++Builderによって構築されたアプリケーションを最新バージョンに移行するための開発プロジェクトの技術支援、コンサルティング、受託開発などを行うパートナー企業をお探しの方は、エンバカデロ・テクノロジーズまでお問合せください。
“If you do not modernize your app, you may become extinct quicker than you think”
Fortune 100 Company
Unicode support was added to RAD Studio, Delphi and C++Builder starting with the 2009 version. Many migration resources were developed at that time but are still useful today if upgrading from a pre-Unicode (2007 or earlier) version.
Delphi has made migration over the decades relatively painless, however, this doesn’t mean it’s always effortless and Unicode is one area where some attention may be required!
First, some good news, is many cases legacy Delphi applications that convert to the current Delphi version do so with few or no modifications. If you are working primarily with VCL components (whose support for Unicode has in most cases been considered carefully), or components from third-party vendors who have taken the time to understand the implications of Unicode support, you have an advantage.
Don’t panic if you use “millions of strings” in your application, it does NOT mean you have to change any code at all
Unicode Technical Overview
What determines the need to make any Unicode changes is how you’re using strings and for what purposes. If you’re not doing heavy text processing or manipulations and stick to the standard string operations, mostly likely your code will simply just work. Additionally, just because you have lots of string literals in your code that also doesn’t necessarily mean you have to make any code changes. The most common things that you do have to watch for is file I/O and interfacing with external non-Delphi libraries and/or DLLs.
As a start, look at these great white papers, technical articles, videos and migration tools to help you out with Delphi and Migration to Unicode:
Delphi and Unicode This white paper has been written to help developers that are using versions of Delphi or RAD Studio that were released previous to the launch of Delphi 2009. Read this paper if you are looking for more information on why and how to Unicode-enable a codebase that has been developed using a pre-Unicode enabled version.
Stories and Advice from the Front Lines
Whether you are in the early planning stages of migrating an existing application to Unicode-enabled RAD Studio, or in the midst of the process, Delphi Unicode Migration for Mere Mortals can help. Written with input from many of the leaders in the RAD Studio community, this white paper provides you with valuable techniques and advice that will smooth the way.
Webinar: Migrating Legacy Applications to Unicode-enabled Delphi with Cary Jensen
Cary Jensen has worked with Delphi developers around the world – including noted authors, leading third-party vendors, and front line developers – to learn how they approached their Unicode conversions, what challenges they faced, and what solutions they employed. Learn best practices for migration to Unicode in this informative webinar.
Migrating your legacy C++Builder applications to unicode
Dr. Bob's Unicode page and 8 Unicode Tips – Covers Unicode format and different string types
Popular Unicode article in the online documentation at DocWiki discusses "Unicode in RAD Studio"
Unicode Statistics Tool
Unicode Statistics Tool on your Delphi application and check if any Unicode changes are needed.
This Unicode Statistics Tool 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.
NOTE: The Unicode Statistics 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.
Migrating your project from older versions of Delphi. The Pitfalls
Craig Chapman covers a range of migration topics including
- Cross platform migration
- Windows 64bit
- Unicode migration
Migrating to 64bit
Ever since Delphi XE2, it has been possible to generate Delphi 64bit applications from the same code base as your traditional Windows 32bit Delphi code. The business case for 64-bit for business is covered in this tech paper The Impact of 64-bit Applications to your Company’s Bottom Line
On the whole moving to 64bit (on Windows, but also iOS) is beautifully simple to achieve! It can be just as simple as adding the 64bit target platform in the project manager and rebuilding the project. This is a massive benefit over other languages that need different types declared to resolve the difference between the two platforms.
Building 64bit Applications with Delphi
Overview of how to build 64-bit Delphi applications with this short tutorial.
Delphi 64bit Code by Stephen Ball covering what is the same, what is different, predefine conditional compiler options and using assembler code.
Delphi 64bit code
Migrations of Database and Middleware
Migrating from the Borland Database Engine (BDE) or DBExpress
The Borland Database Engine (BDE) has been deprecated, and beginning with version XE8 the BDE has been removed from the Delphi installation, but is still available as a separate download from Code Central. All applications using the BDE are recommended to be migrated to FireDAC. If you are new to FireDAC Data Access Components, start here and look at the First Steps and Getting Started links.
dbExpress is also in maintenance only mode and users should look to migrate to FireDAC which offers more databases, is faster and provides more features.
FireDAC Skill Sprints - Migrating BDE applications to FireDAC and InterBase - David I
Featured RAD Studio tool reFind
DocWiki Migrating dbExpres to FireDAC
This article provides a tutorial showing how to migrate a simple client-server application using dbExpress data access components, such as TSQLConnection, TSQLQuery, TSQLTable, to FireDAC
An alternative to reFind, a Free Evaluation Edition of The Automatic Migration Scripting Wizard For Converting Legacy Delphi BDE Code to FireDAC
Delphi Parser BDE to FireDAC migration tool
FireDAC Skill Sprints is a series of 12 x 20minute videos teaching you the advanced features of FireDAC
Migrating 3rd Party Components / Libraries
What 3rd party libraries (components) are you using in your older Delphi?
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.
Check this link for some of the third party components available with RAD Studio and you can search all tools and components on the Embarcadero Technology Partner Directory.
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!
10 Tips For Making Your Mobile App Succeed
Monetize Your App Using In App Payments And Ads
Ads are a good way to monetize your apps. Use full screen interstitial ads at the start of your app and at natural stopping points. Integrate leaderboard ads (320x50) into either the header or footer where it makes sense for your interface. Over at AppBrain Stats they have a list of the most popular ad networks that include Admob, Millennial Media, InMobi, Chartboost, Tapjoy and many more. Add in-app payments for consumable, one time purchase, and subscription-based revenue. Offer both a paid version with no ads and a free version of your app. Provide a way to disable ads in the free version via an in-app purchase.
Secure Your App’s Data Connections With SSL
Mobile users are more mobile than ever these days and they jump from secured wireless access point to 4G to unsecured wireless hotspot multiple times per day. If you want to keep your user’s data secure from the prying eyes of just about anyone using a network packet sniffer you will want to implement industry standard encryption like TLS/SSL (Transport Layer Security/Secure Sockets Layer). Using a good tried and true third party library is the way to go.
Encourage Users To Rate Your App
A good rating in the various app stores is more important than ever. Usually only people who want to give your app a low rating end up on app store rating pages and rate your app down. You can encourage users who love your app to rate your app by pointing them in the right direction. The third time a user uses your app is good time to ask them to visit the rating page for your app on the app store of your choice.
Create And Deploy Icons For Your App
Having a great looking icon is a must have to increase your chance of success in the app stores. There are more than 30 different icon sizes that you need to create and deploy for Android and iOS apps. This can be a real chore to create all of the icons needed. There are utilities out there that can help you do that like Mobile Gfx Setup, Paint.net and Adobe Flash CC is a more advanced commercial Windows program that comes with a free trial and you can create and export your icons pretty easily in it as well.
Handle App Activate And Deactivate Lifecycle Events
Once you have the features in your app all finished you aren’t done. One reason why some apps succeed and others do not is because of the polish that goes into them. There are events on both Android and iOS which will tell your app when it becomes active or goes into the background. You should find and handle these events so that your app has a slick user experience. Test and handle all of the various actions in your app like going into sleep mode and coming back out or pressing the back button.
Don’t Fly Blind. Add Analytics To Your App
Implementing analytics using various third party analytics libraries like Google Analytics, Flurry Analytics, GameAnalytics and Parse Analytics to name a few. Analytics providers have their own Android, iOS, and REST SDKs that you can integrate. Track important data points like how long a user uses your app, which screens do they use to most, and where they may get stuck or leave your app. Most important of all is to take action on the information that the analytics give you. Iterate and test. Iterate and test.
Setup Push Notifications
Push are an important mechanism for keep your users engaged with your app. Try to find a balance between sending too many and not sending enough push notification to keep users engaged. Android push notifications are available through Google Cloud Messaging. iOS push notifications are available through the Apple Push Notification Service. Implementing push notifications can be tough but third party providers like Parse, PushWoosh, and Upsight (formerly Playhaven) make it easier for you.
Use Threads To Keep Your App Responsive
Threads allow you to execute long running procedures in a separate process. Use threads anywhere your app would block user input like uploading and downloading files, processing information or loading data. If your app appears frozen users may exit and move on to the next app. If a user is sitting on a screen waiting for something to happen, think about how you can rearchitect your app so that the event they are waiting for happens in the background instead.
Check Network Connectivity Before Trying To Connect
Mobile device connectivity is not a sure thing. If your app needs internet access you need to handle the scenario when connectivity is not available. Using queuing systems for uploading and downloading data. Implement file download resuming where possible. An offline mode where online only features are disabled while connectivity is unavailable may be a good idea.
Optimize Your App Name, Description and Distribution
Choose a functional name, descriptive, or a unique name (or a combination) to help your app succeed. Stay away from trademarked terms. A good description that lays out what your app does, who your competitors are and what technologies you used to build it can help people find your app. Building your app is just the beginning. Distribution is also key to a successful app so make sure if your app runs on both Android and iOS that you deploy it to the biggest app stores like Google Play, Apple App Store, Amazon Appstore, and Samsung Apps. Each app store has their own submission process and guidelines but the extra boost in users you get is worth it. You may just find your niche on the Amazon Appstore or Samsung Apps.