145 points · by djsumdog · 7y ago · 183 comments
Electron is a free software platform that builds on the open web standards. It uses the Chromium browser, which is available on every major platform (that permits browser installation, that is). And it works with "walled garden" stuff like iOS/Safari, because the modern web actually does a pretty decent job of coordinating standards.
If you use Linux desktop, you should be cheering loud and proud for Electron, because that's how Spotify, Discord, and many other apps have full feature parity between Linux and Windows and macOS.
From most people's perspective, that "intrusiveness" is the reason they're using a desktop OS with desktop apps, rather than e.g. ChromeOS.
I agree that I'd rather have an Electron-based app on Linux than no ability to use an app at all, but that doesn't mean we shouldn't demand better (like React Native!). I run zero Electron-based apps on my laptop. They destroy battery life and slurp RAM to an unacceptable degree.
How can the primary issue being it was proprietary, yet you then say its open source nature was the security issue? Is there a way for something to be both open source and proprietary at the same time?
Rarely software is targeted for Linux, which means there are less mainstream apps than windows or OSX, which means less people using Linux.
I want more people to use Linux, electron has been great at helping build that userbase, so despite its flaws, I welcome it.
That doesn't mean Electron and its use shouldn't be criticized, scrutinized, or optimized, but it's more than just "these young'uns being too lazy to learn a new language".
So the users are using more electricity and creating more carbon emissions so the development team can do more with fewer people. In a way, it's a way for a company to outsource a part of its development expense to its users and the environment.
How much extra energy does allocated RAM use vs. unallocated RAM? RAM has to be powered as long as your computer is on. I don't think there's any difference.
It's fine to be passionate about the environment but it's also important to be realistic and fact-driven. It really doesn't make sense to be telling people to make the most minuscule adjustments to carbon footprint instead of the easy low-hanging fruit (eating less red meat, buying fewer disposable products, being mindful of unneeded purchases, reusing and repairing possessions and purchasing them pre-owned).
Turning your screen brightness down, banning Electron, or running Lynx instead of Chrome isn't going to save the planet, even if all 7 billion people in the world did it.
We can debate whether an individual one of these tradeoffs is a good one, but layering is a fundamental aspect of software engineering and it's hilariously misguided to suggest that it's an inherently bad thing to do.
Every technical complaint was trivial compared to that.
Electron is only the best way to do something when someone knows only javascript and web dev but doesn't want to learn a new language. Maybe a case could be made for severe misconceptions also helping electron like 'a custom native app has to be made for each platform', even though C++ and Qt and many other combinations can be written once with 99% of the source being the same for every platform.
Why is there always someone ready to jump in with this elitist nonsense? There's plenty of reasons to use a web stack even if you know other languages. It's inherently crossplatform, has an extensive library, and is extremely quick to iterate on.
Slack and Discord building in Electron means they only need to maintain one codebase across web, desktop, and mobile. They don't need separate teams for building in Java, Swift, and C#. They only need to write a new feature once. Crazy, right?
This "web programmers are dumb" attitude is nothing but elitist rhetoric. Cut it out.
Meanwhile, almost daily I hit so many issues with the macOS application that I have to walk away from my computer in frustration. It makes my working life miserable due to its poor performance and bugs, and it encourages awful organizational and communication habits.
The GP's point was that, in the year 2019, none of these features are unique to the web.
• For "frameworks", there's Silverlight, Adobe Air, Haxe, and—strangely enough—Flash itself, which still works just fine if your goal is to ship a standalone "projector" app rather than something that runs in a browser.
• Or you can use a cross-platform scripting language (e.g. Python) with a cross-platform GUI toolkit (e.g. QT, WxWidgets.)
• Or you can use a not-cross-platform language (e.g. C#) but just use the (pretty large) subset of that language that is compatible with a third-party cross-platform runtime (e.g. Mono). Before you laugh, this is exactly how many companies code games to be cross-platform: they just write them for Win32 but constantly test them under Wine to ensure they aren't breaking Wine compatibility. Then they ship one native version and two virtualization-layer-wrapped versions.
• Or—horror of horrors—you can just use Java, and use the various Java-to-native-X compilers to target mobile platforms like iOS. (It worked well enough for Minecraft!)
The web has all of them, I have yet to find another platform/language that meets all the same criteria.
Combine all of the above with a rich toolchain and extreme dev tools portability -- I can be up and running on basically any machine in minutes. As well as ease of deployment (at least for hobby projects).
All of those other platforms are, for me, less in one of the axes I care about. I've developed extensively in Python, C#, and Java for both personal and professional projects and while I like developing in them for many, many reasons, when I need to start a new project I nearly always find myself reaching for Javascript as the starting point.
With the exception of Haxe (and maybe Air), these are all dead or dying technologies.
Options 2 (Python/QT) works great, but is certainly more development hours and still requires platform-specific code.
>It worked well enough for Minecraft!
Minecraft was rewritten in C++ for mobile. It doesn't use Java.
Did you know that Slack has native iOS and Android apps, as well as a cross-platform C++ "LibSlack" run by another separate team?
https://doc.qt.io/qt-5/qtwidgets-mainwindows-application-exa...
You didn´t really counter the parent´s post with an argument. You just pretended to do so by suggesting an alternative that is incompatible with the requirements he had in mind because you think you know better...
huh!? When did this happen?
Spoiler Alert: It didn't.
I don't think that's the attitude. The attitude is that they are lazy/stubborn, not dumb. I personally believe most developers are smart enough to keep learning. Whether or not they are willing to put in the work is the question.
Because it's absolutely true. You'll know it once you watch a web dev try and work on desktop app.
Yeah!, why you old farts want me to learn about the stack, the heap and all of that OS architecture crap?, I don't need or want that #$@&*, I barely can keep up with all the JavaScript frameworks/libraries/toolkits that came out last week!
What toolkit or library would you propose instead? Seriously, what are these great alternatives? Doesn't necessarily have to support JS.
* GTK
* Qt
* WPF for Windows
* JavaFX
* Tk
* LibUI
I'm rooting for https://github.com/revery-ui/revery/ right now too, but it's still early in development
GTK hasn't been well maintained or developed for ages and has always had poor docs. I wouldn't feel confident trying it on any platform which isn't its home (i.e. Linux).
> Qt
Qt is probably the best option in the list but it's language support is poor, only C++ and Python are practical. It is a big fully featured and mature library, but developing with QML is a poor experience compared to the tooling available on Chrome/Electron. Packaging and distributing Python and/or C++ Qt apps is a huge PITA too.
> WPF for Windows
not cross platform
> JavaFX
JavaFX looked interesting but just didn't seem to take off and develop a reasonable ecosystem around it. Certainly nothing that could rival the web ecosystem. I do love the language support that the JVM delivers. Regarding deployment size it isn't likely to be much better than Electron as most apps have to ship the whole JVM anyway. The stench of Oracle does taint it these days too.
> Tk
be serious
> LibUI
This isn't mature yet and it looks like another optimistic adventure in "write once, debug everywhere" like WxWidgets.
None of the options here can compete with Electron in terms of ecosystem or developer experience (often Chrome's dev tools). Nor are they built on open standards. Also JS is up there with the JVM and .Net platform in terms of languages which target and can run on it.
There are some components I'd ideally like to avoid rewriting for my web and desktop applications. (E.g. why should I have to write render code for my friends list component more than once?)
For example, there are a number of desktop Facebook Messenger "clients", that can pop OS notifications and so forth. They're all based on Electron. None of them are built by Facebook.
Similarly, there are a number of desktop Gmail "clients", not built by Google. They're all Electron, too.
The only alternative to this approach, would involve reverse-engineering the company's web-app's (proprietary, undocumented) API to write a native client library for it, and then constantly fighting the company as they try to block your native client library from being able to access their backend service. Some projects do that (there are at least two "native Gmail clients" that are actually native and are built on a reverse-engineering of the Gmail web-app backend API) but it's really not worth it if you're just a dev trying to scratch your own itch of wanting better desktop integration from these web-apps.
You "can" write a proprietary app with Qt and you wouldn't have to pay for it.
With most software developers and most managers not moonlighting as lawyers, misunderstandings are to be expected.
They may have solved this since by using a custom allocator on windows for Qt types.
Well, there's one exception - it sure is more productive if you already have a webapp to reuse.
and when you want to fire all the obsolete specialists while making a product with one person that works for everyone. I mean, you can keep one specialist, since they know javascript too
> I mean come on. Its a text chat program.
Seriously? To boil Slack down to just a chat program is silly, when you look at all the feature it has with it (screen sharing, calling, file sharing, etc.).
Electron hate is the new PHP hate. As I've seen many others say before on HN, what people don't seem to get is the experience of using Electron is miles ahead of anything else in convenience. Instead of writing a blog post ranting about Electron, why not be constructive and talk about solutions or alternatives? Wouldn't that be more productive?
EDIT: Didn't realize this post was from 2016. Seems way out of date, carry on, nothing to see here.
I—and I think a lot of other people—want a version of Slack that does not have these things, and is lighter thereby. Just an IRC-like interface for Slack where every file or image uploaded is just a URL that will open with your OS-configured web browser.
(Yes, I know there are a few attempts, but they're CLIs and I do still want a GUI Slack. There's no reason for me to be reading conversational prose as monospace text with no styling. There is a place between plaintext and full-on HTML, called "rich text", and every proprietary chat program in the 90s sat in it and used next-to-no resources. Where has "rich text" gone in 2019? Everything is seemingly either plaintext or full-blown HTML webviews.)
The new thing that people hate because it makes their work life bad? That is harsh criticism indeed.
>what people don't seem to get is the experience of using Electron is miles ahead of anything else in convenience.
That just blatantly isn't true. QML has the same "write markup run JS" idea and WPF is just XML bound to whatever .NET language you want. They might take a few minutes to learn if you already know web programming, but once you start writing code it doesn't take any longer than writing the equivalent HTML/JS/CSS. Like the OP said, React Native accomplishes the same but runs 1000x better. Getting people to step away from Electron for 5 seconds, especially when they have the resources to do so (i.e. Slack being able to raise $400 million this year, Discord raising $150 million, etc.) It's insane that none of these companies have spent the tiny amount of time working on some open-source framework that's better than Electron.
I was starting to build an Electron app recently. My "hello world" app was using about 200mb, and so I was thinking things looked pretty good, and it wouldn't be too heavy if I was careful.
Then I noticed there were actually more system processes involved with the app that I realized, it was really using about 400mb.
Then I starting resizing the "hello world" app's window. I maximized it, minimized it, and shook my mouse furiously making the window all kinds of shapes and sizes. After this the app related threads were using about 1gig of memory. Just for a "hello world" app.
Now I'm always hesitant to accept claims that an Electron app isn't using much memory. Are you sure you're looking at all the related system threads?
* Non-native look and feel. Personally I think this is the big one.
* Applications/Applets took (take?) forever to boot. JIT takes a while to kick in.
* High memory usage due to heap+reference memory model and GC model.
* Latency spikes due to GC
* Installing a JRE is cumbersome for users
* Incompatible JRE versions are a pain for users
If I'm being perfectly honest, a lot of the problems people have with Electron were or are problems with JVM consumer applications.Discord does more with a fraction of the resources, and is also Electron. Atom is a giant editor framework, and is still less heavy than Slack in normal use.
Electron can run quite reasonably when you aren't an idiot/under complex enterprise requirements which probably explains Slack's load.
Then I discovered the multiple layers of hell of Swing's various layout managers. I never thought I'd actually find something worse than packing GTK+ {h,v}boxes. I think I might end up retreating back to Tk...
You could cross over to the dark side and embrace the Microsoft Heresy. C#/.net
Upside: Just works Downside: Other programmers will hate you.
Conceivably if it is any good, you could get programmers to hate you a little more or less by using F#.
That's going back quite awhile. Why is it that later layout managers just seemed to get a bit worse then stay that way?
Electron is not a problem is a symptom. People/companies want to write apps that run everywhere and that is actually a great thing. The problem is OS people not having their own little w3c to fix the problem.
Its starting to look pretty clear that sooner or latter all native apps will be coded in html css and some programing language (js or not) for the sake of being easy to port, so please OS people, get us a better solution than electron.
I don't think people are choosing Electron for efficiency. They're choosing it for getting results sooner.
Electron lets you pump out a reasonably nice looking cross-platform app that does what it's supposed to do, using a lot of your existing code, in a short period of time.
That convenience to developers can easily outweigh the trade-offs related to Electron's many flaws, especially when time and resources are very limited.
The browser just became the best ecosystem for build apps and the native development frameworks are years behind the browser. The default set of Widgets available will make you waste months building your own widgets versus downloading a js plugin and it's done in 30 minutes.
Electron just gets things done, period.
There are examples of fast Electron apps like Realm Browser. You can also build the UI with Electron and Javascript while you do some IPC with smaller binaries written in C++, Go lang, C#, etc. to try to improve the performance of some operations. It is possible to write good and fast Electron apps.
Don't forget that many js developers came from jQuery and other backgrounds and might not have the best ideas when it comes to build desktop apps and even understanding an OS architecture. I don't mean to be mean with these developers, we need to acknowledge that these days lots of companies just want Javascript developers and any cost.
Another major benefit of Electron is that platforms like Linux do get some support which is really great.
Without electron, I could not use Linux to work on projects that use Slack for example.
Without electron, many developer tools wouldn't exist at all and most likely they would be tied to windows and/or mac. Linux would be the biggest looser for sure.
Don't think it's fair to shit on Electron, I love fast apps but, sometimes, buying more RAM and a faster CPU just solves the damn problem. I'm not saying people should write slow apps but at the end of the day I've stuff to get done.
I would rather see a better collaboration to try to improve Electron because... we need it. Either this or the native development tools need to wake up to 2019.
It's not decent.
> I challenge you to give me a stack that It's fairly simple to maintain on multiple desktop platforms
C++ core library, thin UI layer on each platform.
> The default set of Widgets available will make you waste months building your own widgets versus downloading a js plugin and it's done in 30 minutes.
Why would you build your own widgets? The ones the OS provided have had years put into them.
The time required for coding in C++ is much more higher than javascript, just this point alone requires a bigger budget, time and a HR problem: hiring C++ developers vs javascript. You'll also spend more time configure each build for each platform, Electron has this automate for you already.
Web technologies are easier to learn: A designer can write CSS for your Electron desktop app but can not code the style in C++. It's just easier to add more people to the project. I'm aware than native tools do have IDE for designing UIs and easier markup languages like QML. Guess what, html and css are the true winners for the majority of developers/designers. The IDEs for native development are targets for developers, they don't account for designers. I've worked with several some years ago for windows, mac and linux.
> Why would you build your own widgets? The ones the OS provided have had years put into them.
The widget provided by the OS are basic. If you try to recreate a modern web interface you've to build each components by yourself. On the web you've plenty of option to quickly assemble a GUI. On Elementary OS, the OS style is done in CSS even though they use Vala/GTK+ to code the UI.
Also a cross platform GUI is a promise that is never delivered properly. With Electron apps can deliver a consistent UI: Slack looks the same regardless of the platform. With native, the UI looks good on one OS and like crap on others.
When Electron allows you to build a fairly complex app in 3 months, it's hard to sell native development due to the massive time you'll need. Just look at the React Native, it exists because it is a lot cheaper and faster than writing individual native iOS and Android apps.
I'm not convinced that this is true.
> The widget provided by the OS are basic.
Not really. I am yet to see an Electron widget that does drag-and-drop, accessibility, theming, keyboard control, etc. right. OS widgets are by no means "basic".
> Also a cross platform GUI is a promise that is never delivered properly. With Electron apps can deliver a consistent UI: Slack looks the same regardless of the platform. With native, the UI looks good on one OS
That's the whole point: I don't want my apps to look dumbed down to the lowest common denominator. Each native app looks good and fits in on its platform.
> Just look at the React Native, it exists because it is a lot cheaper and faster than writing individual native iOS and Android apps.
React Native is much nicer than Electron in this respect, because it doesn't package then entire Chromium engine and uses native controls to a limited extent.
Which, IMO, is fine! I don't use the Slack desktop app, I have a tab open in my browser. It can 'ping' the tab bar to get my attention, and it can send notifications. It works fine.
And chrome is a hog. Its huge and complicated. It uses ram and CPU like nobody's business, and it totally thrashes your battery life.
I remember when Chrome was the shiny, nimbler, new kid on the block.
Emacs was actually a great way to do work over a slow modem connection back in the late 90's.
Maybe WebAssembly will get us there with decent performance.
* Open other part of your app in new tab.
* Open other part of your app in new widow, and have time side by side.
* Open external link in new tab, in the same window (OMG!!!).
* I can send link from the web app to someone else.
* Consistent back button.
* Use browser extensions.
* Have cookies (i.e. I am logged out of most of the things in your in-app browser).
Composers are generally thing that are better in apps, but as long as I don't need to compose complex stuff, web app always wins. And if I do, I'll prefer to use native/electron app only for composing, not for consumption.
Man I hate the new web.
But yes, I hate the new web too (sometimes).
There are other apps, that are even worse. Allowing something to open in a new tab/window but identifying that there are multiple windows open and just disabling all but the main window...
I don't understand developers that do this. I always felt that multiple tabs is a strength of the web. They worsen it somehow.
In addition, has Slack performance improved since this post was written?
But really I think that filesystem access is probably the main one, at least for me.
https://www.outrunlabs.com/revery
It's build with Reason/OCaml and builds native self-contained binaries (~3MB for simple apps).