4 ms·
There are always many negative comments regarding Electron apps, so as a developer who has made a couple Electron apps let me briefly illustrate to you what the
by fabiospampinato 8y ago
There are always many negative comments regarding Electron apps, so as a developer who has made a couple Electron apps let me briefly illustrate to you what the advantages are:
- I can use the same UI components that I use for making websites and easily share code between all platforms. Maybe this will change in the future with the advent of WebAssembly, but right now no other stack gives you this.
- Bundling a cross-platform auto-updating app is wonderful. I just have to configure electron-webpack [1] and everything is taken care of. In the past I've made a password manager with GTK3 + Python, bundling it was a real nightmare and I don't think the situation improved much in the last few years.
- Sometimes, like when you're going to need a HTML renderer anyway, using basically a browser for rendering the UI can actually be an advantage, a couple of examples:
Example 1. Evernote needs to render their notes, basically arbitrary HTML, and the macOS app uses Safari's engine for this. Now they have to check across all platforms if their notes are always rendered the same, even for rendering a simple note they show you a spinner, and the native UI is arguably ugly anyway. In comparison my soon-to-be-released Electron note-taking app [2] looks more native to me, it's faster, requires less resources, and I get cross-platform support basically for free.
Example 2. I was using Ship [3], an app for managing GitHub issues. The native parts of the UI were written in Objective-C, the issue/comments part were written using web technologies, and their server was written in C#. What you get is an app that doesn't work across platforms and sharing code between all the parts of your application is basically impossible.
- Lastly I'm by no means an expert on other cross-platform UI toolkits, but some of them try to mimic the native widgets and do an awful job at that, as a result I don't have any Java GUI app installed because they all looked like crap to me, how many do you have installed on your desktop?
[1] https://github.com/electron-userland/electron-webpack https://github.com/electron-userland/electron-webpack
[2] https://imgur.com/a/ZQd8Vad https://imgur.com/a/ZQd8Vad
[3] https://www.realartists.com/blog/ship-20.html https://www.realartists.com/blog/ship-20.html
- LeoPanthera 8y ago> I can use the same UI components that I use for making websites and easily share code between all platforms. I propose that using web components for desktop/mobile applications is not a good thing.
- fabiospampinato 8y agoAs a solo developer using Electron means that I don't have to reimplement all the UI components I already have, and I can publish a decent cross-platform app, where instead of spending time reimplementing everything across platforms I can spend time optimizing it. I know of no other framework that gives me this power. We use websites with different UIs every day, can you imagine if we were also complaining that Facebook doesn't feel "native"?
- mtrpcic 8y agoWhy?
- dr0verride 8y agoThe fact that the component is made up of html, css and javascript instead of layout code, styling code and logic code seems irrelevant.
- kitsunesoba 8y agoThe difference boils down to feel and behavior. You can style web controls to look very close or identical to native controls, but they’re always going to feel “off” with issues like increased latency, wrong animation curves, and lack of support for system features (such as spring loaded dragging and drag and drop on macOS).
- slantyyz 8y ago> I propose that using web components for desktop/mobile applications is not a good thing. It may not be, but it can be the difference between a developer releasing something that has real value to end users versus not releasing anything at all. One could say that building an Electron app is an example of doing things that don't scale.
- stiGGG 8y ago>I propose that using web components for desktop/mobile applications is not a good thing. Agree, every platform has it's distinctive look & feel and as a user I expect that my apps follow this for 100%. Recently I checked out Flutter, with the 1.0 release i thought it's worth to play around with it. The first thing i did, was installing their demo app on my iPhone they showed on the release event. Within seconds I noticed that there was something wrong. They tried hard to reimplement the bounce effect during scrolling on iOS, but it just didn't feel 100% right. I totally understand, that not every user out there has this sharp eye for things like that and that there is definitely a business value going cross platform, but this is not something I would be proud as a developer. It's the cheap root for the developer ending up in a cheap experience for their users. Share your business logic between platforms if appropriate, theme it for your CI if needed, but do the UI as expected.
- brynjolf 8y agoWe know that, it is the attitude of making it easier for developers and then letting the customer have to make quite big sacrifices that create the negative comments.
- fabiospampinato 8y agoVS Code is built on Electron, which means it has a huge advantage from my point of view as a user: I can just remove stuff from the UI that I don't need and tweak it a bit with a few lines of CSS. I'm not sure what quite big sacrifices I'm making for this. There are definitely awful Electron apps, but that's usually because of the developers, not because of Electron.
- xfer 8y agoI can do the same on emacs too, says nothing about electron, just that you are familiar with css/js.
- fabiospampinato 8y agoYou can do the same with emacs because it's hackable enough, but you probably can't do the same with other native non-hackable apps like Word or Photoshop. I could do the same almost as easily with any Electron app, kind of like you can customize any website on your browser.
- _eht 8y agoAll fine and good but if there is a native app that has the same feature list, I’m going to choose that one 70% of the time and go without the other 30%. So long as you are also aware of that demographic it’s hard to argue with any of your other points from the dev POV.
- munchbunny 8y agoElectron is amazing for dev velocity. I love it there. However, most importantly for my day job, it's not good for security. Adopting Electron requires me to accept the same structural weaknesses that led to all of the NPM malicious commit issues that have cropped up lately, and with Electron it runs as me, the user, not inside a browser sandbox. As a dev in a security team, not inadvertently creating attack vectors is literally part of my job, so that combination of factors is scary. In hindsight... I'm putting Discord in a sandbox. Other native languages/SDKs/frameworks don't have this issue if only because so much of them come from first party entities and it's very viable to cut implicit trust to the repositories. That makes Electron not a viable option for anything related to my day job unless it's guaranteed to be running in a VM, closed off from everything else. When some of the Node.js permissions related stuff gets put in, I'm going to like Electron much, much more than I do now.
- fabiospampinato 8y ago> and with Electron it runs as me, the user, not inside a browser sandbox You could actually not use any external modules in your main process and have the renderer process sandboxed [1], node integration [2] can be disabled too. [1] https://electronjs.org/docs/api/sandbox-option https://electronjs.org/docs/api/sandbox-option [2] https://electronjs.org/docs/faq#i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron https://electronjs.org/docs/faq#i-can-not-use-jqueryrequirej...
- munchbunny 8y agoThanks for bringing this up, I wasn't aware of the option. This changes how I look at the trade-offs of using Electron. Unfortunately, that only covers the rendering code, and it still backtracks a lot of the reason putting JS into a native environment is convenient in the first place. But it's a lot better than the "nothing at all" I thought it was before.
- jillesvangurp 8y agoYou have to separate performance of the application and the runtime. There are a lot of applications out there that are based on electron that are perfectly reasonable that are used by loads of people who by and large don't complain about performance issues. I tend to have several open at any time. Yes, they use a bit more memory. That's why you have virtual memory, ssds, and cheap ram these days. It's a complete non issue for anyone with decent equipment from anywhere in the last five years. If you are so unlucky to be stuck on an ancient laptop with not enough ram, spinning disk, and an OS that doesnt't do the right things with virtual memory (non stop swapping for no good reason), that's going to be noticeable and annoying. Been there, done that, and it sucks. If that is the case and you are a professional developer, get some decent gear, set it up properly, and stop whining. If on the other hand you are an end user, adjust your expectations accordingly to the fact that you are running old crappy hardware and don't try to install everything and the kitchen sink; or alternatively just be patient. Most users need nothing else than a browser running these days.
- mezzode 8y agoThere are definite a lot of advantages to building with web technologies, it's just that Electron is an excessively heavy way of enabling it since it basically just gives you a webapp with a whole browser bundled in. PWAs are a much better alternative since you can just use the one browser instead of having one running for every Electron app.