Jānis Blaus
Jānis Blaus
25 October, 2018

Age of Electron: Rise of Cross-Platform Desktop Apps

Developing desktop applications can be full of challenges that make it hard to approach if you don't have the matching knowledge base of a CS graduate. To understand the ins and outs of your computer's ability, a solid grasp of fundamental theories and a proper command of programming languages is a must.

If you look at the software industry, you can clearly see that every application you're using is developed by a professional software solution, who in turn has employed teams of computer engineers. Whereas on the other hand, you can easily find plenty of web applications like websites, servers, PWAs, and APIs built by self-learned developers. Well, you see, web-technologies are easily approachable given you have the right resources and proper dedication. Desktop apps, however, require much sophisticated and expert handling as they are curated by mixing many primitive knowledge bases. Till almost recently, most of the desktop applications we use were system-specific solutions. It means the same application is developed more than once to use on different platforms such as Microsoft Windows, MacOS, and Linux. This approach requires a huge development time and resources whereas posing many system incompatibility issues. To get rid of these problems, and create a much faster and efficient development phase for desktop apps, the Electron framework has been built. It's a cross-platform framework maintained by the folks at Github and is aimed at using web technologies to develop cross-platform highly functional desktop applications. We'll discuss the ins and outs, pros and cons of this framework in today's post. Bear us through if you also want to develop cross-platform desktop applications with plain old web technologies.

Electron and Cross-Platform Apps: In General

So, you might be asking yourself what cross-platform apps are and what Electron have to do with these. Let us guide you through the concept of these apps in this section. As their name vaguely suggests, cross-platform apps are nothing but desktop applications that support multiple operating systems. These apps exploit the dependency related weaknesses of native apps and aim at developing only a single application for different systems. These apps achieve their goal by utilizing web-based components like pages and APIs to gain the same functionalities of native apps, at a reduced development period and associated resource costs. Electron, a framework to utilize such components is the leading solution to cross-platform apps. You can actually think of Electron as a combination of two underlying technologies, the node.js runtime environment and the Chromium rendering engine. Since its inception, Node, the runtime based on Google's infamous V8 engine has ushered a new era of front-end and back-end web development. It has changes JavaScript's role of from manipulating browser DOMs to developing complete applications for different platforms. Chromium, on the other hand, is the open source part of Google's Chrome browser. It is a rendering engine that renders web applications display to us. With the association of both the node runtime and the Chromium engine, Electron provides us a handy way of developing desktop apps without requiring any knowledge of underlying system architecture and system languages. Hence the motto of Electron is, "if you can build a website, you can build a desktop app." Given that, you can create web apps or components with basic web techs like HTML, CSS, or JS; then you can easily create a desktop app. The principal of development no longer demands different approaches.

Native Apps vs. Cross-platform: Difference

When it comes to designing desktop applications, as a developer you have to take charge of things like packaging, installations, and managing updates. And all of these needs to be independent of system platforms. Designing a desktop app will require you to handle system components like menus and notifications. These things need high-level command over system architecture and prominent programming skills to make sure your app performs what you're trying to achieve. Native apps are, however, powerful and provide developers with a lot of ground to explore. Cross-platform apps, on the other hand, exposes you to web components that you're familiar with and has lots of community support. The access to these standard components and web-based APIs contribute to more productive development experience. The installation is the same for each platform, and the app can be expected to perform the same on different systems. However, there are some serious debates concerning the performance sector of cross-platform apps. As these apps do not use system specific calls and have different approaches to basic functionalities, they often seem to lag behind native apps in terms of horsepower. The cross-platform technologies used in such apps are far behind the dominant system development languages like C++, Objective C, and JAVA regarding the performance metrics. So, the primary ground of argument over cross-platform apps is do their convenience in development justify laggings in performance?

Working Principle of Electron

If you've ever built web pages with HTML, CSS, or JavaScript; you'll get extra comfortable with Electron. Creating an Electron app essentially means creating a web app that will run on the desktop. So, how does Electron achieves this? When you download Electron, you actually download a bunch of pre-existing components that you'll shape in your own way to develop your app. Electron provides rich JavaScript APIs that handles the particulars of talking to different operating systems. It uses web pages for creating the user interfaces. You can think of an electron app as kind of a minimal web browser that has the ability to interact with your local file system. This, in turn, is your application's packaging. So you can write your codes with the confidence that everyone running your app is running it under the same set of conditions. Which means you can run your app on any platform once you write the app. In addition to its own set of core APIs, Electron also comes bundled with all of Chromium's API, all of Node's API and supports third-party modules too. Thus, if you have a favorite package or a library you're already an expert in, you can use it to build your Electron app right this moment. So, basically, Electron serves as a universal interface with the operating system and provides you the opportunity of focusing what your apps should do, instead of dealing with loads os system specific overheads.

Why Go The Electron Way?

Whether you're a web developer looking for a quick way to get your ideas out of the server and onto the desktop or you just want an efficient tool to build cross-platform apps with rich user interfaces, Electron can be the right choice for you. If you want to harness elegant desktop applications without facing the redundancies and complexities associated with native apps, go Electron right away. Electron provides you with the experience to build something that's easy to install and simple to maintain. In this time of fast business growth and innovative technological enhancements, Electron gives developers the option to curate their ideas into an application fast and let the customers decide whether they like it or not. With native apps, there'll always be the chance of an app not getting enough traction despite its consumption of a large amount of resource and time for development. You'll get ready-made components like native menus and notifications pre-packaged with Electron, which will give you the scope of developing your apps much faster. The crash reporting and debugging tools will help you hunt even the dirtiest of bugs at ease. In addition, your apps can have automatic updates, which will increase the attraction of your apps to customers much quicker. So, there are more than enough reason to develop your new idea into an Electron app. The decision is now solely up to you and your demands from the application.

Drawbacks of Electron

Although a great choice to build cross-platform desktop apps, Electron has its own share of drawbacks that have been making this framework quite susceptible to criticisms. We've already given you a hint that cross-platform apps will never be the same in terms of performance. This is because native apps use very low-level system wise processes that can't be mimicked with JavaScript. In fact, as you're using Electron as an intermediary JS interface, you have to make peace with the performance issues. So, if you choose to opt in with Electron, stop nagging about performance overheads. Instead focus more on how you can eliminate those issues. With intelligently incorporated algorithms and advanced design patterns, you can contain the performance issues within a considerable margin. However, Electron apps are also known to clog up memory. We already discussed that Electron is packaged with the Chromium engine. This alone contains a massive code base of around 20 millions line of code! It's even more than many operating systems. As you might've already guessed then, it's very common for even simplest Electron apps to take loads of storage spaces. This, in addition to other core libraries and third party modules, can lead to a software size you've only thought in nightmares!

When to Choose Electron

Although you can build any type of desktop apps with Electron, it's especially suitable in some specific cases. If your app needs a user-friendly interface with a lot of network activities going behind the scene, Electron is the best choice for you. However, if you're building something that requires a lot of raw processing powers, we highly recommend you to develop native apps. As they can give you access to underlying system components at a much lower level, native apps are the best choice for resource-heavy desktop apps. Electron apps are the most viable option for you if your app acts similar in fashion to web pages.

Notable Desktop Apps Developed using Electron

Electron has been used to develop some of the best desktop applications in recent times. The first such project is the Atom code editor from Github, the pioneers of the framework itself. Atom enjoys mass popularity to till date. Although superior editors like Microsoft's' Visual Code, another top-level Electron product has overthrown Atom's position as the top open source code editor. The primary reason behind VS code's en masse success is it doesn't clog up the memory as Atom did. If you're a seasoned developer, chances are you're using Slack every day. It's a popular cross-platform productivity app built on top of Electron. It's aimed at increasing development productivity with simplified communication scheme. The performance of Slack is enough to establish the fact that if appropriately incorporated, Electron apps can be an extremely viable option for desktop apps. Other notable mentions utilizing Electron are Skype's desktop client, the famous image writing app Etcher, the WebTorrent desktop app, the WordPress desktop app, and the WhatsApp desktop app.

Future of Electron Apps

With the rapid increase of progressive web apps and API-based apps in the market every day, it's safe to say that Electron will gradually conquer the desktop app building platform. It comes with some of the most sought-after features developers look when building desktop apps, at a slight cost of performance. However, as systems are getting more powerful and cheaper everyday, developers have now the luxury of choosing Electron as the de-facto stack to build their apps. Also slowly but gradually, corporate software giants like Microsoft and Google are developing Electron-based apps of their own. As they keep coming new developers will follow their footstep and embrace Electron for their personalized apps even more. We predict that it'll not take long before Electron becomes the go-to solution for building desktop apps.

Desktop apps are experiencing an exclusive comeback each day. We've come to a point where it's no longer acceptable to spend years of development time behind these applications. Due to their superior productivity and reduced cost, it will not be false to say that Electron apps are the future of desktop applications. However, a lot can be improved to provide even a much smooth desktop app experience with Electron. With the popularity it's been enjoying, we can definitely hope Electron apps to match the firepower of their native counterparts. Let's not stay idle till then, rather you should utilize these time to learn and build your own desktop apps with this fantastic framework

Latest from the Netcore hub

Guides, research, opinions and sometimes just some crazy tech rumbling.
Explore, comment and join the dicussions.