Electron - From Browser to Desktop

Mar 26, 2018 9:05:00 AM

shutterstock_190854512.jpgContinuing the flurry of posts here related to cross-platform development, we turn our attention now to yet another up-and-coming cross-platform technology: Electron. The Electron framework (formerly known as Atom Shell) enables developers to build desktop apps using standard Web tools: HTML, JavaScript, and CSS.

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.

That said, it’s unlikely that established, mature desktop applications, such as those in the Microsoft Office suite, are going to be rewritten in HTML, CSS, and JavaScript any time soon, if ever. Electron development is mostly going to be about new applications, or applications that are already available as web apps and thus can easily become Electron desktop apps. And indeed, that seems to be what’s happening: the desktop versions of popular apps such as Slack and Yammer are built in Electron.

Bottom Line

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.

Brian Geary

Written by Brian Geary

Brian is a true believer in the Agile process. He often assists the development process by performing the product owner role. In addition to his technical background, he is an experienced account manager with a background in design and marketing.

Lists by Topic

see all