четверг, 17 декабря 2020 г.

Why you should not use Chrome - based «Electron» to make your desktop GUI app

 

The introduction

There are many GUI frameworks out there in the world nowadays. Most of them are closely tied to the programming language: Qt (C++), .Net (C#), “Electron” (JavaScript), Swing and SWT (Java) to mention few. Since JavaScript is a bread and butter for Web UI developers, they think that having Electron is a shortcut to the desktop world and their familiar Web techs fuel their new desktop thing. Apparently so, however it is not fully true.

1. Limited desktop GUI capabilities and user experience.

Lets see what desktop applications lately have been built using Electron: Skype, Slack, Microsoft Visual Studio Code, Tusk (Evernote Client), Discord, WordPress Desktop, newly revealed by Elon Musk’s team - SpaceX Dragon Space Ship touch screen apps etc. We do not see among them any popular game or 3D modeling tool and you know the reason why, the Electron gives you the Web framework only. Everything you can show on a Web page can become a new Electron app. Also, soon you will notice that your “browser” app looks and feels like a Web page with all its slow transitions, heavy CPU cycles, and regular Web page experience. No more, and no less. In other words the Electron is designed for not heavy graphics, it is for entry-level experience “desktop” app creators who learned some Web stack only. Hey Elon, you could save 3-5% money on Electron developers salary for repacking Dragon Web pages into the Electron GUI app :-) Just use regular Chrome or Firefox and bookmarks!

2. Huge resources consumption.

Well, since this Electron app is the only stuff Dragon crew members run on their PC with sensor monitors, then this is not a big deal. Regular users who are running 5-50 small and big apps on their laptops is completely another story. Now, lets imagine that all these small and more advanced apps have been built with the fancy Electron by our happy JavaScript lovers. I started my Slack and Skype apps to see how hungry they are. Skype took 500 MB RAM, Slack eat 500 MB RAM also. Both they occupied 1 GB RAM, nice…. Think please, I started two messengers. I have 16 GB RAM, OS uses 1 GB with all drivers, services etc. Now Skype and Slack came in. I lost 2 GB just for 2 really typical messengers. So, if I will start Discord, then open Visual Studio Code without any files opened, then these Electron based apps will eat up 1 GB more! 2 GB of RAM just for 3 messengers and and a code editor, Electron guys, this is ridiculous! The startup time of these cr...ppy made apps took some CPU and my drive access time. And they are slow despite of the fact I use SSD drive and Intel i7 CPU. I would prefer not to give gigabytes of RAM to communication apps made with Electron, but rather to large test data in my local databases, running VMs on my laptop, and have more RAM for my regular multi-process C++ compile and link tasks.

3. Huge size of any apps.

This is another disadvantage of the Electron framework, you will need to carry the entire Web platform with your app to users. Even if you make a tiny GUI app that targets some network (Web) operations you can not pack the app in a megabyte. Rather you will occupy 300 – 600 MB on your users drive. An the next Electron app will occupy the same amount of space. 10 simple Electron-based apps will eat 3 – 5 GB of your drive space. Huuuhh..

4. Security concerns. 

In a Web browser users have password managers, SSL certificates warning, CORS protection and other security measures - all that learned from Web attacks during decades. What does Electron framework provide and what do JavaScript app developers employ to secure their apps? This is a very big users' concern now.

The conclusion.

If you are entry – level Web developer and wish to enter the desktop app market with a MVP, then this Electron is a “silver bullet” in your hands. And then, be ready to learn really powerful GUI frameworks and compiling programming languages (to avoid frustrations while hunting for bugs and security vulnerabilities). The reason is - your users, they do not want to pay bucks for tens of limited, slow, heavy, buggy (always in the dynamic languages like JavaScript), possibly insecure (due to the lack of experience of JavaScript SDE novices)  and non-native looking Web based apps.

And please, Discord, Skype, Slack teams, rewrite your Electron - based apps with 5-10 times less resource - hungry tech frameworks and programming languages, some people are forced by bosses to use your cr...ppy built apps!