In Defense of Electron
January 16, 2020
Designing software is hard. Designing software meant to run on any users’ devices is even harder. There have been many attempts to solve this, however only Qt has really picked up steam as a cross-platform “native” UI (which isn’t really native.) A somewhat recent attempt to fill this void is Electron, a framework built off the existing Node.js and Chromium projects. To go back, Electron released on July 15th, 2013 under the name of “Atom Shell”, as originally it was put together to solve the needs of the Atom text editor.
The Atom Editor
Text editors may seem simple, but there are a lot of moving parts and especially with code, a lot of things happening under the hood. Atom Shell was even more ambitious than just being a text editor, they released with a full extension system designed to allow developers to hack any part of their editor that they wanted. To allow this type of modification, they needed a language that was popular and well accepted. More than that, they needed a UI framework that supported loading these scripts and allowing them to modify the editor itself. While they could create their own system, such as Eclipse and IntelliJ IDEs before them, they went ahead and went with a well understood tool: the web browser.
While the reasons for Atom choosing a web browser for their desktop application may make sense, you have to ask why this software is now being used for many popular apps such as Slack, Discord, Twitch, and Microsoft Teams. Electron is unique in that it provides a low barrier to enter for the millions of people that already use web technology, but now they can use it to write an app for whatever platform they want. The power behind this is unlike any other UI framework such as Qt, because Qt only works on one platform: the desktop 1.
Electron is good for developers
While it’s no secret that the cross-platform Slack Desktop app is built on Electron, it might be slightly less well known that it’s a hybrid app built around our web app (slack.com). This is one of Electron’s most compelling draws — not only can you build a cross-platform desktop app from scratch with the web technologies you know and love, but you can also extend a pre-existing web app with new and powerful capabilities.
The power of being able to bring your web application which already exists onto the desktop brings a lot of questions to companies with these web apps. Why hire a new team of developers, more QA, more designers to do something for a second (or third, or fourth time depending on the platforms you need to support.) The amount of knowledge a developer needs to learn is limited to the small API that Electron provides, because it builds on top of their existing knowledge needed for the web. Being able to update a single codebase and ship updates to multiple platforms is more convincing that any other current technology, especially if combined with something like react-native/react-native-web allowing a single codebase to be shipped to web, every desktop OS, and every mobile OS.
Electron is good for end-users
Electron is good for the developers using it, but it’s also good for the end-user. The end-user gets new features faster, an app that usually functions the same regardless of which computer they pull it up on, and sometimes one they can even use in the web browser too. Slack is convenient because you don’t need to use the desktop app to use it, since the tech is shared with the website. Even better, you don’t have to learn two similar but different UIs to understand how to use the app. For example, the new Excel 360 web app has a lot of similarities to their Windows application. However when trying to use it, I found a lot of things that it did differently from dialogs to options offered.
If you were a user of QuickBooks’ desktop application, moving to their new web product is a mess. The workflow is different, the tools are different, the UI is completely different! If QuickBooks had the option to transparently bring their desktop application to the web, I think they’d take it. For other companies where their main product is a web app, being able to transparently bring their app to the desktop with additional integration brings that level of consistency to the end-user.
Complaints of Electron
As someone who has written several applications in Electron, I understand the pull this easy-to-use framework has. However as someone who values simplicity and applications that are low on consumption, there are a few things that irk me about Electron.
Pulling in Electron brings not just Node.js, but the entire Chromium browser
This is probably one of the biggest issues that people have with Electron apps. While they can be decently performant, you’re still installing another full web browser for a single application. There have been people suggesting that Electron be distributed much like Java is, then the apps are just bundled and ran in that global version of Electron. I disagree with this approach because it moves away from the current trend of static dependencies, instead depending on a global installation or the installation of multiple versions of the browser.
I’d like to see Electron have the ability to strip down features that are commonly not needed in most desktop apps. For example, I’m really not sure why Standard Notes (my editor of choice) includes an Xbox controller driver. With the smaller size of the binary and possibly lower memory usage due to less globals it solve several of the complaints people have of Electron apps simply being too large for what they are.
Operating Systems Don’t Accommodate
As I mentioned before, people want to use web technology on the desktop because of familiarity and the ability to release their app on all major platforms. Currently no operating systems actually do anything to encourage this development, with Apple even suddenly rejecting Electron apps on their app store with no forewarning to developers currently building their apps on the Electron platform.
What I would love to see is operating systems having a supported API for creating these types of applications with a common API allowing developers to easily target their OS with their application. This would allow the operating system to optimize for these applications, using their generally faster web browser to run the app, rather than packaging multiple versions of Chromium. If developers want to create applications with this technology, I don’t see a reason that Windows or macOS has a reason for being adverse to it, especially since Microsoft already uses Electron for several of their own applications.
I think the Electron platform is neat, providing an easy way for developers to get their ideas out there, while also being accessible enough to be easily hireable for. The performance issues I don’t believe are inherit to the fact that it’s a web browser, hopefully meaning that something better can build on Electron and bring better performance. This may be servo, or it might be something else. However with the many companies still willing to build on Electron without improving the core technology, that means that your average end-user is probably “ok” with the status quo.
Yes I do understand that Qt works on all the popular operating systems, mobile, and even some recent attempts on the web. But websites can do all of those and do it right now with good enough performance for the end user.↩