The Cross Platform Development Paradoxon
6 min read
For decades it sounds promising to have ONE code base and to be able to use it for many platforms without having to reinvent the wheel every time.
Is it really as easy, as clicking a button and to compile for all platforms?
Java, Xojo, LiveCode, PureBasic, B4X, windev are only a few examples. Add to that mix, flutter, fyne.io, Xamarin, and .NET MAUI. Many, many options, some for decades, some relatively new, and many with challenges when trying to develop something more sophisticated.
Some solutions use a virtual machine for their approach and very few compile “natively” for all platforms. But even JAVA, which previously ran exclusively in its VM, can now compile with tools “natively” for different platforms.
Is it as easy as salespeople tell us? Yes and no. As always “it depends”. If you take e.g. mobile devices, cell phones or tablets, then hopefully you will design your UI completely differently (gestures, responsiveness, etc.). In addition, the way you integrate help, sign your programs and deploy them differs. You should design your UI for portrait and landscape mode, etc. Your “backend” code is most likely the smallest issue you’ll have when doing mobile development.
Almost all cross-development tools do a very good job on smaller programs, with a manageable UI and functionality. Of course, exceptions always prove the rule, but fundamentally, a great many develop simpler utilities. And that’s okay. That’s why many of these solutions sell their products as Rapid Application Development tools. Ideal for prototypes, quick and dirty tools, and proofs-of-concept. And usually, they will emphasize RAD latest, when you are trying to accomplish something more difficult. Be warned. It is not about blaming those manufacturers, it is about understanding what they do and what they can deliver.
Aiming for cross-platform development can often convince. But of course, it also depends on what you want to achieve with your program. If you work heavily with the file system and its permissions, then you will still have to differentiate in your code whether you are developing for Windows, macOS, Linux, or even for mobile devices.
Granted, the advantage remains that you only have to deal with one programming language for all platforms. But even that is often, but not always, an advantage. After many “quarrels”, Java has certainly done a lot right here in recent years. Whether you like the programming language is another matter. Brilliant and effective for backends, for frontend development it is not my cup of tea. But that’s me. Nevertheless, I tried it, and you can easily code some really impressive and good-looking apps. If you are working in a regulated market, or need solid, reproducible documentation (surviving even with new releases) then Java probably still beats everything currently on the market. Here again, we are back to the question of what you want to achieve. If you are coding for a regulated market, you need to extend your due diligence efforts carefully, before writing your first line of code.
In my experience, a lot has changed in the “native” area in the last few decades. Let’s take macOS for example, the mostly non-Apple apps are designed more Apple-like and they also work much less uniformly. For development, e.g. https://nova.app/ is probably one of the few exceptions. But the tool is not particularly successful. It looks nice and works great initially, but the latest changes in e.g. vue3 or Rust are implemented much too late, if at all. Plus they are not implemented by the manufacturer but are third-party plugins.
If you want brilliant results it is probably still best to develop natively for all platforms. Plus if you modularize your backend logic, it is mainly “only” hard work to maintain a few frontends. Question is if this takes you more time, than dealing with the challenges of cross-dev tools.
And another use case for cross-development in the past where people like me, wanted to work with macOS / Linux only but develop for Windows. Meanwhile, I think, this doesn’t make much sense, you have to test your software intensively on the targeted os.
Cross-platform development is always a kind of compromise, good enough for common denominators, but with special requirements, you have usually to make compromises and you have to test all from day one on all platforms anyways. The big challenge: you usually are not aware of the limitations when you are starting on a cross-dev tool.
The only thing that works IMHO almost identically on all operating systems is HTML/CSS/JS. And to this day I haven’t seen a customer that has a problem with that, as long as the program works as it should. Of course, an HTML frontend doesn’t always solve all problems (e.g. looking 100 per cent “native”), but in principle, you have a “canvas” in front of you, which you can control with all elements with pixel precision. egui is one example, and no worries you can add native file dialogues too and you can customize the look of the demo ;-). Would I recommend egui these days? Yes, for small UIs, if you are planning to develop complex tables with tons of interactions … nope.
However, there are good reasons why not everything should run on the web (security, privacy, etc.), but the solutions like Electron, which compile the front (and backend) as a desktop app, unfortunately quickly fell into disrepute. One of the reasons for this is that each of these Electron programs also delivers the complete browser engines (although they are usually already installed on everywhere computer) and thus the binaries are massively inflated.
Tauri.app takes for instance a different approach here so that you will get compact and efficient binaries (on windows even with an installer). You don’t have to learn Rust for using it, because many API functions are passed through to JS.
As they are using vitejs, previews are also very convenient and fast, and with hot reload, changes in the HTML / CSS and JS can be displayed immediately, so that the design of a UI can also be done very quickly. You just have to be willing to spend a few hours/days familiarizing yourself with the more modern CSS concepts like “flex” and “grid” and finding the appropriate framework such as e.g. https://www.primefaces.org/ you have a toolset that works for many programming languages (including e.g. Java).
Whether you like it or not, the trend is increasing towards technologically-wise web-based applications. A “proof” is the numerous libraries for the display of tables. Mapping hierarchical data is just as easy as editing data, hiding or moving columns, and sorting and exporting data. It is hard/impossible to find tools with such functionality depth in the classic cross-development tools.
Also, performance is rarely an issue when passing the business logic to your backend asynchronously. Performance issues are usually related to bad coding habits, leading to blocking the main thread. However, you have to manage this on any other development tool as well.
Web-based development tools are of course not the right tool for everything and everyone, but in 2023 you can build beautiful UIs far beyond what a lot of people still believe is doable with HTML / CSS and JS.
Back to the original question: With Electron and Tauri.app is is indeed possible to compile easily and fast for different platforms. With tauri.app you can compile on top of that small binaries and depending on your design skills, an almost “native”-looking desktop app.
Did you find this article valuable?
Support Jeannot Muller by becoming a sponsor. Any amount is appreciated!