Thoughts on the MVP-Award and the education of computer scientists...

MVP
January 2024, Reading time 6 minutes

I am pleased and proud to announce that I have been named Embarcadero MVP for Delphi. I am the first Delphi Software Developer from Switzerland to receive this award for their contributions to the Delphi community.

This is surprising because Delphi is based on the programming language Object-Pascal, which is based on the work of Swiss Professor Niklaus Wirth, who at the beginning of 1970 designed the procedural language Pascal as an easy-to-learn training language at ETH Zurich. Concepts from Wirth's later work, in particular the modularization concept from the language Modula-2, as well as object-oriented class systems from Simula and C++, were also incorporated into the development of the Delphi predecessor Turbo Pascal.

The Danish software developer Anders Hejlsberg adapted the Pascal compiler from Wirth and developed a single-pass compiler based on a recursive descent parser and therefore very fast compiler. Hejlsberg sold this command line compiler under the name Compass Pascal mainly to the Danish education system under his company Polydata. A student of Wirth's, Philippe Kahn, founded the company Borland in Silicon Valley around the same time and acquired the license for Polydata's compiler technology. Parallel to this, his development team, consisting of Mogens Glad, Lars Fried-Nielsen, Niels Jensen, created an integrated development environment that combined the editor, compiler, linker and debugger in one application. In addition to all the brilliant technical concepts and good quality, it was also a clever marketing strategy to sell Turbo Pascal at a price of less than 50 US$. This aggressive pricing strategy made Turbo Pascal an accessible and attractive option for a wider user base and contributed significantly to its widespread acceptance. Hejlsberg joined Borland a few years after Turbo Pascal was launched in 1983, and played a decisive role in shaping Borland's future development.

With the advent of graphical user interfaces, especially Windows, the development of Delphi 1 was another important focus. Whereas previous command-line programs with often linear program flow helped the programmer with many commonly applicable functions from mathematics, statistics and much more in collections (libraries), programmers of applications with complex user interfaces need a new concept to avoid having to write thousands of lines of code for each application. With the new concept of the framework, which was implemented with Delphi for the first time with the Visual Component Library, the programmer started developing new applications with a minimally running application, which the programmer expanded step by step according to the requirements.

Even before the turn of the millennium, Borland's management shifted the focus away from the actual development tools to tools for managing the development process, which in retrospect was surely a gross misjudgment. Hejlsberg also subsequently switched to competitor Microsoft, where he found an exciting field of activity in the development of the dotNet framework and the new language C# and later with TypeScript. It wasn't until 2008, when Borland was able to sell the development tools Delphi and C++ Builder to his then unknown customer Embarcadero, that development started to move forward again. Since then, a lot has happened, Embarcadero has developed new compilers for different target operating systems such as Android, iOS, MacOS and Linux, and provided a new cross-platform library FireMonkey to create modern and beautifully animated apps for all these platforms on these very different systems with a single source code. The programming language has also developed noticeably under the influence of C#. Thus, the concept of namespaces and yet another paradigm with generic programming, as well as the use of anonymous functions from functional programming were added.

With its powerful multi-paradigm programming language, Delphi continues to enable the efficient development of robust applications that are among the best solutions available in terms of computing speed and power consumption. For my customers and my own products, the most important benefit is the relatively low cost of adapting to new operating system versions and changing graphical interfaces and operating concepts over a period of more than 25 years, which is uncharacteristic for the software industry. Nevertheless, the Object-Pascal language has evolved over time and there are exciting innovations in the development pipeline at Embarcadero.

At this point it should be mentioned that it has become very difficult to find good young Delphi developers for new projects, especially in Switzerland. I find the cause of this misery in the mistakes of the last Borland managers, who gave up the free and academic licenses. However, Embarcadero has recently recognized this shortcoming and there is now a program for academic licenses as well as a free community license that allows non-commercial applications to be created. Today, there are also good and updated training materials such as introductory videos on application creation for all platforms by Ian Barker, basic books on Object-Pascal by Marco Cantu and descriptions of programming concepts by Nick Hodges, as well as an introduction to modern GUI development with Firemonkey by Andrea Magni, to name just the most important. The clear and relatively quick to master development environment as well as many sources of information on the web such as learndelphi.org or the Delphi Praxis Forum and also a very active community make it easy to get started.

If I may express a wish here, I would like Delphi to find its place again in the training of young computer scientists in Switzerland. But I am also aware that there is still little support for this idea in the industry, because Delphi is too often associated with Legacy, and the innovations and cross-platform capability are not well known. This blog post aims to change that. Professor Wirth, who died earlier this year, also fought for the recognition of computer science as a separate faculty at ETH Zurich, before computer science could finally emerge from the shadow of an auxiliary science.

Read more about why I got the MVP title here.

Delphi WinRTCypto Sample Applications show Encryption for Windows...

November 2023, Reading time 4 minutes

During the preparation of my session at EKON 27 on Hybrid Encryption with WinRT, five example applications for Windows were developed. The first two applications illustrate how easy it is to build symmetric and asymmetric encryption. The built-in encryption algorithms of the operating system are used and called via the WinRT API. Therefore, no third-party library is needed, but the applications are based on the WinRT wrappers, which have been included since Delphi Version 10 Seattle, but were little known due to lack of documentation.

By combining the two types of encryption, the third application demonstrates how hybrid encryption works. In the fourth step, the encryption for several receivers is extended with their asymmetric key pairs. Finally, the fifth and final application shows how the transmitted message can be protected against changes with an asymmetrical signature. This gives the recipient certainty that the message also originates from the sender known to him.

The source code of all five sample applications is published on Github: github.com/SchneiderInfosystems/WinRTCrypto
Alternatively, the code can also be obtained directly from the Delphi IDE via GetIt-Package Manager.

A new Version 1.5 of the open-source library FB4D brings new Services and Features...

July 2023, Reading time 6 minutes

At the EKON 26 in Dusseldorf in Germany I presented the new service interface for ML-Vision in an hour-long session. In a half-day workshop I demonstrated the implementation of the demo app Photobox in 4 comprehensible steps based on the first session. This app shows the interaction of the Firestore NoSQL database with Firebase Storage and uses the machine learning ML-Vision API for image analysis of uploaded photos. The IVisionML interface implemented in the FB4D offers image analysis for TIFF, GIF and PDF formats. The images can be either uploaded ad hoc to the service or referenced to images from the Firebase Storage. The following image analysis functions are available:

  • Text recognition: This high-quality text recognition offers significantly more performance than pure OCR libraries. The recognition of handwritten text is now surprisingly good and the language of the text can also be evaluated.
  • Object Detection: Detects and locates many commonly known objects and references the objects with the Google Knowledge ID.
  • Label Detection: Evaluates the content of the image using predefined English language labels. Informs about the relevance of the detected labels within the image.
  • Face Recognition: Recognizes and measures faces in pictures without clearly identifying the persons. Allows the rough estimation of simple emotions of the persons depicted.
  • Identifies known landmarks on images and returns their georeferencing.
  • Recognition of well-known logos or products
  • Detection of explicit content in the categories: racist, youth less, deceptive, violent or medical images.
  • Recognition of images from the web.
  • Erkennung von Bildattribute und Bild-Zuschneid-Hinweise.
Demonstration of handwriting text recognition with VisionML
Figure 1: Demonstration of handwriting text recognition with VisionML in the DemoFB4D sample application

For further questions about the new IVisionML interface I recommend you to consult this new wiki page.

Released at the end of June in GetIt and GitHub, Version 1.5 now includes the necessary new features for ML-Vision as well as the new sample application Photobox.

After a longer development period, this version for the Firestore now includes not only the previous read-only transaction support but also a write-transaction support. With this, the FB4D is now able to write several documents at the same time and in one uninterruptible transaction. In one transaction sub-step, you can either rewrite an entire document or replace an existing document completely with UpdateDoc. If you want to change only one or more fields within an existing document, you can use the PatchDoc method on the IFirestoreWriteTransaction interface. This interface is obtained by calling the IFirestoreDatabase.BeginWriteTransaction. The IFirestoreDatabase.CommitWriteTransaction method is used to execute the transaction. As always, both methods are available in dual versions for use within GUI applications as asynchronous calls and within background threads and services for synchronous and blocking calls.

For more detailed questions about the new Write Transaction on the Firestore database, please refer to the following wiki page.

Connect Delphi to the Firebase with the open-source library FB4D...

September 2022, Reading time 4 minutes

The Google cloud platform Firebase provides various web services for No-SQL databases, file storage, machine learning, server-side functions, and other services for worldwide use. Firebase focuses on developers for mobile applications and web applications. There are well-documented SDKs from Google for the programming languages Swift, Kotlin, and Java for Android and iOS platforms and web applications under JavaScript.

Since October 2018, the open-source library FB4D has been published for access the web services within a Delphi application. The library uses internally the REST API of Firebase and builds long-running REST calls to be informed about database changes without using cost-intensive queries to the database. For logging in, the Auth service provides different workflows for logging in with the email address and a password.

Class interfaces are available for controlling the various Firebase web services and can be easily accessed via a central class factory. All methods for accessing the services are available in two variants: Once as synchronous methods for the usage in threads, services, and console applications and asynchronous methods with callback functions for use in GUI applications.

FB4D is a pure source code library that can easily integrate into a Delphi project without installation. Thanks to a comprehensive Wiki with a getting started and a reference manual. A discussion forum supports the developer in case of upcoming questions during the learning process. 6 sample applications for the FireMonkey framework FMX and one for the VCL help to get started and give ideas how to use the library.

For companies that use this library in their commercial applications, I recommend sponsoring this project. This way you get the best support and guaranteed further development and maintenance for your solution.

Why Schneider Infosystems will continue to rely on the Delphi programming language in 2022...

August 2022, Reading time 7 minutes

As an independent software developer who has worked for more than 20 larger and smaller Swiss companies over the last 30 years, I am often asked why I still use Delphi's programming language, which is now over 25 years old. My answer is always and mainly to the astonishment of the questioners: Since I have not yet come across a more beautiful and efficient language, I like to continue working with Delphi. But I want to mention that the actual programming language behind Delphi - Object Pascal - is only a quarter of the value of the entire Delphi package for me. The runtime libraries, the two user interface frameworks VCL for Windows, and the newer Firemonkey for cross-platform development, are more critical for me. Last but not least, the Integrated Development Environment (IDE) supports me in my daily work. And I recognize the progress that has been made in this area by Embarcadero in the last few years.

Five years ago, I took a course in Mobile Application Development at the Lucerne University of Applied Sciences. I got to know and appreciate Apple's modern language Swift, and later Kotlin on Android. Both languages solve some technology aspects even better than the current Delphi version Alexandria 11.2. For example, a «Collection» in Swift and Kotlin can contain different data types, only possible within Object Pascal using «Variants». It makes some more complicated, e.g., the filling of an object from a JSON object. Using nullable types also makes coding more accessible and results in much more readable and shorter code.

But also, Delphi has experienced many essential enhancements in the last years. Today I would not like to miss the generic <types> introduced with Delphi 2009. I often need the practical runtime library classes of the «Generics.Collections». Also the anonymous functions are essential for me. And I am also sure the null-able types will come in one of the subsequent Delphi versions because I think they would fit well with Object Pascal. Other design paradigms can already be used with Delphi. So, you only have to know them. I often use Fluent-Design, which improves the readability of the code by chained function calls. Thanks to class interfaces, the use of automatic reference counting leads to shorter and more effective code.

Using the Fluent design to construct a simple JSON array containing a JSON object
Figure 1: Using the Fluent design to construct a simple JSON array containing a JSON object

What I have sorely missed with Swift and Kotlin is a clear and robust IDE with a debugger that I can blindly rely on in most cases. If necessary, I can also look at the generated assembler code and the processor registers. Besides code completion, navigating through the code between method declaration and implementation is indispensable for efficient work. In my opinion, the Delphi Designer still offers excellent advantages compared to Android Studio and XCode, especially regarding the placement and automatic alignment of controls for both VCL and FMX applications. The fact that we receive all source files with Delphi, including those we create with the integrated form designer, as readable and thus comparable text files is a must criterion for me. Speaking of file comparison: Here, I appreciate the capabilities of Beyond Compare daily and have not seen such a well-functioning tool in any other IDEs. In the Delphi IDE, however, Beyond-Compare could undoubtedly be integrated even better in the future. For the development of Firebase backend functions with Typescript, as well as for cross-platform development by using the MinGW-C++ compiler, I rely on Visual Studio Code. This enormously extensible editor offers a lot of undoubtedly practical just in everyday use. Also, this tool can not inspire me ultimately, and there are too many things that I still miss.

But the most important trump card for me in many projects today is the crossplatform framework Firemonkey. I have used it to create more extensive and complex projects (600K LOC) with a single source content of about 90% for the Windows, Mac-OS, and partially Linux desktop platforms as well as smaller applications for the mobile platforms Android and iOS. This implies that I only have to adapt about 10% of the code to the respective platform because the Delphi RTL or no third party has written a function that solves my task. However, these are often functions that are very close to the operating system, such as detecting another monitor connected or removing a USB device during application runtime. The learning curve of Firemonkey was a challenge for me as a longtime VCL user, and good documentation or books about Firemonkey were rare initially. In the meantime, however, this gap has been filled. I recommend the book «Delphi GUI Programming» by Andrea Magni to anyone who wants to learn about Firemonkey.

The lucid Delphi Alexandria 11.2 IDE while working on a new Vision-ML module for FD4D
Figure 2: The lucid Delphi Alexandria 11.2 IDE while working on a new Vision-ML module for FD4D