visit
Developers were now able to design and build native applications for the most popular platforms, including both desktop (Microsoft Windows, Linux, and Apple OS X, now also known as macOS) and mobile (Google Android and Apple iOS), using a single toolset and language, thus significantly reducing the effort needed.
Here we say what FMX is, why it was created, and what its great strengths are. By the end you will understand the context in which it was developed and have an appreciation of its underlying philosophy.In the 1990s, Delphi was arguably the best development environment to build Microsoft Windows applications. This was the time of Windows 95, when the IT world was much simpler than it is today. DOS and Windows had a very large share of the PC market.
The remaining part of the world was running Linux or Macintosh but with a limited share and only in very specific contexts. Even though the mainframe (such as IBM AS400) was still a thing, businesses were mostly running Windows.
Developers who were keen to build Windows GUI applications had a variety of languages at their disposal, including Visual Basic, Java, and Visual C++, but Delphi soon earned a loyal following.
The ability to easily build beautiful standalone Windows applications via a slick IDE was a great plus and was one of the key factors behind Delphi's success.Apart from the convenient GUI-centred Rapid Application Development (RAD) approach, built into an effective IDE, Object Pascal was a great language, showcasing full Object-Oriented Programming (OOP) support, great C compatibility (perfect for Windows API calls), and featuring a very fast compiler.
All this was possible thanks to a framework shipped with the product: the Visual Component Library (VCL). It acted as a sort of abstraction over the standard Windows controls, wrapping them in a more suitable and easy-to-use programming interface.
A big difference with respect to other products is that this has provided the ability to go back to being low-level and interact with the primitive control whenever needed. Every Delphi developer felt at home while dealing with VCL components and most applications never needed to descend into low-level code. This meant higher productivity for the developer.Today’s technology environment is more complex than that of the late 1990s. We have seen the rise of mobile platforms, with Android now the most heavily used OS worldwide.
Also, the desktop platform scene has evolved, with Apple’s Mac OS X (aka macOS) enjoying greater adoption than before (even if this is not equally true in every part of the world). In the following figure, you can see OS distribution over time (period starting January 2009 to January 2020 – data source: //gs. statcounter.com):
Figure 1
Readily apparent are the decline of Windows (the dominant platform from 2009 to 2017) and the corresponding rise of Android (overtaking Windows around 2018).Today, multi-tier architectures have become the de facto standard for real projects that have to deal with a (possibly high) number of heterogeneous clients and provide users with proper interfaces in a range of scenarios (desktop, mobile, web platforms across different device families). This makes it increasingly challenging to see applications as single projects built for a specific platform. The requirement for an application to be available across multiple platforms is very demanding, yet is now almost standard. Meeting these requirements is hard because developers must learn platform-specific behaviors, technologies, APIs, programming languages and deployment toolchains.The solution (as often happens) is something situated between these two opposites. FireMonkey adopts a mixed strategy which, being a sort of compromise, translates into a list of strengths and weaknesses.
In the following screenshot, you can see the Delphi IDE while designing a multi-platform application. The Android style is selected for use in the form designer, an iOS style preview is available through the Multi-Device Preview window (docked into the IDE on the right side) and an instance of the application is running on the Windows platform, just in front of the IDE itself. Thus we have three styles visible at the same time, one per platform; three different binaries using the same (single) source code:Figure 2
This screenshot encapsulates how easy it is to build your application for multiple platforms, using a single programming language: Delphi. You can design your app in the IDE, select one of the supported styles (each style being associated with a specific platform—Android, as shown in the previous screenshot) to preview the result in the form designer, seamlessly.At the same time, you can also have a look at Multi-Device Preview (part of the IDE set of functionalities named Fire UI). There, you see a realistic preview of how your application will look on other (multiple, eventually) platforms (iOS, which is also shown in the preceding screenshot).
Note that neither of the two mentioned platforms (Android and iOS) is the one that the IDE is running on (Windows) and that your app will also be able to be executed, no code changes needed, on Windows (and Linux and OS X/macOS).If that doesn't sound great enough then you can go even further and have your forms previewed, live, on a mobile device through another technology named Live Preview (still part of the Fire UI set, //docwiki.embarcadero.com/RADStudio/en/FireUI_Live_Preview).
This time, you'll be able to preview (without having to wait until the compilation time) your UI on actual physical devices, without effort, with the screen of the device acting as an extension of your IDE.Now let’s look in a little more depth at the strategy FMX takes in order to provide different UI visuals to match the current platform of the running application.The first version of the FMX framework was released in 2011 and already demonstrated one of its fundamental features: rendering of the UI from scratch, using the GPU. At the time, the GPU already supported technologies such as shaders (//en. wikipedia.org/wiki/Shader), opening up a way to implement high-quality vector graphics, taking into account the growth of CPU power.
It became possible to build complex UIs, decorated with stunning effects and transitions, having the same appealing visuals typical of technologies such as Flash (the leading technology in modern and good-looking UIs at that time).
Given that WinAPI (and thus the VCL) and the new (at that time) .NET alternative – Windows Presentation Foundation (WPF) – were not offering such capabilities, the development team of FMX saw a great opportunity to build a new framework.
This was the beginning of the framework having the opportunity to control every aspect of the UI implementation, creating the possibility of strongly abstracting the UI from platform-specific controls and capabilities. However, the number of controls available was limited and the first version of FMX was unable to provide the same level of functionalities offered by the VCL on Windows.The major new feature added with FMX 2 was bitmap styles: building a rich vector-based UI had a huge impact on performance and, at the same time, it was hard to implement some of the required components and peculiarities of the UIs. Adding the bitmap style capability moved FMX into the position to build effective, good-looking (pixel-perfect was the motto at the time), and performant applications, while retaining strong abstraction (through the style concept).Even though it may seem a step backward (from pure vectors to bitmap styles), remember that the evolution of computer graphics over the decades has seen bitmaps come to play a central role. Hence most operating systems and drawing technologies are very familiar with bitmap (raster image) handling and have been optimized for that.This means that from your Delphi code you can call any iOS library functions (as you would do in Objective-C or Swift).
The same applies to Android where you can wrap – the Java2OP tool is available for Embarcadero’s registered users – the Java code you want to reach into Delphi classes and functions and have it available for your application developer.
Even though this may seem like a kind of last refuge for the developer, it also represents a guarantee that your framework (FMX) is not closed and you are actually able to get back to the metal as much as you like or need.For example, it is not unusual when writing Android apps on custom devices (that is, those including industrial-level optical or NFC/RFID readers) to have the manufacturer of the device provide it with a standard Android OS image with the addition of some external JAR files with the libraries needed to properly interface with some device-specific features.
Also, it guarantees that if Embarcadero does not provide you with this or that API wrapper, you may proceed and generate it (manually or with a tool such as Java2OP) without having to wait for official support for that functionality.Another strength of FMX is the possibility to add support for new platforms on the go. Just before the Apple iPhone launched in 2007, nobody would have guessed that Nokia’s Symbian OS would become a dead platform so quickly.
The story of Microsoft mobile operating systems has been characterized by much change and several major bumps. And while today we might reasonably think of the mobile world as being split between Android and iOS, we should be alert to the possibility that a new platform may arise tomorrow. Similarly, even though it is not really a new platform, the recent addition of Linux as a target platform for FMX GUI applications has been seen as a new conquest by the whole Delphi community.This addition has been possible thanks to the work of a third-party vendor named KSDev (involving original FMX authors Eugene Kryukov and Alexey Sharagin) and the efforts of Embarcadero to deliver a new compiler for the Linux (Intel) platform.
Together with the LLVM compiler technology, it is the inner architecture of the FireMonkey framework that is responsible for this accomplishment.
Today it puts Delphi in a position to build effective UI applications on up to five different platforms: Microsoft Windows (32-bit and 64-bit), Apple OS X, Apple iOS (and its simulator), Google Android, and Linux (Ubuntu and RedHat are officially supported by the compiler).
From a strategic point of view, knowing that the set of tools your IDE uses to actually build your applications is extensible (from the compiler to the UIs, including RTL and main DAC libraries) has considerable value, especially if you are building large applications or you have an estimated lifespan for your projects of more than a couple of years.Of course, there are also drawbacks, as there always are, especially in a demanding and dynamic environment involving moving targets (such as mobile platforms). The first obstacle is caused by the high-level abstraction described earlier. That is, Embarcadero’s whole cross-platform solution is made of abstractions of services and functionalities, with the construction of the UI central to the user experience. The key strengths of FMX (such as styles and the ability to perfectly mimic a native application's visual and interactive pattern fundamentals) should strongly mitigate the distance from the top of the abstraction and the bare metal on the ground, but it remains a challenge.The speed of innovation, especially in mobile platforms, we witness today can be hard to integrate into a highly abstracted framework. Embarcadero has opportunities to solve (or at least mitigate) these problems and the first example in this direction has been the introduction of the ControlStyle property, with the platform option to let FMX use a corresponding native control where the developer decides it is worth doing so. This means that if the underlying OS has some advanced features (think about a device-wide orthographic corrector or an advanced dictation system) built into native controls, even cross-platform applications built-in FMX can rely on them and not lag behind other apps.In the same arena, relatively young mobile platforms are continuously striving to improve their performance, and so the FMX framework (and Embarcadero’s ecosystem of technologies) will have to constantly evolve to keep pace with native (i.e. non-cross-platform) applications.