Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Is Electron really that bad for desktop apps?
30 points by anoncoward1234 on May 6, 2018 | hide | past | favorite | 26 comments
I've been thinking of making a desktop app, but I keep hearing all this chatter about how Electron is really hard on memory. On the other hand, I know webdev, and learning C++ to make a native webapp seems like a steep learning curve (say by using something like Qt). Not only would I have to make different versions of the app for different operating systems, but I would also have to style the app using C++ which seems like a nightmare. CSS/js styling is so nice in comparison.

Is Electron really that bad? If so, are there any good alternatives that solve the two issues I mention above?




> CSS/js styling is so nice in comparison.

This is half the problem with Electron apps. I know perhaps Windows users are used to the random bullshit UI every developer comes up with (heck even Microsoft between it's own different software), but macOS users generally get very consistent UI's from native applications. Whatever you create using CSS is not going to fit in with that. If you need your app to be some special snowflake of UI design to stand out, it sounds like the actual functionality of it is commonplace or marginally different at best.

Also consider usability/accessibility. A native (i.e. Cocoa) macOS app gets lots of accessibility features 'for free'. I've heard it's possible to provide some/all of the same via Electron, but that its more work, and it's not done by default because it hurts performance even more than regular Electron apps.

Your argument about your reasons is literally the argument people use against the concept of Electron. "I want to do this, but I dont know how.. can I take a giant shortcut, and expect no repercussions?".

Electron is like those old Road Runner cartoons, where Wile E Coyote orders a "DIY Rocket" from ACME Corp, and sure enough, blows himself up.

If you know web dev, make a web app. If you want to make a native app, learn C/C++/Swift/ObjC/Java whatever.

Edit: I will clarify this with context. I do not write native applications. I have written a very quick (like, ~1-2 days total dev time) Cordova/PhoneGap app using similar tech, as an internal data-capture solution for people on a project (at the time, Safari on iOS didn't allow browsers to upload photos, and we needed to capture a lot of images quickly from our team on location, so I wrote a simple phone gap app and backend server, ran it from my laptop and installed the iOS apps from my laptop - it was never intended to be distributed)

So, that is one situation where Electron-type apps might be acceptable - if you need to do something quickly for an internal project, where a native browser doesn't give you the API, but Electron does. But Thats a lot of qualifiers, and you wouldn't be asking about it here if that was your intention, I imagine.


Depends.

I've downloaded a fair number of Electron apps, and ultimately deleted or aborted the download of most of them. VSC is the one that currently survives.

If it's something that needs most of a browser and HTML - like an email client that cropped up as a Show HN recently, or a client for a wholly online service, Electron may be the right choice.

If it's something more trivial like a notepad, reminder, or timer, Electron is just needlessly making it unfriendly thanks to start time, and memory load. Multiple MBs shouldn't be necessary for a timer or calculator but Electron will make that so.

You may say that we have lots of memory these days, and we do. But I run lots of things these days, and if I have half a dozen such apps running in background I basically have half a dozen instances of Chrome. That's quite an extra load on memory and start times. It's also going to be one of the early casualties if my (or family tech support) laptop is starting to run low on memory.

Last, I think there is something to be said for Electron as an early version while testing, especially while still exploring UI and feature changes as you can focus on that not platform issues. Once you know what is needed, 9 times out of 10, give them a proper native program.


> If it's something that needs most of a browser and HTML - like an email client that cropped up as a Show HN recently, or a client for a wholly online service, Electron may be the right choice.

I disagree. These are cases where it's especially bad to use a HTML view as the application UI.

If your application is essentially a HTML page, and it's meant to render content from a foreign source, which is also HTML, JavaScript, what have you - how do you do that? An IFRAME?

You know that Electron apps have lower security sandboxing than a regular web browser right? Who in their right mind would use a web browser to render a html page as the UI of a web browser, and hope that the foreign source page doesn't break out of it's rendered context, to influence the appearance or routines of the 'browser' that loaded it?


I think it's important to consider what your program is going to do. Discord, for example, uses Electron, and I'm perfectly happy with it (as are most of the millions of others who use it). It's a product with a lot of functionality and it makes sense for it to have slower startup times, higher distribution size, and more memory usage. But if you're planning to make a calculator, then Electron probably isn't the right tool.

That being said, I think the styling thing is a really important point that is often undervalued. I've written UIs in GTK, Qt, and Swing, and perhaps this is close-minded but I honestly can't take anyone who says that they're just as easy as HTML/CSS seriously. I mean, literally just look at how many beautiful websites are out there, and then how many beautiful, not just functional, native programs there are (in my opinion, very few). UX/UI is important, and I think not having to pull your hair out every time you want to move a button to the right 3 pixels and give it a prettier border is a big plus for Electron.


I agree, that a good UI is a very important thing in desktop applications and elsewhere. But, to me replacing the border of a button with something "prettier" is usually a UI defect and not an improvement. Desktop environments gain a lot of intuitiveness and ease of use by being consistent. And every damned web designer developing desktop "apps" thinks he has to invent every convention of UIs new, just to be prettier. Usually they loose accessibility, the ability to be used by keyboard and or the ability to render with different color schemes and resolutions. And what do they gain? Pretty borders that serve no purpose and make the UI unfamiliar to everyone.


Discord, Slack and other chat apps are the perfect example of when not to use electron. They should just be webapps.


In fact, I think The Discord desktop client versus Ripcord[0] illustrates nicely how much better a native solution can run.

[0] https://cancel.fm/ripcord/


As a user, I can't stand electron based apps. I want normal ass UI on my programs. In fact, on my desktop, nothing is an app, it's a program... Make your thing a program.


Your distinction between an app (short for ”application”) and program is highly confusing.


Exactly


Firtstly writing Qt desktop apps in Python is pretty popular so we don’t need to stick with C++ to write Qt app.

It is hard to understand people cares about memory useage when desktops nowadays have a lot of RAM. What average Electron apps annoys me is their constant high CPU load. Some apps take ~10% of CPU load all the time.

I think Electron itself is fine. Look at VS Code. It is fast even though it is written in Electron. The real problem is the bad habits of average Electron apps developers. The Electron devs usually come from Web where users can just press a refresh button or close it when browsers are slow. They don’t care about optimizing stuff.


> It is hard to understand people cares about memory useage when desktops nowadays have a lot of RAM. What average Electron apps annoys me is their constant high CPU load. Some apps take ~10% of CPU load all the time.

The problem with the RAM consumption is not when you run a single Electron app in isolation, it's when you try and run a few of them and suddenly you're running hundreds of Chrome threads and you've used 8GB RAM.


i'm fine with the ram usage. for me startup time is the bigger issue.


React native for desktop has my attention.

https://proton-native.js.org/#/


I've made desktop apps with electron and you can definitely make a decent one but it isn't going to be as fast. If it's a simple program it's not bad but if you're going to do any complicated computation you'll wish you had gone native. On the other hand, if it's not a complicated app, some people are going to wonder why this simple app is taking so many resources.

How about a compromise. Instead of c++ why not learn Python instead and use pyside QT. This was actually what I ended up doing coming from webdev. You don't get the steep learning curve and can get a lot of the benefits from native apps. It won't be as fast as C++ but you won't have the overhead of electron. And besides most apps probably aren't going to need to brute performance of C++.


I think it depends who your audience is. Everyone I work with is more than happy to install the Slack electron app, but none of them read HN.

If your intended audience is a 'Show HN' expect to be damned for it. If your audience spans say Windows and Mac and are technical but perhaps less technical than HN readers it can be an easy way to extend your web app onto the desktop.

Also it might depend on whether your app needs to always run in the background or not. For example I use Pencil [0] for UX mockups, it doesn't bother me that it's an electron app because I only need it for a few days a month. However the persistent RAM use of Slack eventually annoyed me enough that I uninstalled it.

[0]: http://pencil.evolus.vn/


Consider Chromium Embedded Framework, or Sciter. These too let you define your UI with JS/HTML/CSS, but you're not shipping a node.js server with your app, which makes your app much lighter.


I believe it is Chromium that's the main bloat point in Electron, not the node.js.


In that case why not just make a webapp?


Because you can still have a "backend" hosted on the user's computer, it just doesn't have to be node.js, could be something more efficient or powerful or whatever is needed.


No idea about Electron but I am used to desktop application especially in Qt, With Qt Quick (QML + Javascript) I have been able to make a cross platform application that runs on all desktop (Linux, Windows, MacOS) and all mobile (Android, iOS). Yes it requires some effort but it makes a nice result that seems native on all platform.


I've built a few Electron apps now, one of which I use quite a bit to track ticket prices in secondary markets.

It's a great prototyping environment, and people have built businesses around Electron apps (VSCode is built on Electron, I believe). The apps I've built are big, kinda slow, and as others have mentioned tend to eat memory.


I'm assuming if you are tracking ticket prices it needs to be connected to the internet, in that case, why do you need an app instead of just a website?


> people have built businesses around Electron apps (VSCode is built on Electron, I believe)

Wat. Microsoft isn't "built around" VSCode.


The evonomics of it are still good but at the same time you can use chromium as a web view and often that's better. Where I work rather than electron we use a chromium based webview with a native windows desktop rather than electron.


The first question I'd ask is do you really need to be cross platform? Because if not you can save yourself a lot of pain by avoiding C++ and Qt and choosing what's appropriate for the platform (C# on Windows, Swift on macOS).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: