Building Cross-Platform Desktop Apps – Choose the Right Technology

Cross-platform development for desktop applications was unjustly overlooked until recent times even when it was vastly explored in the mobile arena. Today situations are changing as Macs are aggressively taking over the market previously controlled by Windows. Also, adoption of open source Linux platforms by governmental organisations and public offices across the globe forced developers to opt for multi-platform desktop development.

Here we take a sneak peek at widely used enter site cross-platform development tools and frameworks.

Chromium Embedded Framework (CEF) is a framework used for embedding a web browser engine based on the Chromium core. CEF allows developers to add web browser control and implement an HTML5-based layout GUI in a desktop application to add HTML rendering and JavaScript to a C++ project. It runs on Linux, Mac OS X and Windows.

It is basically a browser based on Chromium, and JavaScript code is executed inside it.

Applications developed using CEF

Electron is a framework from GitHub for creating native applications with web technologies like JavaScript, HTML, and CSS. Electron is used for the development of desktop GUI applications using front and back-end components originally developed for web applications. Node.js runtime is used for backend and Chromium for the frontend.

Several notable desktop applications like Slack, WordPress, GitHub Desktop are built on Electron.

Advantages of using Electron

Huge open source community with over 50,000 stars in GitHub

Backed by GitHub which will ensure continued support and reduce risk for enterprise adoption

Supports OS X, Windows and Linux

Proven in the real world with apps like GitHub Desktop, Slack, Atom editor, etc.

Nw.js

Just like electron Nw.js (Node Webkit) uses modern web technologies like HTML, CSS3 and JavaScript, including WebGL to create cross-platform native applications. All Node.js APIs and most of the third party modules are supported by Nw.js.

Java is one of the pioneers in cross-platform development. Java is particularly good at reusing existing functionality. Existing applications in many organizations use Java and have substantial features available in the form of reusable Java libraries and the corresponding infrastructure and methods to build and maintain functional logic in Java.

Java comes shipped with a WebKit-based WebView for JavaFX. Creating a JavaScript application and loading it in the JavaFX WebView benefits a lot in development. Such development can make use of standard APIs, and leverage the world-class browser engine and there are no extra dependencies and tools to create platform-specific installers.

Shortcomings of this approach are:

Outdated technology and poor developer support

JavaFX WebView does not have HTML and CSS Tooling

No built-in JavaScript debugger in JavaFX WebView

JavaScript to Java and back communication is clumsy

Outdated WebKit Version and poor update support from Oracle

React Native Desktop

React Native enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and React. The focus of React Native is on developer efficiency across all the platforms you care about – learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native.

Although React Native is basically intended to develop mobile applications, the same can be used to develop desktop applications. The below are two forks React Native desktop.

React Native macOS is an experimental fork of React Native for iOS for writing desktop apps using Cocoa.

React Native Windows is a fork of React Native with official Microsoft support for writing Windows desktop applications.

Advantages of using React Native for desktop applications

GUI heavy desktop applications look better when built on React Native as it uses native UI components and not HTML

React Native Desktop has following disadvantages when compared to Electron.js

Basically a clone of React-Native from Facebook with a change in default UIKit (for app dev.) to AppKit (for Mac Desktop) and WPF (for Windows)

React-Native was developed as a mobile-first library to make cross-platform app development easier

Successful real-world adoption is very little

Limited community support

Haxe

Haxe is an open source toolkit (not a framework) based on a complete cross-platform standard library. Haxe help to access each platform’s native capabilities and allows building cross-platform tools targeting all the mainstream platforms natively. Haxe is also a strictly typed programming language and a cross-compiler.

Advantages of using Haxe

Much faster compiler than other similar compilers like Flash or Flex

Faster bytecode than the equivalent produced by others

The simple programming language allows the programmer to go as far as they like

Adobe Air

Adobe Integrated Runtime (AIR) is a cross-platform runtime system developed by Adobe Systems. AIR helps in porting Web and Rich Internet Applications to desktops and mobile devices, programmed using HTML/CSS, AJAX, Adobe Flash, ActionScript and Apache Flex.

Advantages of using AIR

Wrapping existing Flash or JavaScript app for desktop

The only way to wrap Flash to desktop applications

Major drawbacks

No support for Linux

Requires the Adobe AIR runtime and a separate installation of the program

Qt

Qt is a cross-platform development framework used to develop multi-platform applications with minimal change in the underlying code base. Applications build on Qt looks native with similar speed and performance of native applications. Qt is used to develop multiplatform applications with and without GUIs (like command-line tools and consoles for servers).

Advantages of using Qt

Common UI library for all platforms

Multithreading

Best GUI solution for C++

Applications developed using Qt

Adobe Photoshop Album

Adobe Photoshop Elements

Autodesk Maya

Bitcoin Core

Google Earth

Skype

Spotify for Linux

Telegram (Windows, Mac and Linux)

VLC media player

WPS Office

Conclusion

JavaScript-based development is gaining prominence in recent times, and most of the development teams are showing an affinity towards JavaScript frameworks. Code reusability across platforms, huge community support and a good portfolio of existing apps are the biggest factors behind this shift. Which framework to choose depends on the critical success factors for the project. For example, if you are building a new desktop application which has a web user interface as well, Electron could be a good option. Similarly, if you are building a desktop application which is a replica of an existing mobile app built using React Native, React Native Desktop could be explored. The future roadmap of the project needs to be considered as well during the platform selection process.