编程与软件工程josephg.com
Electron 是桌面端的 Flash(2016)
Electron is flash for the desktop (2016)
2017 — 2019,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
Joseph Gentle 在 2016 年写的博客文章,把 Electron 比作桌面端的 Flash:它让用 Web 技术做跨平台桌面应用变得极其方便,但代价是每个应用都打包整个 Chromium,内存占用和启动开销惊人,Slack 之类的简单聊天工具也要吃掉数百 MB,而且与系统原生体验脱节。文章认为这种'方便压倒一切'的胜利会像 Flash 一样带来长期的臃肿与安全/维护负担。
为什么经久不衰:每次有 Electron 应用吃满内存都会被翻出来,它提出的'开发便利 vs 资源与原生体验'权衡至今没有解决,评论区正反双方的交锋也浓缩了这场十年辩论。
HN 评论精选
Electron 的真正替代品不是原生应用,而是'不存在',它盘活了桌面生态。
问题的关键在于:这些 Electron 应用如果没有 Electron 会怎样?如果你的答案是'会有一个原生 Cocoa/WPF 应用',那你简直活在另一个星球上——答案是'根本不会有这个应用'。过去五到十年没人愿意做桌面应用,因为基本赚不到钱,而且成本高得离谱:单个功能的开发时间可能是十倍,还很难招到懂这些过时技术的开发者。Qt 存在二十多年也没迎来爆发。而现在人们在做各种新应用,往往三平台同时发布,桌面平台重新热闹起来,这本身就是件大事。
anaisbetts查看英文原文
Here's the thing. You know what the alternative to all of these Electron apps coming out is? If your answer is "A native Cocoa/WPF app", you are on another planet, the answer is, "It wouldn't exist at all". Nobody in the last 5-10 years cared about writing Desktop apps before Electron came along, there's basically zero money in it, and it's massively expensive, both in terms of actual dev time per feature (easily 10x the cost), and also in finding specialist developers who know these dated technologies. And as for Qt, Qt has existed for over two decades - if its massive "Beatles walking off the plane" moment hasn't happened by then, sorry, it's not gonna. But now? People are making all kinds of great new apps, and more often than not, they come out on all three platforms. People are excited about the Desktop again - Electron is so good it's single-handedly revitalizing the platform that two of the largest tech companies in the world are behind, yet couldn't do. That is a Big Deal.
这不过是又一次'高层语言被嫌弃'的历史循环,开发者选的是性价比。
抱怨 Electron 的人和当年说'为什么用 C,直接写汇编''为什么用 Java,写 C''为什么用 Python,写 Java'的是同一类人。人们最终要的是以最划算的成本/质量比解决问题,而不是'正确地做'。除非你能提供更好的方案或花钱造出来,否则大家就会选那个丑陋、半成品但能用的办法。PHP 之后是 JS,我讨厌、你也讨厌,但我以前用喜欢的语言做可移植 GUI 应用和安装包,UI、事件模型、API、可移植性边界情况、打包、依赖……全都痛苦不堪。要么接受,要么给出方案,别再抱怨了——市场已经说明你错了。
sametmax查看英文原文
People complaining about electron are the same type than the ones that used to say : - why are people writing this stuff in C. It's so slow and you don't have as much control on memory. Write it in Assembly. - why are people writing this stuff in Java. It's so slow and you don't have as much control on memory. Write it in C. - why are people writing this stuff in Python. It's so slow and you don't have as much control on memory. Write it in Java. Eventually people want to solve a problem with the best ratio cost/quality for them, not "doing it the proper way". So unless you provide a better solution for them to do that, or pay big money to create such solution, they will find the ugly-hackish-half-baked-working-for-them solution that let them do this. We had PHP. Now we have JS. I hate it. You hate it. We all hate it. But I created portable GUI apps with an installer before in my favorite language and others and it was a pain. All of it. The UI, the event model, the API, the portability edge cases, the new stuff to learn, the packaging, the dependencies... It sucked. So get over it or provide a solution, but stop complaining. And before you start providing an EXISTING solution, remember people tried it and they didn't like it as much as electron. And since electron is so bad, that should tell you something. So the market is saying you are wrong. You can ignore it from your better tech tower... Try to boycott electron apps all you want. But we know how it has played for betamax, lisp and the ogg format. P.S: oh, and if electron is flash, remember that flash won the web for 15 years while it sucked. And you know why ? Because it allowed people to do stuff they wanted easily, like videos and animations. And it's not because we couldn't do it any other way, we could. Yet we had to wait almost 2 decades to see it dies, at the price of battery, stability, security and everything else. Feature trumps everything. People. Don't. Care. We only manage to kill it because we finally replaced it with systems that could compete on easiness and features. So you know what to do.
反驳:Flash 当年是技术上的最优解,Electron 只是懒人的最优解。
不对。Flash 在流行的那几年,恰恰是做视频、矢量动画、简单交互的最佳方式。而 Electron 只有在'开发者只会 JS 和 Web 开发、又不想学新语言'时才是最佳选择。也许还有一种情况:出于'原生应用必须每个平台各写一遍'这种严重误解——实际上 C++ 加 Qt 等组合可以只写一次,99% 源码跨平台通用。
AboutTheWhisles查看英文原文
No it isn't, flash was the best way to do many things for the years it was popular. Video, vector animation, simple interactivity. 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.
Electron 与 Flash 有本质区别:开源、基于 Web 标准,还救了 Linux 桌面的应用生态。
首先,Flash 的核心问题是它闭源、安全漏洞频发,而且需要写不可移植的专有代码。Electron 是基于开放 Web 标准的自由软件平台,用的是各大平台都有的 Chromium,并且能和 iOS/Safari 这类'围墙花园'共存,因为现代 Web 的标准协调做得相当不错。如果你用 Linux 桌面,你应该为 Electron 大声叫好,因为 Spotify、Discord 等应用正是靠它才在 Linux 与 Windows/macOS 上功能对齐。
morpheuskafka查看英文原文
First off, the primary issues with Flash were that it was proprietary, had numerous security issues (due to its open source nature) and required custom, non-portable code. 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.
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选