36,59 €
Improve your Delphi programming skills by building robust applications for Android, iOS, and Windows platform
Key Features
Book Description
Delphi is a cross-platform programming language and software development kit that supports rapid application development for Microsoft Windows, Apple Mac OS X, Android, and iOS.
With the help of seven practical projects, this book will guide you through the best practices, Delphi Run-Time Library (RTL) resources, and design patterns. Whether you use the Visual Component Library (VCL) or FireMonkey (FMX) framework, these design patterns will be implemented in the same way in Delphi, using Object Pascal. In the first few chapters, you will explore advanced features that will help you build rich applications using the same code base for both mobile and desktop projects. In addition to this, you'll learn how to implement microservice architecture in Delphi. As you get familiar with the various aspects of Delphi, you will no longer need to maintain source code for similar projects, program business rules on screens, or fill your forms with data access components.
By the end of this book, you will have gained an understanding of the principles of clean code and become proficient in building robust and scalable applications in Delphi.
What you will learn
Who this book is for
This book is for developers, programmers, and IT professionals who want to learn the best market practices by implementing practical projects. Prior knowledge of the Delphi language is a must.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 176
Veröffentlichungsjahr: 2019
Copyright © 2019 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Richa TripathiAcquisition Editor:Shriram ShekharContent Development Editor:Akshita BillavaTechnical Editors:Sabaah Navlekar and Mayank DubeyCopy Editor: Safis EditingProject Coordinator:Prajakta NaikProofreader: Safis EditingIndexer: Pratik ShirodkarGraphics: Tom ScariaProduction Coordinator:Deepika Naik
First published: May 2019
Production reference: 1020519
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78913-055-3
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Programming can be difficult, especially when you have a challenging project. Therefore, when this project is crucial to someone's business, being the right programmer is a gift to your sponsor. As a business owner, as well as a programmer myself, I can surely say that William Duarte is this kind of blessed programmer we rarely find.
Some years ago, I needed to change the enterprise resource planning (ERP) of my company, on account of the strict Brazilian fiscal regulations. At that time, we had a fully internally developed, private label credit card. It was mandatory that it worked in a totally new environment, seamlessly integrating with a new point-of-sale (POS) system. Following two years of trial and error, of using the services of huge consultancy firms and wasting a lot of money, I was about to give up. That is when I met William Duarte.
In a casual meeting with Mr. Duarte's former employer, I told him about the difficulties in getting our credit card system to operate properly. He introduced me to William, who, in a quick chat, told me he was quite confident that not only could he do what I needed, but he could do it fast. In total disbelief, I asked him to prove it and he just smiled and said: "Fine! I can make it work in a test environment in a couple of weeks. Just wait and see." I felt like laughing when I heard that. How could someone do something that a whole team of programmers couldn't do—and in a matter of weeks, not months? "He will never do it," I thought. However, to my surprise, he did it. The test was a success; thus, I quickly signed a contract with his former company. Nowadays, my credit card system is up and running perfectly, and, fortunately, William Duarte works for me.
If you need to improve your Delphi programming performance, I strongly feel that William can help you with this task. You are in good hands. I have witnessed countless times William's skills and how useful good Delphi programming is for real-life challenges. Therefore, if you are seeking a solid foundation for successful Delphi projects, the hunt is over.
Enjoy your reading!
Rafael Sampaio
Retail executive and owner of Impecável Roupas, a Brazilian chain of stores.
Rio de Janeiro, Brazil
I met William at the annual Embarcadero Conference in Brazil where he was signing copies of one of his previous books. He gave me a copy, but unfortunately, I don't read Portuguese, but I appreciated the book, and luckily, source code is the universal language. He and I became friends, and I was happy to have his expertise and enthusiasm as part of the Embarcadero MVP Program. Most recently, he became an MVP Regional Coordinator for Brazil.
I like the project-oriented nature of this book. It tackles different types of projects with different technologies, such as in the first chapter, where it shows how to capture images, apply filters, and share the images. This is common functionality in many social media applications, and something that Delphi makes easy. I frequently use the basics of this as a quick demo when introducing someone to Delphi's productivity.
The REST client functionality is another favorite feature of mine. I spend a lot of time, as I'm sure most developers do, integrating with web services all over the web. Delphi's REST client library makes it easy to connect to these services and work with the data in your applications. Beyond the REST client library that comes with Delphi, there are numerous specialized REST components, including the Enterprise Connectors and the TMS Web Controls Pack, which are turnkey options for connecting to many different individual web services.
Database access is something that was a key component of the very first release of Delphi. While it isn't, strictly speaking, part of the language, having good database connectivity is part of what defines Delphi. The new FireDAC database access framework is simply amazing. I seriously wish it was part of Delphi years ago, when I was doing more database development. So, be sure you check out William's chapter on databases!
I've said it before, but it continues to be more and more true—it is a great time to be a Delphi developer, especially when you have a copy of a great book on Delphi projects, like this one!
Jim McKeeth
Chief Developer Advocate for Embarcadero Technologies.
Nampa, Idaho, USA
William Duarte is a Delphi Certified Developer and Embarcadero Regional MVP Coordinator. He began his career in 2005 as a programmer. He was recognized as an internationally certified Retail Technical Consultant by Retail Pro in 2007. He is a specialist in commercial automation and desktop/mobile development, and the author of a book in Portuguese—Delphi for Android and iOS, by Brasport, 2015. He is currently working as a consultant for the Brazilian Navy and retail chain stores.
André Luis Celestino is a Senior Delphi Developer with more than seven years' experience in the software development field. He is a Certified Delphi Developer, SAFe Practitioner, and Embarcadero MVP since 2017. He also has a postgraduate qualification in software engineering, with an emphasis on Agile methodologies. He is currently working as a Senior Delphi Developer at DB1 Global Software, a Brazilian software development company.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
Delphi Programming Projects
Dedication
About Packt
Why subscribe?
Packt.com
Foreword
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Building an Instagram Clone
Technical requirements
Project overview
Getting started
Mindset difference between desktop and mobile
Range of sizes
Creating responsive layouts
TLayout
Creating buttons with SVG icons
Interacting with the camera
Lights, camera, and action!
Sharing photos
Summary
Further reading
Building a Facebook REST API
Technical requirements
Facebook Graph API and more
Project overview
Getting started
Creating an application on Facebook
Request and response REST services
TRESTClient
TRESTRequest
REST.Client.TRESTResponse
TOAuth2Authenticator
Get to work (hands-on)
Working with JSON
Logging in with Facebook
Coding login
Behind the scenes
Summary
Further reading
Cross-Platform Services for Windows, iOS, and Android
Technical requirements
Project overview
Getting started
Creating Windows services
Installing and uninstalling a service
Starting and stopping
Debugging a service
Service threads
Creating Android services
Start services
Host applications
Adding an Android service to the host
Local services or remote services
iOS background mode
All in info.plist
Summary
Further reading
Design Patterns to Build a Multi-Database System
Technical requirements
Project overview
Getting started
Creating a database
Creating an SQL Server database
Creating tables in SQL Server
Creating a PostgreSQL database
Creating tables in PostgreSQL
Models for a database – objects
The users object
The customers object
The products object
Exploring Delphi interfaces
Creating and using an interface
Repositories
SQL Server repository – part 1
SQL Server repository – part 2
PostgreSQL repository – part 1
PostgreSQL repository – part 2
Singleton
Presentation and final testing
Data presentation
Summary
Further reading
Creating GUI Apps with FireMonkey
Technical requirements
Project overview
Getting started
Creating Material Design layouts
Using TMultiView
Adding menu items
Using Material Design icons
Colored effect
Working with animations
Floating button
Action button
Animate
Summary
Further reading
Implementing Tethering to Create a Remote Control
Technical requirements
Project overview
Getting started
Creating app tethering applications
Using app tethering components
Sharing screens
Sending data from a mobile to a desktop
Opening an application remotely
Creating the desktop application
Creating the mobile application
Summary
Further reading
Building Microservices Using the RAD Server
Technical requirements
Project overview
Getting started
What is a microservice architecture?
Why use a microservice?
Monolithic application
JSON or XML?
Introducing RAD Server
Where is RAD Server?
Configuring the first project
Consuming services on RAD Server
RAD Server application
Client application
Security
Authentication processes
Application-level authentication
User-level authentication
Authentication and authorization
Implementation
Deployment
Deployment on IIS
Summary
Further reading
Other Books You May Enjoy
Leave a review - let other readers know what you think
Delphi is a cross-platform programming language that supports rapid application development for Microsoft Windows, Apple Mac OS X, Android, and iOS and Linux (server-side). This book consists of seven independent projects that will help you upgrade your Delphi programming skills and guide you through best practices, design patterns, RTL resources, and more.
You will learn how to build responsive user interfaces for desktop and mobile with FireMonkey and implement a microservices architecture using the Rapid Application Development (RAD) server. You will also create clones of popular applications such as Instagram and Facebook using Delphi 10.3, and learn the principles of clean code to master Delphi.
This book is for developers, programmers, and IT professionals who want to learn the best market practices by implementing practical projects. It is important to have prior knowledge of the Delphi language.
Chapter 1, Building an Instagram Clone, introduces the basics of layouts and responsiveness on Android and iOS platforms and also how to use SVG icons, camera features, permissions, and a mobile device's media library.
Chapter 2, Building a Facebook REST API, deals with building an application that consumes the Facebook REST API using native REST components and working with JSON.
Chapter 3, Cross-Platform Services for Windows, iOS, and Android, covers how service applications take requests from client applications, process those requests, and return information to client applications. It also covers how they typically run in the background, without much user input.
Chapter 4, Design Patterns to Build a Multi-Database System, deals with design patterns such as singleton, repository, and others for creating multi-database applications and isolating business rules from forms.
Chapter 5, Creating GUI Apps with FireMonkey, introduces the concepts of Material Design and simulates the use of Material Design using FireMonkey visual components.
Chapter 6, Implementing Tethering to Create a Remote Control, introduces app-tethering technology, and how to turn a mobile device into a remote control for a computer (using Wi-Fi or Bluetooth connections).
Chapter 7, Building Microservices Using the RAD Server, shows how to develop microservices architecture implement it in Delphi, and use a non-centralized architecture, where we can perform different functions on different platforms.
To get the most out of this book, readers should be experienced programmers. You do not necessarily have to be an expert in Delphi, however, basic knowledge of functions, procedures, classes, objects, and databases is required.
It is necessary that, besides Delphi, you have internet access to perform the exercises that appear in some chapters. It is important that you have a physical Android device to hand for testing.
You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at
www.packt.com
.
Select the
SUPPORT
tab.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Delphi-Programming-Projects. In case there's an update to the code, it will be updated on the existing 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!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781789130553_ColorImages.pdf.
There are a number of text conventions used throughout this book.
CodeInText: 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: "When you work with a different view of the master, Delphi will create a new .FMX file in your project folder. This file will contain the positions of the components for that particular screen format."
A block of code is set as follows:
procedure
TForm1
.
DoDidFinish
(
Image
:
TBitmap
)
;
begin
ImgInsta
.
Bitmap
.
Assign
(
Image
)
;
end
;
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
uses REST.Utils, System.NetEncoding,Web.HTTPApp,System.Net.HttpClient,IdHTTP,
uFrmLogin;
Any command-line input or output is written as follows:
net start PacktBooks_Service
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Open the Delphi IDE and create a Multi-Device Application. Note that there is the concept of viewing for different screen types."
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].
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.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
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 [email protected] 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.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.
The world has changed. We are in the new digital age where, every day, more and more apps are available to the users. So, what really grabs attention, since we have so many options available? Features, user experience, rich design? We can say that, with Delphi, we have all the ability to develop rich applications, both graphically and in terms of functionality.
A major challenge for Delphi developers is the paradigm shift between desktop and mobile platforms. The way to develop and draw a form is different, of course; however, many developers program as if they were still working with a Delphi 7 IDE.
If you are this type of developer and want to learn more about responsive design and how to change your desktop mindset for mobile, then this is an ideal chapter for you.
We have chosen an application already on the market—Instagram—to better elucidate these insights and this paradigm shift.
In this Delphi version of Instagram, you will be introduced to the following topics:
Mindset between desktop and mobile
Creating responsive layouts
Creating buttons with
Scalable Vector Graphics
(
SVG
) icons
