10 ms·
Why Electron Is a Necessary Evil
- TekMol 5y agoUnless you’ve been living under a rock for the past 5 years,chances are you have used an Electron-based application at least once in your life. What does it mean to "live under a rock"? I have never used an Electron app because all my needs are covered by termial applications, Firefox, LibreOffice and Gimp. Which rock do I live under?
- zarzavat 5y ago> Which rock do I live under? Linux, apparently.
- yepthatsreality 5y agoNone of the listed software is exclusive to Linux.
- bern4444 5y agoSome common and widely used electron applications are VSCode, Spotify, and Slack. I think Microsoft teams might also be electron based but I'm not sure. There are many more as well.
- TekMol 5y agoSure. But I don't use those.
- omarhaneef 5y agoHave you used any of them "at least once in your life"?
- doctor_lollipop 5y agoNot the OP, but no, I have not. Nor do I intend to. Ever.
- omarhaneef 5y agoI don't have a dog in this fight but I think it is safe to say it is rare to never have used it, if only out of curiosity.
- TekMol 5y agoNo
- OldTimeCoffee 5y agoI believe Teams just switched to Edge WebView instead of Electron. The point remains that native applications are starting to only be specialty applications like games, CAD/CAM, Creative Suite, etc where you need a lot of access to compute power.
- neoberg 5y agoI think we will see more web based versions of those speciality applications. There is already an Autocad running in browser.
- OldTimeCoffee 5y agoYou know, I forgot about WebGPU. If you have GPU Compute support I could see a full featured web version being technically possible. AutoCAD Web is really limited compared to the native application. The Web is just fulfilling Java's 'Write Once Run Everywhere' promise.
- hpb42 5y agoIsn't Spotify for Linux in C++ with GTK? $ ldd /usr/bin/spotify | grep gtk libgtk-3.so.0 => /usr/lib/libgtk-3.so.0 (0x00007f06b545d000) How do I check if it is an electron app?
- hcjrmemeld 5y agoYou are so decadent, using bloated memory hogs like Firefox and LibreOffice. What's wrong with lynx, bc or GraphicsMagick? Why do you feel the need to use graphical applications? They make no sense when you can do everything in a terminal.
- johnchristopher 5y agoKeyword being "chances".
- guilhas 5y agoExactly, a most electron apps work on the browser or have good non electron alternative I have tried some but that's about it
- caconym_ 5y ago> What does it mean to "live under a rock"? "Living under a rock" is an idiom used to describe one who is/has been cut off from the mainstream. > Which rock do I live under? The rock of literally never having used any of the ubiquitous communications tools built on Electron (Discord, Slack, Teams off the top of my head), or any of the very popular^[1] code editors built on it, or any of the countless other applications that use it. I'm sure you get your work done just fine, and this is not a value judgment. It's just an observation that, at least in the set of people likely to read (or "read") this article, you are a member of a (presumably) small and ever-shrinking class. Electron is everywhere. ^[1] https://insights.stackoverflow.com/survey/2021#section-most-popular-technologies-integrated-development-environment https://insights.stackoverflow.com/survey/2021#section-most-...
- tylerscott 5y agoI would definitely recommend the author look at Flutter again now. The comment there was back in July. The desktop experience has greatly improved. I have been building out a desktop-first set of components and it's been a real joy to work with.
- jmnicolas 5y agoDart / Flutter lacks essential libraries: you can't do ssh / sftp on desktop for example. As a side question, Do you parse JSON in your apps? If yes what package do you use? I tried built_value, I suspect the people that developed this really hate me personally ;)
- tylerscott 5y agoFor sure there are alot of things missing like you mention. Another I find personally frustrating is so many libraries assume you are using the Material stack. RE: JSON--I have used json_serializable in the past: https://pub.dev/packages/json_serializable https://pub.dev/packages/json_serializable. For my current project, I am using a data format I created call Traindown (https://traindown.com https://traindown.com) and it's all local so I haven't hit JSON or SSH/SFTP issues personally. Sorry I don't have a silver bullet suggestion for ya! I'm sure they don't hate you personally. Maybe all of us as collective "users" but not YOU! haha
- jmnicolas 5y agoSadly json_serializable seems to use code generation like built_value. I'll check it anyway, it can't be worse than built_value! Thanks for the suggestion.
- datenarsch 5y agoSorry, but no. Electron is the absolute worst piece of technology that I have come across in at least the last 20 years. It's not only that it is bloated, ridiculously resource hungry and terribly inconsistent because every program has it's own set of UI controls, but it's also just absolutely plain terrible to work with: The APIs are a complete mess, half of them are not working properly, things constantly get broken between even minor version revisions, the documentation is usually outdated and incorrect and you need to plaster your code with OS-specific if-else statements all over the place because many of Electron's APIs behave differently on different OSes. The whole thing is just a complete disaster.
- barrenko 5y agoYes, just no.
- spoils19 5y agoAgreed completely. In terms of the absolute worst piece of technology, there have been no applications that have even been shipped successfully with it, and every developer who uses it is probably encountering some form of s=Stockholm syndrome, or they're inexperienced enough as developers to not see the value of native applications.
- dhosek 5y agoHe talks about short-lived applications, but on my Mac, it's rare that I launch a new application. I have most of my apps running all the time.
- pixelgeek 5y agoAnd I can't do that with any of the Electron apps that I use with the exception of Nota which just sits in the background not doing anything since it is a text editor. If I keep Tabby open for too long it starts to spike the CPU and I suspect that this would be the case for any active Electron apps.
- johnnyapol 5y agoMy major annoyance with Electron is every app shipping its own version of it, particularly on Linux where most distros tend to ship electron in the repositories. I'd really rather not have 5 different chromium versions - that are lacking security updates - on my system. I wish packagers were more aggressive about not bundling them.
- dmitrygr 5y agoIt is interesting that you say that. This is fact already exists. An unbundled version of electron, that can be used by multiple applications, is called a web browser. Applications using it are called websites (or PWAs if you must)
- johnnyapol 5y agoUnfortunately, certain applications are gimped if you don't use the electron version. A notable example of this for me is Discord where push-to-talk doesn't function in the web version due to API limitations. Another app I use that has this problem is Spotify. While it isn't electron, it is using CEF (chromium embedded framework) and can be dynamically linked to a distro one with some effort. Using the web version means I dont have my music available offline for listening.
- hs86 5y agoEspecially, most of these chat apps have functionally similar web/PWA apps. In those cases, I prefer to install them as desktop PWAs or use Chrome's "Create shortcut" feature to get them into my Dock/Taskbar. One little bonus is that my browser extensions also apply to these installed PWAs. For example, the Todoist PWA now shows me the Toggle icon next to each task as an easy shortcut to start the time tracker. In my case, I have these running as Chrome PWAs: - Raindrop.io - Grammarly Editor - Todoist - Discord - Element - Whatsapp - Twitter And these are still running as regular Electron/CEF apps: - 1Password - Obsidian - VSCode - Gitkraken - Slack - Spotify Whenever the web alternative catches up with the Electron app, I move to the PWA. Probably the biggest drawback of this is that Firefox is not a suitable alternative for me anymore :( https://bugzilla.mozilla.org/show_bug.cgi?id=1407202 https://bugzilla.mozilla.org/show_bug.cgi?id=1407202
- commandlinefan 5y agoIf it didn't say "Electron" in the title, I'd have thought he was describing Java. I don't see why Electron itself is a necessary evil - Java has been able to do all of this (just as badly) for over 20 years.
- dokka 5y agoAt least java is actually typesafe
- cwdegidio 5y agoAnd has a rather stable ecosystem. I've been doing front-end development for almost 10 years now and have started moving into more Java based projects recently and after living through the "flavor of the week" hellscape that is the JS community, I'll take Java's stability any day of the week. And I say this as someone who does actually love JavaScript.
- criddell 5y agoJava is very lean compared to Electron.
- JCWasmx86 5y agoAnd you can often have only one JVM installed. (Maybe not the average user after the JRE was killed, but at least theoretically it is possible)
- kache_ 5y agoThe main computing constraint isn't the hardware that the software is running on, but is instead the wetware that creates the software npm install --save electron
- viktorcode 5y agoFair points on downsides and upsides of using Electron in development. But there's huge gaping hole in this logic: the points are given from the perspective of software developers, not software users. Users, given the choice between native and Electron, would overwhelmingly choose the former. Speaking as a user I don’t care about your production costs and your programming knowledge. I care about my experiences. That’s why many Electron-based programs are marketed to managers as “solutions”, not to the actual end users. As a macOS user let me add to the list of complaints mentioned by the author. Despite having fully functioning native iOS apps, some companies will not allow installing those directly on M1 based Macs, nor would they produce a rather simple ports for macOS. They will insist for you to use Electron-based client, like everyone else does. Teams, Slack, Discord. So I do agree that at least in this case Electron is evil.
- neoberg 5y agoAs an end-user I love Electron because it allows products to evolve quicker and across all platforms. I would choose an Electron app (or if it runs in a browser, even better) over a native one.
- Msw242 5y agoIf a user had to choose between a native app and their top 10 most anticipated features, which would they choose?
- laurent123456 5y ago> Users, given the choice between native and Electron, would overwhelmingly choose the former. They might choose the former but then what? I would too, as a user, but in practice as the article mentions the alternatives aren't yet that great. So quite often the user can choose between the Electron app... or nothing. Many users accept the drawbacks and in fact it's mostly developers or technical people in general who complain about Electron. Most users don't even know about any of this.
- viktorcode 5y agoThat's a great point. Choice is often between Electron or nothing. Why? Because even when they can afford it, software development corporations prefer to save money on the development. Even if they save peanuts, as in my example regarding apps on M1. Obviously, this can exists only when there's no or minimum competition for the end users.
- jcun4128 5y agoI made a couple of basic CRUD apps with it and it was pretty cool. I could build a React app and then build the electron app based on React's build folder and it just works. I'm still working on learning C++/something like QT but I was able to deploy an app to Win/Lin/App. For reference Cross platform CRUD app (desktop, Android RN app) https://github.com/jdc-cunningham/cross-platform-app https://github.com/jdc-cunningham/cross-platform-app Basic news slider app but it was transparent https://github.com/jdc-cunningham/frameless-electron-news-reader-desktop-app https://github.com/jdc-cunningham/frameless-electron-news-re...
- bluetidepro 5y agoI always get a chuckle at all the hate Electron gets on HN, or in very technical communities. At the end of the day, so many people fail to realize the success of Electron is in making desktop applications so much more approachable for those that are mainly front-end focused developers/hackers. I have played around with Electron in the past for fun "nothing" projects, and also tried to understand what many on HN would want as the "correct" way to build native apps. It's an indescribable difference how much easier Electron is to get up and running from my experience, as someone who primarily does front-end work. Are there better ways to build native apps? Of course. Electron still solves a massive problem for many developers and end-users that I don't understand why so many here get on their high horse refusing to acknowledge. It's similar to PHP hate to me. Of course there are better languages to use, but things like WordPress using PHP are so much more approachable for so many developers.
- test_account_j 5y agohaven't you noticed yet? HN is full of techies who think front-end should barely be a separate discipline
- smachiz 5y agoBecause the worst abusers of Electron can afford to have dedicated teams for platforms. Do you think Slack can't hire enough developers to build native platforms for Mac/Windows/Linux? Spotify? Discord? I get it for small dev teams to build a cross platform app - but at a certain size, I don't understand why they can't go build native apps that aren't garbage.
- rektide 5y agoGreat article. It starts by setting forth a good basis, that I think covers almost all of the primary Electron complaints. There's a very outraged comment decrying these plus also a difficult messy dev story[1], but generally I think the article starts by outlining the criticism fairly well. After enumerating the problems with Electron, the article outlines a wide range of alternatives. This is such a great exploration! I love love love for example the idea of localhost http servers. The article discusses them! I feel differently than the author, but great & honest review: > I know this is highly subjective, but I really appreciate having a separate window for each application, along with good OS integrations such as native menu bars and dialogs. Covering up & coming webview embedders like Tauri really won me over. The author showed a deep & expansive knowledge of up & coming alternatives, that still make use of the wonderful great web platform so many folks know & enjoy: > Many projects are trying to overcome Electron’s drawbacks using this approach, such as Electrino, webview, Tauri, and many more. And it highlights that these alternatives still lack a lot of standard native integration, that it's not yet baked in anywhere near as well as Electron does: > You see, if you choose this approach, you will need to do a lot of “plumbing” yourself, as you don’t have access to any of the convenient APIs exposed by Electron. Do you want a menu bar? You have to write the low-level bindings yourself, often multiple times depending on the number of platforms you are looking to support. I'm hoping some of these up & comers continue to advance, continue to make inroads. Electron has been 100% a magic bullet for countless great apps, big and small. Is it 100% painless? No. But it's pretty damned good, and it marries good UX development to the power & capabilities of server-side technology, in pretty excellently & unique cross-platform way, and that's a really great combination. [1] https://news.ycombinator.com/item?id=29420450 https://news.ycombinator.com/item?id=29420450
- verall 5y ago> There might be a chance to dynamically link the LGPL version and avoid paying for the complete license, but that’s not always possible. This is such FUD. The normal way to use Qt is dynamically linked, it is not difficult to use the LGPL version, you most likely don't use the premium features, and the restrictions are about using Qt to create embedded devices. There are good reasons not to use Qt, like that many teams don't have the discipline to maintain a large C++ gui application. There are plenty of crap broken Qt apps because it is easy to screw up. There are few responsive electron apps because it is difficult to make fast. Easier to make a mediocre app in electron -> classic worse is better in action.
- friedman23 5y agoA lot of people hate electron but frankly, it's the future of desktop applications and probably the future of mobile applications. The browser is currently the best implementation of a true cross platform framework. People complain about nebulous concepts like "bloat" but I think fragmentation across platforms is just as if not more harmful and bad. For mobile for example, I exclusively build native iOS apps because the ecosystem is superior and I simply do not have the bandwidth as an individual to maintain software for 3 unique platforms (web, iOS, and Android) so I just don't build Android apps because the android market is just not valuable. Also as a user of many electron based apps, I currently use apple silicon native electron apps on my m1 macbook air and they are extremely snappy with only 16gb of ram (go download the canary version of discord which is compiled to apple silicon if you want to see the difference). If there is one entity that I'm truly angry at it is intel for completely mishandling and holding back the desktop processor ecosystem for the past decade (or longer).
- aaronbrethorst 5y ago"Did you notice that most desktop apps that feel snappy don’t include any animation?" well, this is patently false. https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/animation/ https://developer.apple.com/design/human-interface-guideline...
- JCWasmx86 5y ago> Code once, deploy on Windows, macOS, and Linux This is a major pain point of electron. Sure you can save some costs, as you only have to write one GUI, but the result is always really bad. The only electron application that is even remotely usable is VSCodium. MS Teams is a slow dumpsterfire and a mess of UI (Why do they even implement own "Close Window" buttons?) Furthermore it is simply annoying if an application does not look like the rest of my desktop
- jrm4 5y agoAs an amateur programmer, it really does feel like Electron would be one of those things that's absolutely garbage except for literally everything else which is even worse. I am able to do and automate all sorts of very cool and amazing things that wow friends and family, mostly through bash as well as some Python. And then there's GUIs. It makes no sense that they are this hard to program. If it's the tiniest bit more complex than something that can be done with Zenity, it's probably not going to happen. Nothing comes close to being as easy as some web-type GUI, which aren't themselves that easy.
- criddell 5y agoFurniture made by a very skilled craftsperson is often beautifully finished even on the surfaces you don't normally see. Quick and easy may often be the best way to do something, but sometimes you end up doing things the hard way because you care about making the best thing you can.
- asoneth 5y agoThis is a great point. I have a few pieces of furniture hand-made by skilled craftspeople and they're lovely. But most of my furniture still comes from Ikea and the like because it costs at least an order of magnitude less to build and ship. Electron will continue to grow in popularity for similar reasons.
- criddell 5y agoElectron will continue to grow for sure. There is, however, a big difference in the effects of scale. The marginal cost for another piece of high quality (or even low quality) furniture is high. The marginal cost for one more copy of Microsoft Teams is almost nothing no matter which technology Microsoft uses to make it.
- jrm4 5y agoBut what about productivity lost by not using something better like Discord sorry couldn't help it
- pixelgeek 5y agoI wish writers would stop using overdone intros like this "Unless you’ve been living under a rock for the past 5 years..." I see this sort of thing and I just want to stop reading. Only worse is "This isn't your father's..."
- markus_zhang 5y agoI think the hidden reason many hate Electron is because they are forced to use software written in Electron by the choice of their companies. For example I'm forced to use Teams at work but I don't even have Teams on my personal laptop.
- JCWasmx86 5y agoI would give soo much for a native GTK MS Teams client
- rado 5y agoMost software today is bad, Electron is worse. Tolerating such concepts leads to mainstream software abominations like the Epic Games Launcher. In a world ever so dependent on technology.
- akacia 5y agoThis. Good software can be made even when using Electron - just take a look at Visual Studio Code. It pains me during my work as a software developer how many times we have to cut edges, because companies want to minimize their expenses (and developers get in a habit of doing so even when they don’t have to).
- dTal 5y agoThe problem with Electron is that it shouldn't be necessary. We all already have web browsers installed. Why does each application need to bundle its own? Because browser vendors refuse to provide useful APIs?
- Decabytes 5y agoElectron exists because cross platform native desktop development is a terrible experience, and many developers (some who even frequent HN!) prefer going with the easy and fast route (due to a variety of pressures) over the native route. It’s the same reason why people gravitate towards MIT and Apache licenses over things like lGPL. It doesn’t require a developer to think as hard if they are in violation of the license with their project. Though plenty of developers still screw this up even with those licenses (see the devs of sonic colors ultimate and the violation of the Godot Engine’s MIT license)
- pixelgeek 5y agoI get the feeling that we could all just copy and paste our comments from the last Electron post. I doubt anyone is going to chance their mind about it. It is the jQuery of cross-platform development.
- c-smile 5y agoAs of sizes ... For Sciter Quark ( https://quark.sciter.com https://quark.sciter.com ) I've measured size of minimal "Hello World". - Electron: 50 MB on disk, 200 MB of RAM and at least 2 processes running. - QT: 5 MB (and 30 MB if + QtWebKit) and ~70 MB (200 MB if QtWebKit) of RAM. - Sciter Quark (standalone Sciter executable): 5 MB on disk, 32 MB in RAM. That includes HTML/CSS UI, JS engine, NodeJS alike runtime. Out of the box Sciter works on same platforms as Electron.
- gwbas1c 5y agoI worked on a cross-platform C# application that ran on both Mac and Windows. I really liked the language and most of the experience. The biggest problem was that the C# toolchain was very glitchy on Mac. (I did have to write shims in C so that Objective C could call into C#.) In our case, C# was the right choice because of what the application did. (There was no way we could be web based.) For many applications, Electron (or similar) is the right choice. We did have two native UIs: WPF and Cocoa. The Mac developers eventually figured out how to use C# models and controllers from Objective C. Again, I would only recommend such an approach if you need close integration with the UI. We had tray/taskbar icons, filesystem watchers, drivers... Things that really don't make sense to do in something like Electron. I'd also like to point out one advantage of Electron, if you can do it: Garbage collection. I personally find memory management in C/C++/Rust a chore, so if Electron is "good enough," you get all the advantages of V8's garbage collector.
- dangoor 5y agoHopefully, we'll start more commonly getting the benefits of Electron in a leaner package as with Tauri[1] or Wails[2] [1] https://tauri.studio/en/ https://tauri.studio/en/ [2] https://wails.io https://wails.io
- _some_r222 5y agoSome sample experiences: At my workplace I'm using Electron to build a data heavy application (bill of material, 3D visualization). Performance is spectacular, especially 3D visualization of very large models (threejs). I'm using agGrid for the tables. Also extremly fast and powerful. The users don't care at all that the app is 93 MB and takes 3-5 seconds to start. They love the app for the performance, features and ease of use. I consider Electron as a great success in this case. I'm using VS Code, Obsidian and Todoist daily. I love them and don't care that they're Electron apps.
- mid-kid 5y agoI love how he takes a huge, highly custom (custom widgets and things everywhere) and unoptimized Qt application (Telegram Desktop), that as of late has started shipping with a version of WebKit for some functionality related to payments, without mentioning it's unreasonably huge for a Qt application. Apps like qbittorrent are a third of its size, and this is not mentioning that platforms like linux have Qt installed as a system-wide library, making the whole size comparison moot. (you cannot install and use a system-wide version of electron for most electron apps). He also fails to consider that there's bindings for all native platform UIs for a ton of languages. You could write gtk code in javascript or C# if you wanted, and this is especially relevant when mentioning WxWidgets. You don't have to write your business logic in C++ these days.
- greenhatman 5y agoSimply, a lot of software that makes people's lives easier wouldn't exist without Electron. So yes, Electron is good. The same amount of effort spent in Electron wouldn't get you a better native app. It would more likely get you no app.