DEV Community

Discussion on: Building Native Desktop Apps with Electron.JS

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

A far better way to go is a PWA to make a local version of your site.

TBH - the whole idea of Electron is flawed - you are essentially shipping almost an entire web browser with every single app. You end up with a whole bunch of web browsers all running at once, hogging memory and resources. This would be fine if all the apps were sharing an instance of a central webpage renderer - but AFAIK, they aren't.

The overall result is a bunch of massively bloated, resource hungry apps that, in reality could be way, way, way more efficient. Not to mention the fact that they'll all likely be running different versions of the web renderer, with all the associated security and update issues that that brings.

This is quite typical of the way a lot of development is done today - little or no consideration being given to whether or not the tools are appropriate to what is being built (using React for ridiculously simple portfolio sites etc.) - people just want to use whatever they know, or is the current 'cool' thing.

The priority always seems to be making it 'easier' for the developer with no regard to efficiency, resource use etc.

Collapse
 
haaxor1689 profile image
Maroš Beťko • Edited

For example provided in the article a PWA would definitely be much better option. But bigger apps wouldn't be able to merely as a PWA since the main thread of Electron app provides so much more options. Another huge benefit of Electron is that with single codebase you can have both the web app and desktop app. Your point about Electron apps not being as efficient as true native apps could be is valid but apparently all those corporations using it don't feel like it's that big of a downside compared to what they are saving on maintaining multiple standalone apps for all the platforms and devices.

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Write worse performing software, better hardware is needed; better hardware comes along, software efficiency gets worse... ad infinitum.

Vicious cycle driven by $$$

Thread Thread
 
thural profile image
thural

As computer hardware gets closer to it's limits in terms of efficiency, more and more emphasis will be put into software efficiency, perhaps "green" in software development will become a thing.

Thread Thread
 
jonrandy profile image
Jon Randy 🎖️ • Edited

By the time that happens, the knowledge required to make efficient software/code will have to be excavated by archaeologists - as sadly it has been being forgotten/discarded/ignored at a frightening rate for many, many years

Collapse
 
brett84c profile image
Brett Connolly • Edited

You're neglecting to take into account that a lot of smaller companies simply cannot afford to pay for native developers and separate teams. Javascript, HTML, and CSS are very popular skills sets that are much easier to hire for. You can hire 8 devs, half knowing Swift and the other half knowing C++, or you can hire 4 or less front-end devs to build for both iOS and Windows with Electron.

The memory consumption of Electron is a semi-fair complaint because most of the time, it seems to boil down to how efficient the devs are and how aware they are of memory usage in Javascript. VSCode is built with Electron and it's been a dream come true for web development. Hell, they even have it working directly in the browser on Github (press the period key while in one of your repos). VSCode has a reasonable footprint for being a full on IDE with an integrated terminal and the ability to load extensions, among a multitude of other features. I have never once had to worry about my memory usage while running VSCode and a handful of other Electron apps and a browser at the same time, and my laptop is like 5 years old. When the average user has a RAM memory pool of upwards of 50GBs, a single Electron app using 1GB isn't going to cause memory concerns for the average user, even if you had 8 of them open at the same time.

So healthy skepticism in all things. Electron does come with some extra overhead by nature of being a browser, but for people with limited capital, it's a solid option to get your MVP off the ground and considering doing native later on once the app has hit critical mass. For many small companies, it's really their only option. Don't neglect the business side of things. Lots of developers tend to do that and it's rather disingenuous, imo. Not all companies have bottomless pockets.

Collapse
 
jonrandy profile image
Jon Randy 🎖️

I often have fights at work about poor decisions being made due to 'business' considerations - $$$ decisions very often suck 🙂

Thread Thread
 
brett84c profile image
Brett Connolly • Edited

I mean, at the end of the day, these people are paying your salary and giving you a means of living to buy all of the nice things you own. A lot of devs seem to want to have their cake and eat it too when they should just be happy they have the cake to begin with. I personally am not a fan of the one-sided developer takes that seem to always default to "business bad". It shows a lack of understanding of the business side (which most devs have never been a part of or understand on more than a surface level) and comes off as economically naive.

Collapse
 
skylersaville profile image
Skyler Saville

What’s the old adage? When all you have is a hammer, everything looks like a nail… I get it. I’m a web dev too. I don’t know the popular mobile or desktop languages, as well as I know Javascript. But, I’ve also run into issues where the Electron based apps are so memory hungry, it bottlenecks the whole system. There’s always a better tool for the job, and as much as it pains me to say it… Javascript just wasn’t made to run native mobile or desktop apps.