Main image of article 5 Cross-Platform Libraries and Frameworks for Desktop Development

Although web and mobile are where you'll find most developer action these days, desktop is not yet dead. Desktop applications are generally fast (thanks to increasingly impressive hardware) and can do more intensive computation than many web and mobile apps. 

In the good old days (i.e., perhaps five or more years ago), there was a clear division between the operating systems. Linux was for server, Windows for businesses and macOS for creatives. But in the last few years, we've started to see a blurring of these lines; there’s now good cross-platform development platforms for desktop, meaning that developers can easily build apps for multiple operating systems without too much extra work.  

Here are five of these cross-platform development platforms we’ll examine:

  • Electron
  • B4J
  • Flutter
  • Lazarus
  • Kivy

Electron

I've put Electron first, and for a very good reason. Chances are good that you are running an Electron application without even realizing it. How about Microsoft Teams, Zoom, Slack (for desktop), Discord, Signal, WordPress (for desktop), WhatsApp desktop and Visual Studio Code? That’s an impressive selection.

The good thing is that Electron is open-source; apps are built using HTML, CSS and JavaScript. It includes automatic updates, native menus and notifications, crash reporting, debugging and profiling, and Windows installers. 

Unlike most web applications, Electron apps can access the file system and read/write files. It's also maintained by GitHub. The downside is that every Electron App is quite big,, as it includes a copy of Chromium and the files aren't encrypted. 

B4J

If you like writing Visual Basic programs, then you'll be at home here. B4J is 100 percent free and lets you create desktop and console applications that run on Windows, Mac, Linux and ARM Boards. 

Whether Basic is a pro or a con depends on you, but the compiled code is supposed to run as fast as C# applications. B4J also comes with its own IDE. The “J” in the name stands for Java, which is the underlying technology; you need to install a Java SDK (OpenJDK is fine), which lends the platform its portability. As a bonus, you can also create server applications in addition to desktop. (All products in the B4 family are free except B4I for iOS development.) 

Flutter

Flutter on desktop is now a thing with the recent addition of the Windows desktop capability. This is the same Flutter used in mobile and web applications (note that macOS and Linux desktop app support is still in beta). 

If you know Flutter, you know that it can produce very nice-looking UIs. To do that on Windows desktop otherwise requires WPF, and that’s only available for Windows until .NET MAUI comes out of preview. I've a feeling that once Flutter for macOS and Linux are out of beta, it will be another nail in WPF's coffin. Flutter development is a lot easier to pick up than WPF's XAML and the tooling is much nicer. 

Flutter also benefits from letting you share a large amount of the same code for desktop, mobile and web applications. On the pub.dev package repository for Flutter and Dart, of the almost 24,000 packages currently available, just under 15,000 are Windows-compatible, with similar numbers for Linux and Mac.

However, if you don't like Dart, Flutter is probably not for you. There's no specific IDE for Flutter but there are plugins for Android Studio and Visual Studio Code. 

Lazarus and FreePascal

FreePascal (FPC) is the open-source Pascal equivalent of GCC (for C) in the number of platforms and CPUs it supports. In addition to the usual Windows, Mac and Linux, it also supports systems as diverse as Amiga, Dos and Z80. 

Lazarus is the Delphi-like open-source IDE that supports FPC and is itself written in Pascal. It's also available for the same platforms as Flutter (Windows, Mac and Linux plus mobile and web). 

Pascal is a curious programming language and one that I've worked in professionally since the 80s. Although never as popular as C++, it's a very good alternative for developing serious business software. With it, you can create file browsers, image viewers, database applications, graphics editing software, games, 3D software, medical analysis software or any other type of software that would otherwise need to be written in C++.  

Pascal is a lot easier to learn than C++ and has very good string handling. It also generates code that executes almost as fast as C++ applications. If you've used Delphi, FPC + Lazarus is very easy to use and a lot cheaper!

However, some people don't like Pascal's syntax; all those Begin Ends instead of { and }. It also shares C++’s lack of automatic memory management.

Kivy

Kivy is the only Python-based system featured here and has been around since 2011. Of course, Python is cross-platform already; Kivy is an open-source Python library that builds on other libraries to provide consistency across platforms. It does this via widgets and layouts, standardising input in a “Touches” layer. For more complicated widget trees, there's kvlang which lets you create your widget tree declaratively with widget property binding. 

If you know Python, Kivy provides the support for input and graphics. It also works on Raspberry Pi. It’s a mature framework.

All that being said, I’ve heard the UI can be a bit slower compared to Flutter, and that state management in large apps takes a bit of doing. There’s no UI designer, but that’s true for Flutter as well.

Conclusion

Having been a Windows-only desktop developer for many years, I was surprised at just how many different cross-platform, open-source tools are available. Electron stands out through the variety of popular applications it's used to create. But between all these platforms and tools, there’s something here for everyone.