Reader small image

You're reading from  Expert Delphi - Second Edition

Product typeBook
Published inFeb 2024
Reading LevelExpert
PublisherPackt
ISBN-139781805121107
Edition2nd Edition
Languages
Right arrow
Authors (2):
Marco Cantù
Marco Cantù
author image
Marco Cantù

Marco Cantù is an experienced Delphi expert, who started working with the product since its introduction in 1995. He is currently working as a Product Manager for RAD Studio at Embarcadero Technologies, an Idera company. Prior to that, Marco was a Delphi trainer and consultant for Wintech Italia. Over the years, Marco has written 20 books on Delphi, from the classic Mastering Delphi series to the recent Object Pascal Handbook. Marco has been a speaker at many Delphi and programming conferences worldwide, including over 10 Borland US Conferences, the Software Development Conference, Borland European conferences, EKON (Germany), DCon (UK), Conference to the Max (Holland), DelphiTage, the Italian Delphi Day, and a few editions of Delphi Developer Days. Marco is based in Italy.
Read more about Marco Cantù

Paweł Głowacki
Paweł Głowacki
author image
Paweł Głowacki

Paweł Głowacki was Embarcadero's European Technical Lead for Developer Tools. Previously, Paweł spent over 7 years working as a senior consultant and trainer for Delphi within Borland Education Services and CodeGear. Apart from working with Embarcadero customers across the region, he represented Embarcadero internationally as a conference and seminar speaker. Paweł passed away in mid-December 2017, but he is alive in the hearts of the Delphi developers community, worldwide.
Read more about Paweł Głowacki

View More author details
Right arrow

Preface

The world of mobile app development is becoming more and more complex. Technology is continuously evolving. Every day, new versions of mobile operating systems are released in the market. Mobile devices are getting new capabilities. User expectations are constantly growing, and it is harder and harder to meet them.

The only way to meet and exceed all challenges in the contemporary world of mobile development is to become a developer superhero. Superheroes have super tools. In this book, we are going to embark on the journey of mastering Delphi development to build mobile apps. We will learn how to develop amazing productivity powers and rapidly build stunning cross-platform mobile apps from one codebase.

We will start by getting comfortable in using Delphi’s Integrated Development Environment. Next, we will review the key constructs in the Object Pascal language and everyday programmer tasks so you can easily understand and write solid and maintainable source code. Over the course of this book, the fun levels will only increase. We will start our adventure with mobile development with Delphi by building small projects that will make you feel like a real Delphi developer. Having mastered simple things, we will be ready to do more serious stuff. We will go deep into understanding the concept of FireMonkey styles, which is the cornerstone of building stunning cross-platform user interfaces that will make a difference in the end-user experience of your apps. The rest of the journey is all about gaining practical knowledge of using more complex Delphi frameworks. We will get down to the metal and harness the full power of mobile hardware and operating systems. We will be working with sensors, building data-driven user interfaces, embedding mobile databases, integrating with REST web services and the Cloud, and defining scalable, multiuser backends.

But why Delphi? There are two main platforms for mobile apps that are dominating the mobile market: Android and iOS. It is a common requirement to develop an app for both platforms. This typically means using different tools, frameworks, and programming languages. If you want to build a mobile app for iOS, you would typically use the Xcode development environment from Apple and use Swift as the programming language. Android development requires different tools. For Android, you would typically use a tool like Android Studio from Google and the Java programming language. These are two different worlds that speak different languages. If you want to build your app for both, this typically means having two different sets of skills and in practice two different teams of developers. Mobile app development gets more and more fragmented. One can be an iOS developer, and somebody can specialize in Android.

This is where the advantage of a tool like Delphi becomes significant: You can write a single application, and the same source code written with a single programming language and using a single set of user interface controls will work on both iOS and Android. Not only does it work but it also works great, leveraging the platform features and adapting to the different UI requirements.

Not only that, Delphi also offers you the ability to build the backend for your mobile apps, offering REST-based access to your own services from your mobile app.

With Delphi, you can become a mobile developer superhero and develop unmatched productivity powers to build complete mobile apps using just one tool, one framework, and one programming language to create mobile apps for both iOS and Android and desktop applications for Mac and Windows. At the same time, you can also build scalable REST API backends that will power your mobile apps on all platforms.

Who this book is for

This book is intended for software developers who know the foundations of programming and can write code in at least one programming language, as it will not teach you the foundations of programming. In other words, if you have never written any line of code in your life, this book is not for you.

This book is meant for developers who might not have used Delphi or for developers who have used Delphi in the past but only for Windows VCL applications, not FireMonkey mobile ones. There is little for Windows and desktop development here, as the focus is on building mobile iOS and Android apps.

This book is packed with practical code examples and best practices for you to become an excellent mobile developer! It is focused on learning by doing – more than just offering many theoretical discussions, it will guide you step by step in rebuilding projects. That is why no expertise in Delphi is required: In most cases, the steps do not assume you have a pre-existing knowledge of the tool or the programming language.

Given the information built on what was presented in previous chapters, though, if you are new to Delphi mobile development, we encourage you to go through the book in sequence: Jumping right away to the final chapters would be a very steep learning curve.

What this book covers

Chapter 1, Fasten Your Seat Belts, introduces you to the Delphi IDE and guides you on the first step for building an app for various platforms.

Chapter 2, Mind Your Language, offers an introduction to Delphi’s Object Pascal language, covering some of its foundations and some of the most recent extensions to the language.

Chapter 3, Packing Up Your Toolbox, delves into some of the core runtime library features, focusing on managing files in different formats, including JSON and XML.

Chapter 4, Using the Parallel Programming Library, focuses on multi-threading, parallel programming, and threads synchronization.

Chapter 5, Playing with FireMonkey, introduces the FireMoney UI library, covering its foundations while guiding you in the development of an actual app.

Chapter 6, FireMonkey in 3D, goes over the development of 3D apps in FireMonkey, showing multiple different techniques.

Chapter 7, Building User Interfaces with Style, delves into the styles architecture, which is the core architectural element of FireMonkey.

Chapter 8, Working with Mobile Operating System, focuses the attention on the device sensors, cameras, and integrated web browsers.

Chapter 9, Desktop Apps and Mobile Bridges, touches on desktop development with UI controls more interesting for desktop than mobile, and how desktop and mobile apps can work together via a technology called tethering.

Chapter 10, Embedding Databases, introduces database development, the FireDAC data access library, and live bindings.

Chapter 11, Integrating with Web Services, how to call external web services via HTTP, REST clients, SOAP clients, or Cloud access libraries.

Chapter 12, Building Mobile Back-ends, starts looking into the development of server libraries you can use as the backend of your mobile apps, covering WebBroker and DataSnap.

Chapter 13, Easy REST API Publishing with RAD Server, is fully focused on the RAd Server technology available in the high-end versions of Delphi.

Chapter 14, App Deployment, covers the deployment of apps to the mobile stores, Apple’s App Store and Google’s Play Store.

Chapter 15, The Road Ahead, is a short conclusion suggesting things you can do after you’ve finished reading the book.

To get the most out of this book

This book will teach you the development of apps with Delphi and FireMonkey and does it through practical demos and step-by-step guides. For this reason, you need to have a copy of Delphi at hand and possibly a mobile device you can deploy your applications to. For macOS and iOS development, you need an Apple Mac, while for Android a Windows machine with Delphi and the integrated Android SDK is sufficient. Some specific additional requirements are listed below.

Software/hardware covered in the book

Operating system requirements

Embarcadero Delphi IDE

The IDE runs on Windows or on a Windows VM hosted in a different operating system. You need a license of Delphi, although most of the content and demos will work using the Community Edition, which is available for free (with some limitations)

Android development

Requires only an Android phone or tablet, possibly with a recent version of the operating system

iOS development

Requires a Mac and a (paid) Apple developer account to deploy to your device and an actual iPhone or iPad.

DataSnap and RAD Server Frameworks

Available only in the high-end, paid versions of Delphi

App Store Deployment

Require paid developer accounts on Apple or Google online stores

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Expert-Delphi_Second-edition. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “This will add a form inherited from TForm3D.”

A block of code is set as follows:

const
  DEFAULT_OPACITY = 1;
  POS_X = 150;
  POS_Y = 150;
  SUN_RADIUS = 50;
  RAY_COUNT = 12;
  RAY_LENGTH = 100;

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

procedure TForm1.PaintBox1Paint(Sender: TObject;
  Canvas: TCanvas);
begin
  Canvas.BeginScene;
  try
    // access "Canvas" methods and properties here
  finally
    Canvas.EndScene;
  end;
end;

Any command-line input or output is written as follows:

procedure TMViewForm.FormCreate(Sender: TObject);
begin
   MultiView1.Mode := TMultiViewMode.PlatformBehaviour;
   ComboMode.ItemIndex := 0;
end;

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Now select the grid, right-click on it, or see the commands at the bottom of the Object Inspector and open its Items Editor.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Expert Delphi, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781805121107

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Expert Delphi - Second Edition
Published in: Feb 2024Publisher: PacktISBN-13: 9781805121107
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Marco Cantù

Marco Cantù is an experienced Delphi expert, who started working with the product since its introduction in 1995. He is currently working as a Product Manager for RAD Studio at Embarcadero Technologies, an Idera company. Prior to that, Marco was a Delphi trainer and consultant for Wintech Italia. Over the years, Marco has written 20 books on Delphi, from the classic Mastering Delphi series to the recent Object Pascal Handbook. Marco has been a speaker at many Delphi and programming conferences worldwide, including over 10 Borland US Conferences, the Software Development Conference, Borland European conferences, EKON (Germany), DCon (UK), Conference to the Max (Holland), DelphiTage, the Italian Delphi Day, and a few editions of Delphi Developer Days. Marco is based in Italy.
Read more about Marco Cantù

author image
Paweł Głowacki

Paweł Głowacki was Embarcadero's European Technical Lead for Developer Tools. Previously, Paweł spent over 7 years working as a senior consultant and trainer for Delphi within Borland Education Services and CodeGear. Apart from working with Embarcadero customers across the region, he represented Embarcadero internationally as a conference and seminar speaker. Paweł passed away in mid-December 2017, but he is alive in the hearts of the Delphi developers community, worldwide.
Read more about Paweł Głowacki