TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Electron considered harmful

159 点作者 kragniz超过 8 年前

42 条评论

niftich超过 8 年前
This had me for the first half, where the author walks you through the &#x27;case study&#x27; applications that offer minimal functionality despite shipping with an entire browser inside.<p>But then the essay turns into a rant. It&#x27;s 2016, people, the ship has sailed on pretending JS isn&#x27;t a real programming language. Phrasing the argument the way he does just betrays his smug elitism.<p>The fact is, for many types of applications, Electron is a really good fit: for example, shipping a single-page webapp as a desktop app, a need that surfaces often in today&#x27;s world, despite his derision of this concept.<p>An Electron-wrapped SPA is safer than going to the same website in a multi-tabbed browser and co-mingling your disparate cookies in the same jar, not to mention more convenient for the users, because they can treat it like any other desktop application -- with hardware access, and subject to the OS&#x27; native task management.<p>For other apps, Electron allows the world&#x27;s most popular layout system (HTML+CSS) to be used with one of the world&#x27;s most popular programming languages. This is a huge boon for re-using knowledge, and perhaps does lead to some amateurish projects. Similar criticisms were leveled towards Visual Basic, where drag-and-drop composing and a good IDE enabled people to quickly crank out a GUI app from an idea.
评论 #13031480 未加载
评论 #13031558 未加载
评论 #13031497 未加载
评论 #13031821 未加载
评论 #13032060 未加载
评论 #13031494 未加载
评论 #13031509 未加载
评论 #13035574 未加载
traviswingo超过 8 年前
I can understand the author&#x27;s frustration with popular tools being very simple and somewhat overkill underneath, but I almost take it as a sense of frustration with himself.<p>Electron was built to ship products as soon as possible. Most of the time, no one gives a flying fuck if the tech stack is the &quot;right&quot; choice and as efficient as it can be. I&#x27;d be willing to bet my net worth your users don&#x27;t care at all how you built it, just that it does what they want it to do.<p>In the end, for most companies, it&#x27;s more about shipping product that sells than spending 5x more time writing it in C# because &quot;you&#x27;re an engineer so you should act like an engineer.&quot; That&#x27;s not how the world works. And until you figure that out, you&#x27;ll constantly be left behind by others who made compromises to capitalize on the market.<p>Early optimization is the root of all evil.
评论 #13031610 未加载
评论 #13031724 未加载
qwertyuiop924超过 8 年前
<i>sigh</i><p>First off, JS is a perfectly usable language. In some respects, it&#x27;s even great: of the &quot;big three&quot; scripting languages (Python&#x2F;Ruby&#x2F;JS), it&#x27;s the only one that got Lambdas right, and also got closures right (unlike, say, Python). It has sometimes-quirky syntax, and some odd semantics, but they don&#x27;t bite as often as you&#x27;d think.<p>Second off, I would say that this article is right about the bulk of Electron: It&#x27;s a pretty massive thing to lug around with your app, and not ideal in any sense. However, if you want to build a UI very fast, there is <i>nothing</i> better than HTML&#x2F;CSS for it. Except maybe TK.<p>Speaking of TK, I would actually advocate TK over Electron: it&#x27;s easy to use, has bindings to pretty much every language out there, and with TTK, it doesn&#x27;t look like crap.<p>Finally, &quot;considered harmful&quot; essays rarely do any good, and frequently do harm.<p>So yes, while I usually like Drew&#x27;s writing (at least a little: he&#x27;s good, but far from the best), I wish he had spent the time he spent writing this doing more work on SCAS.<p>Seriously. If SCAS was actually done, and documented, and usable, that would be great. There is a freaking vacuum of good assemblers for the platform: another one would be nice.
评论 #13032161 未加载
评论 #13031791 未加载
评论 #13031904 未加载
mherrmann超过 8 年前
I recently had to decide on a GUI technology for a file manager I&#x27;m developing [1]. Electron is sexy, but unfortunately takes way too long to start for my purposes. I ended up with PyQt:<p>Pros:<p>+ Fast startup speed<p>+ I can use Python (and its vast ecosystem)<p>+ Qt has good ready-made components for eg. displaying a list of files (which is exactly what I need)<p>Cons:<p>- Compiling Qt (which I have to do for various reasons) takes time and is a pain<p>- Bundling and deploying a Qt-based app (times 3 - OS X, Windows, Linux) is a pain<p>- I have to deal with auto-updating myself (which I believe Electron supports out of the box) - times 3.<p>- I would prefer to lay out the UI in well-understood HTML&#x2F;CSS. Qt&#x27;s components and its CSS-equivalent behave in very weird ways sometimes.<p>I still sometimes wish I could use Electron but as OP says, we&#x27;re supposed to pick the right tools.<p>I explain my reasoning for picking PyQt over Electron (and other alternatives) in a blog post [2].<p>1: <a href="https:&#x2F;&#x2F;fman.io" rel="nofollow">https:&#x2F;&#x2F;fman.io</a><p>2: <a href="https:&#x2F;&#x2F;fman.io&#x2F;blog&#x2F;picking-technologies-for-a-desktop-app-in-2016&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fman.io&#x2F;blog&#x2F;picking-technologies-for-a-desktop-app-...</a>
评论 #13031859 未加载
seanwilson超过 8 年前
&gt; For the love of God, learn something else. Learn how to use GTK or Qt. Maybe Xwt is more up your alley. How about GNOME’s Vala thing? Learn another programming language. Learn Python or C&#x2F;C++ or C#.<p>All of this takes time. If you want to launch an app on multiple platforms, Electron is a very time efficient way to do this. Obviously native apps for every platform would be ideal but not everyone has the resources for that.<p>&gt; Let me be clear about this: JavaScript sucks. It’s not the worst, but it’s also not by any means good. ES6 is a really great step forward and I’m thrilled about how much easier it’s going to be to write JavaScript, but it’s still JavaScript underneath the syntactic sugar.<p>Use something like Typescript or Flow then. The above is like saying C++ sucks because assembly is a bad language to code in.
bmpafa超过 8 年前
This article, like many similar to it, makes the (imo flawed) assumption that a dev tool ought to be evaluated on only a few variables--e.g., code quality, performance, package size.<p>If writing software is about making users&#x27; lives easier, happier, or better, though, I think we ought to optimize for that and that alone.<p>I say let the market and communities of users decide which software they want to use. I use Nylas b&#x2F;c I like the UX better than Ubuntu&#x27;s Evolution, despite its flaws. I use Caret (electron markdown editor) because I wanted a cross-platform tool and I have &gt; 4 gigs of ram. Hell, millions still use the Facebook Android app, despite the fact that it sucks down battery juice like your crazy uncle sucks down Miller Genuine Drafts before lecturing you on how terrible millennials are (happy Thanksgiving, btw).<p>Of course, it&#x27;s important we know the trade-offs of the decisions we make, so we need critical pieces like this. But to be as prescriptive as this article is to miss the forest for the trees. Love it or not, JS is a point of entry for a hell of a lot more ppl than C++ is, so expanding its reach into new arenas is not only net-good, but I&#x27;d argue also inevitable.<p>That said, the article does skirt an issue I&#x27;ve thought about a little, and I&#x27;m interested to hear others&#x27; takes. If software collectively moves more towards higher-end systems, e.g., with SPAs and electron apps and all their cpu-intensive renders, are we further limiting a great web UX to those with the money to afford the latest laptops? We spend a lot of time thinking about accessibility standards for our products (A11Y, etc.), but when should we begin to think about accessibility from a socioeconomic perspective? Or are performant computers now so accessible that we needn&#x27;t worry?
评论 #13031765 未加载
vvanders超过 8 年前
As some of who&#x27;s had to support Qt, wxWidgets and other crazy x-platform UIs I find electron refreshing.<p>Heck, I&#x27;ve got Rust talking to node.js in it. Elm for the front-end and Rust for the processing, it&#x27;s a surprisingly pleasant development experience.
评论 #13031561 未加载
lopatin超过 8 年前
This guy is doing his best to make sure we can&#x27;t have nice things.<p>&gt; We use [JS] because we have no choice (people who know more than just JavaScript know this). The object model is whack and the loose typing is whack and the DOM is super whack.<p>Moot point. I use React + TypeScript. Good types and barely ever work with the DOM. If you don&#x27;t like TypeScript, your favorite programming language probably compiles to JS anyways.<p>&gt; The reason people choose Electron is because they are too lazy to learn the right tools for the job. This is the worst quality a developer can have.<p>I agree that bundling a copy of chromium for a todo list app or clipboard manager seems wasteful. But that&#x27;s an edge case, most people build actual applications. If I&#x27;m building a non trivial cross platform app, I&#x27;ll be orders of magnitude faster on the web stack. I&#x27;m not lazy, I just don&#x27;t want to waste months of my time learning arcane APIs because anything else wouldn&#x27;t line up with the author&#x27;s point of view about what the &quot;right&quot; tool is.
stevebmark超过 8 年前
&quot;If you want to make a quick little app, instead of using something convenient that you know, you should learn a REAL language like C&quot;<p>Why is this garbage on the front page? Stop giving condescending people like this a platform.
nailer超过 8 年前
&gt; For the price of 200 extra MiB of disk space and an entire Chromium process in RAM and on your CPU, you get a less capable GUI that saves you from having to type the -ss and -t flags yourself.<p>Cool. I remember when Handbrake first came out, and &#x27;make video go on iPod&#x27; went from some long winder research into ffmpeg flags to clicking a button that says &#x27;output for iPod&#x27; [1]. This sounds similarly timesaving.<p>[1]. yes, iPod. Showing my age.
评论 #13031666 未加载
评论 #13031950 未加载
K0nserv超过 8 年前
I think the points raised are solid, but at this point it seems like Electron is the best worst solution for cross platform UI. Having worked with Qt I never wanna do that again. There&#x27;s also a much more significant portion of developers who can work on Electron based apps. Part of picking the best tool for the job involves considering maintainability and ease of development after all.
评论 #13031515 未加载
评论 #13031565 未加载
jules超过 8 年前
This article makes a good point, but what&#x27;s the alternative? There is no good cross-platform GUI solution. Qt, GTK, JavaFx, wxWidgets, none of them are very good. Electron at least has the advantage of being fully cross-platform and not having to learn a whole new universe if you&#x27;re already familiar with the web.
评论 #13031705 未加载
评论 #13031604 未加载
评论 #13031606 未加载
评论 #13031605 未加载
sergiotapia超过 8 年前
I look at Electron apps the same way I used to look at Adobe Air apps. Any League of Legends player knows how bad the launcher is - 80% the fault of Adobe Air.<p>Sure it was easier to build, but your users suffer for it. Electron apps are pretty terrible performance wise, and you can immediately tell it&#x27;s an Electron app.<p>- Atom<p>- Slack<p>- GitKraken<p>All of these apps have &#x27;tells&#x27;.
评论 #13031549 未加载
评论 #13031555 未加载
评论 #13031584 未加载
评论 #13031504 未加载
评论 #13031731 未加载
评论 #13031486 未加载
evilnode超过 8 年前
I&#x27;ve been fighting with this for a while now. I think the only good reason to use something like Electron is if you need to get a cross-platform POC up and running quickly.<p>I am currently trying to make a GUI to compose and render Terraform assets in a similar manner to AWS CloudFormation&#x27;s visual designer, and I&#x27;ve spent an eternity trying to devise the best way to do this (this is mainly driven out of boredom more than anything else...Terraform works just fine as is). As much as I don&#x27;t want to use Javascript and the cancer that is it&#x27;s dependency management, the web stack is proving to be the path of least resistance thus far. Although I still don&#x27;t understand why you need to download half of the known internet to install gulp and babel locally.<p>I&#x27;m a GUI novice. Is there any cross-platform software that generates a true native UI on target platforms?
评论 #13031943 未加载
评论 #13032178 未加载
burai超过 8 年前
Well, that was a waste of time, the article is more a rant than anything else. I can understand that some piece of technology will not like everybody, but not spending any time giving proper alternatives. Not to mention that the header seems click bait since it&#x27;s an opinion article, not an actual security risk.
theSoenke超过 8 年前
The problem is there is no really alternative. Or what alternatives exist to write good looking, cross platform desktop applications with reasonable effort? I don&#x27;t think there really is one. Another think is the huge amount of dependencies typical electron apps have (or in general node applications). 500-1000 packages is not unusual. Thats ridiculous for a simple desktop application
mixedbit超过 8 年前
The argument that the only advantage of Electron is cross platform portability is not true. Electron tries to duplicate what is already a main stream approach for deploying backend services. The only reliable and sane way do have a stable backend is to explicitly control and isolate all dependencies of the backend services by using virtual environments, Docker or virtual machines. Most people no longer think that it is a good idea to run multiple services on the same server, globally &#x27;pip|npm|bundle install&#x27; packages that one of these services needs and hope for the best.<p>Electron tries to do just that on the desktop. It packages all the dependencies that the application needs together with the application and installs them in an isolated app folder (not affecting any other app). It enables easy automatic updates of the whole environment without worrying that the update will break other apps or will not work because some user happens not to have some system library.<p>Sure, this is much earlier stage than with backend services. Ideally Electron could ensure that identical dependencies that are shared between different apps are not installed multiple times, the way Docker does it. Even without such sharing I think that benefits of the Electron approach justify additional MBs on disk.
评论 #13033305 未加载
cdnsteve超过 8 年前
If electron apps had a smarter way to manage chrome core as a dependency, the file size would be peanuts. Every apps is download on the same bundled core. Once this happens you won&#x27;t have 100mb sizes. An intelligent installer could check core, if not installed download and install otherwise use what&#x27;s on the system.
评论 #13031427 未加载
评论 #13031535 未加载
评论 #13031984 未加载
评论 #13032212 未加载
NelsonMinar超过 8 年前
Stupid essay is stupid, but I&#x27;m glad it pointed me to lossless-cut because that tool is great! The author completely misses the point of Chromium in berating lossless-cut for being &quot;a graphical UI for two ffmpeg flags&quot;. Yes, exactly, it&#x27;s a GUI that lets you cut video to the precise frame you want to. That exactly solves a problem I&#x27;ve had for a long time; I&#x27;ve been using a horrible ffmpeg command line alias (along with preview in VLC) for a year now. He&#x27;s a little right about &quot;It doesn’t even use ffmpeg to decode the video preview in the app&quot;; that would be useful for supporting weird formats that Chromium doesn&#x27;t. But for common formats lossless-cut is great. It&#x27;s at <a href="https:&#x2F;&#x2F;github.com&#x2F;mifi&#x2F;lossless-cut" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mifi&#x2F;lossless-cut</a>
striking超过 8 年前
See, I totally agree with this essay.<p>But what are the alternatives? Getting started with Qt&#x2F;GTK isn&#x27;t nearly as easy, for example.<p>Maybe someone should write an intro to native GUI programming for JS devs.
评论 #13031540 未加载
评论 #13031390 未加载
评论 #13031626 未加载
评论 #13031553 未加载
jmlucjav超过 8 年前
I have been wondering...does Slack freeze for like a couple of minutes a couple of days a day for someone else?<p>I am on win10, on pretty hefty machines. No idea if it&#x27;s because Electron or something else, but it&#x27;s really annoying. I could not find any trace of issues in the event viewer etc.
评论 #13031579 未加载
jasonthevillain超过 8 年前
Calling people lazy should also be considered harmful. Please stop doing this.<p>Time is finite, and not all of it should be spent programming.
dexwiz超过 8 年前
Electron, and to a great extent the cross platform fetish, is a perversion of DRY. They don&#x27;t want to write the same code for two platforms. But its usually not the same code. Its the same logic implemented on two different platforms. Developers are so into code sharing, write once run everywhere, that they don&#x27;t stop and ask if they should. In every case you are paying a price for abstraction, like running Electron or using a WebGL canvas instead of a native graphics API. The article highlights cases where they price was paid, but the app was still platform specific.
评论 #13031415 未加载
评论 #13031420 未加载
评论 #13031482 未加载
heisenbit超过 8 年前
The fact that electron is easy enough to write trivial apps while at the same time powerful enough to give us VS Code is in my book SPLENDID.<p>If the trival app is too big for a trival app - who cares. The fact is there is now a serious contender in the cross-platform space that so far has been mainly occupied by Java. Java cross-platform is neither easy nor lightweight. And from what I have seen so far getting started with Electron looks a lot easier.
bhouston超过 8 年前
There are a lot of shitty half working apps, and there always will be.
jeremiep超过 8 年前
I can&#x27;t help but feel as if the author can&#x27;t make the distinction between a platform and the software written for it. People have been misusing platforms ever since they existed. Its not because someone used Electron to build a console that Electron is bad in and of itself, it just means someone used the wrong tool for that specific job - or maybe that fitted all their requirements in which cause the author is just dismissing the work with no clue about its context.<p>I also can&#x27;t help but feel as if the author is a beginner developer lacking a huge amount of context and experience. Saying &quot;Electron enables lazy developers to write garbage&quot; displays a huge misconception about software development in the very first place - garbage will be written no matter the language or platform.<p>Alls the article did was remind me that those who can, do, and those who can&#x27;t, blog.
评论 #13032331 未加载
api超过 8 年前
The only viable alternative is Qt, and it is almost as big and offers a less familiar programming model.<p>Native is only an option if you want to rebuild your app UI from scratch a minimum of twice and never support Linux or other less common desktops.<p>UI development has always been in fragmentation hell.
baby超过 8 年前
Yeah no. Electron is fine to write desktop apps.<p>I&#x27;ve seen native app with more ugly UIs and being laggy, etc... For many apps Electron is fine and will perform as well, or even better than native apps (just because, developers you know).
IshKebab超过 8 年前
Honestly I think this is a symptom of the lack of really good GUI toolkits that let you define the UI in an easy-to-use and powerful language. There&#x27;s Qt &amp; QML, but that&#x27;s about it, and to be honest QML is still pretty immature (try doing a custom control with text, or any kind of text editor in QML).<p>I really hope Rust or Go get great native GUI toolkits soon with nice declarative layout languages, but until that happens it is hard to get too angry at people using the wrong tool for the job because the right tools just aren&#x27;t that great.
roryisok超过 8 年前
I have a windows store js&#x2F;html app which I plan to re-release on electron. It features a rich text editor and a few other features. I want to release on Linux and mac os. Should I go away and learn qt&#x2F;gtk&#x2F;wx? Restart the whole project in Java?<p>The idea that I might choose electron for ease&#x2F;speed of development rather than use a leaner platform is being shit all over as a &quot;business&quot; decision. Not a &quot;I don&#x27;t have enough free time to learn two new languages and ui systems code three new apps&quot; decision.
adamnemecek超过 8 年前
I dislike JS just as much as the next guy but the only real contender on the list is Qt. Which you need to license for commercial development. Furthermore, even though I like to think that I&#x27;m ok in C++, I would really think twice before using it on my next project these days.<p>The JS performance issues should go away for the most part when wasm is standard. Also a lot of people write some compile to JS language, not JS, so I think that most of the points of this blog will be rendered moot in the near future.
评论 #13031542 未加载
评论 #13031593 未加载
agounaris超过 8 年前
We need to stop reading such posts. &quot;Everything sucks because I say so&quot;. Technology is really fair. At the end we WILL use what matters the most and has the overall best tradeoffs. I don&#x27;t like it when people use the expression &quot;best tool for the job&quot;. Like you used every other available tool out there and you found the best one...no you haven&#x27;t.
vorotato超过 8 年前
Considered Harmful essays considered harmful.<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9744916" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9744916</a>
danblick超过 8 年前
For me the title evokes &quot;Considered harmful essays considered harmful&quot;, which suggests that perhaps &quot;benefits and disadvantages of Electron&quot; would have been a better essay.<p><a href="http:&#x2F;&#x2F;meyerweb.com&#x2F;eric&#x2F;comment&#x2F;chech.html" rel="nofollow">http:&#x2F;&#x2F;meyerweb.com&#x2F;eric&#x2F;comment&#x2F;chech.html</a>
calebm超过 8 年前
Just because a particular technology is not the &quot;right&quot; tool for every job doesn&#x27;t make it harmful...
rpeden超过 8 年前
I&#x27;m a bit late to the party, but there are active React Native ports for both OSX and Windows.<p>Using them could be a good solution for targeting OSX and Windows and reusing logic from your web React app without having to deal with the overhead of Electron.
mikewhy超过 8 年前
Another example of &quot;&#x27;____ considered harmful&#x27; considered harmful&quot;.
评论 #13031886 未加载
butz超过 8 年前
Web browsers should have integrated functionality to run some websites as standalone apps (anyone remember Prism?). That way we wouldn&#x27;t need to install yet another copy of browser with each app.
k__超过 8 年前
OT: what&#x27;s the difference between Electron and Electrode?
评论 #13031781 未加载
yoavm超过 8 年前
While I agree with his general idea that Electron is usually not the best tool for the job, I think he&#x27;s overestimating JS as the reason that people choose Electron. It&#x27;s not because of JS, it&#x27;s because of HTML and CSS, which aren&#x27;t that bad comparing to other tools we have (especially since Flexbox). I think most people would love to write desktop apps using HTML and CSS, while using anything other than JS to do the logic. We&#x27;re just... not there yet.
always_good超过 8 年前
SirCmpwn, you&#x27;ll understand more about trade-offs when you finally have commercial success with one of your projects.<p>It&#x27;s too easy to lambast Electron and &quot;lazy developers&quot; when you&#x27;ve never had business concerns trump technical ones because none of your work ever tried to run that gauntlet.<p>I had to chuckle to myself when I saw that your GitHub bio is:<p><pre><code> &gt; I make unoriginal projects with better code than &gt; the thing they rip off. I&#x27;m available for hire.</code></pre>
baybal2超过 8 年前
what is electron?
评论 #13031792 未加载
评论 #13031601 未加载