Electron fills a cross-platform development niche by giving web developers a way to build desktop applications that work on Windows, Mac, and Linux. In a way, it approaches the cross-platform problem from the opposite direction of Microsoft Blazor, which enables .NET developers to build web applications. In another way, it’s similar to the progressive web application approach, which delivers server-based web applications that behave like native desktop apps.
How Does Electron Work?
An Electron application has a “main” process, which creates the web pages in the app, and “renderer” processes that actually display each web page. The “main” process manages the web pages, handles events, and executes much of the program logic. In addition, it acts as the middleman between the web pages and system resources, such as the file system, services, and hardware components, which web applications traditionally do not have access to for security and resource management reasons.
The cross-platform magic happens because of abstraction. For example, a developer who needs to code a menu just codes it without worrying about platform-specific requirements for menus. The process of building the app for each platform takes care of translating this abstraction into the operating system calls necessary to make the menu work correctly in the target platform.
Why Electron Is Important
In the pre-mobile era, when the desktop was all about Windows vs. Mac, a technology like Electron would have been a huge deal. At that time, it was extraordinarily difficult to build an application that worked the same across different desktop operating systems. Even when coded in so-called “portable” programming languages, such as C++ and Java, applications often required different code bases for different platforms. When an application was available for more than one platform, it might be months or years between the Windows release and the corresponding Mac release. So the idea of having truly a cross-platform code base would have been headline-grabbing revolutionary.
And Electron is revolutionary, although with mobile getting most of the attention these days, advances in desktop application development have been rather lost in the noise. The desktop is still an important form factor, particularly in the enterprise, so anything that enables development shops to execute a single development project and deliver on three different platforms—rather than a separate project for each platform—is a major achievement.
It’s an achievement that doesn’t just benefit developers, though. If applications are available on all platforms, run identically on each one, and get updates for each one at the same time, then software availability is removed from the equation when choosing a platform. The enterprise—and consumers, for that matter—can choose whichever one they perceive as the cheapest to own, easiest to administer, or whatever.
It’s still the early days for Electron, as well as all the other entrants in the cross-platform development race. A new era in software development is dawning: one that values platform-agnostic applications, both for ease of development and convenience for the users. It will be interesting to see where Electron settles into that landscape.