315 points · by mherrmann · 8y ago · 285 comments
With this approach, I have the best of both worlds for my small shop where development time is constrained. The really good part is that I can reuse for the desktop application work done for the website both the front-end and the backend which is written in Python for all the scientific code.
[0]: https://www.ceondo.com/ecte/2016/04/chemeo-studio-explore/
All this makes Qt a first citizen in the Rich user interface world where the players have names like Vue, React and Angular today.
Btw, don't forget we had desktop toolkits with rich user interfaces already in the 2000s. In that time, Java was the big player. Swing was already superseded by Eclipse's SWT and HTML panels were already ubiquitous.
One of the things that Mac file dialogs do is implicitly expand the sandbox for the process that opens the file dialog. Is the other side of the bridge still able to access the selected path?
Qt will just open a native macOS dialog that will link files into the sandbox. From there you can pass the path returned by the dialog to sandboxing-oblivious C++ code.
As a side note: Flatpaks in Linux use a similar mechanism for sandboxed applications (in Flatpak these are called ‘portals’).
But in any case fbs doesn't mention some useful bits. Does freezing work reliably with all packages (is it different to the canonical packages for freezing Python binaries)? In my experience some libraries just wouldn't freeze - matplotlib was a pain. How big are the output binaries? The Qt libraries are large enough without chucking in Python as well (even a minimal install is quite big).
https://riverbankcomputing.com/software/pyqt/intro
I've been a (proud) Pythonist for years now, and I've always been a bit chagrined by the quality of the "marketing" of Python projects. It doesn't at all reflect the quality of the community and the projects.
Also, having developed apps in both frameworks I would say that it's easier to get started with Electron if you come from a HTML/CSS/JS background, but apps written in QT look more native and like "real" desktop apps to me. Also, QT as well as PyQT are incredibly well designed libraries and it's a lot of fun programming with them (I'm not saying that it's not as much fun programming in JS).
PyQT's page is clearly written by a developer, with an emphasis on explaining the internals of the library. The author clearly saw no need to make it attractive. There is no long-term vision beyond the library itself.
While PyQT is navel-gazing, Electron's page is all about grabbing mindshare and establishing clout. It seeks to conquer the world and your desktop, and you're going to like it.
I think stuff like this is pretty tribal, which is OK, but we should confuse it with decisions made on technical or experience merits.
I do agree that PyQt has a respectable documentation page. It is, however, a terrible page for attracting new developers and selling decision makers on the idea of using it.
This is a better way of identifying my frustration: open source projects don't just need good docs, they need to attract and inspire... especially visual frameworks like a GUI.
Would that be attracting people that are worth attracting though? Just like in business, not all customers are worth having.
Why would you not want a toolkit that makes rich application experiences across multiple platforms easy and standard?
I get that performance is a problem with the tooling in its current form (arguably...) but that's not a reason to ignore the problem electron is solving: creating complex UIs using things like WinForms, QT, GTK, Cocoa, etc SUCKS.
It requires learning vendor specific toolchains, different builds for different platforms, and an incredible amount of wasted time that could be spent developing your business logic instead.
I get that Electron brings benefits: it's dirt-easy to build something that'll run on Windows, MacOS, and Linux, without having to know a bunch of platform-specific details, and if you already have a webapp, you can leverage a lot of that work, but in the end it just feels to me like people cutting corners. You get a sub-standard app, but you don't have to pay developers to build for each platform plus the web. Which I think is a perfectly reasonable business trade off to make; I'm just not happy with the result as a user.
I think that this depends on your background. Personally, I would rather do a UI in QT than Javascript. I like that Qt supports high level components such as trees:
https://doc.qt.io/qt-5/qtwidgets-itemviews-simpletreemodel-example.html
With Qt I can also use a lot of the experience that I gained 5 years ago on a UI today. Any Javascript UI experience that I picked up 5 years ago is obsolete.It annoys me when people say something sucks without taking the time to understand it.
Because way more often than not the "rich" stuff are all fluff with no meat, end up taking wasting system resources and work badly with the rest of the system.
Ignoring the snark, "Modern" is better should not be the default, either. Performance is a valid reason to ignore Electron.
The Slack desktop app is the prime example for how bad Electron apps are. Its literally notorious for it.
Now that Desktop apps compete with web apps those toolkit’s are falling short. They are falling short in ease of development, cross compatibility, lack of trained developers (relative to web), and lack of good looking UIs and UI patterns.
I have developed some larger Qt applications and in each case there are at most a couple dozen of lines with platform-specific code. Qt abstracts away most of the platform differences.
For me ‘good looking UIs and UI patterns’ means: well integrated in the platform and accessible. Electron apps fail miserably in both departments.
import sys
from PyQt5.QtWidgets import QApplication, QWidget
if __name__ == '__main__':
app = QApplication(sys.argv)
w = QWidget()
w.setWindowTitle('Hello, world!')
w.show()
Also, styling apps in QT is really easy, in fact you can even use CSS: http://doc.qt.io/archives/qt-4.8/stylesheet-examples.html{ "name": "helloworld", "main": "index.html" }
And index.html is just whatever HTML web page you want, like "<html><herd><title>Hello World</title></herd><body>Hello World</body></html>". You could also use a javascript file as your "main" file if you want.
Even when you screw up the HTML it will still load, which won't happen if you get your underscores wrong in your example.
Edit: removed erroneous formatting
And this is why we have the wasteland of browser incompatibility that we're (still!) in. If something is wrong, it shoudn't work. Why are our standards so low that mistyping "head" as "herd" is considered something that heuristics should fix, rather than causing an error?
I mean, really, though, any decent IDE should flag that error for you in-line, anyway.
> Edit: removed erroneous formatting
This is beautiful!
You don't need to override ::paint because the authors of the class already included support for rich text.
I don't want a good looking UI, I want to have a fast and _usable_ UI!
This fad in the UI and JS world that absolutely everything has to be "beautiful" needs to go away.
Good looking UI is a major part of user experience.
Edit: the snark... removed.
There are ways around that. For example, DOtherSide is a C library to bind to QML, and binary releases for Windows and Linux are made available on the GitHub page, so in principal you could try out QML without needing to directly use a C/C++ compiler:
https://github.com/filcuc/DOtherSide
There are also a few other languages with QML bindings, such as Rust (the Rust binding is based on DOtherSide):
https://www.vandenoever.info/blog/2017/02/17/a-simple-rust-g...
I still develop 100% in QWidgets, which probably makes me a dinosaur but at least I know what I'm getting out of it.
Meanwhile, there have never been anything but Single Page Applications in the native world.
And sure, Qt is now more than 20 years old, it's from a time strongly rooted in "widget" based UI systems that have somewhat fallen out of favor. That is what QML is for, which similarly to WPF that started this trend, allows for GPU accelerated vector composition of anything you could ever want, with sane provided defaults so not every project is reinventing grids.
What Electron apps are good examples of ones that look very good? Slack and VS Code both look fairly bland, and Spotify is a bit of an over-energetic mess, at the moment.
It's ironic that people bang the drum about REST and decoupling... and then at the first hint of actual serious frontend/backend decoupling, everyone runs for the hills.
[1] http://doc.qt.io/archives/qt-4.8/richtext-html-subset.html
[1] https://github.com/qt-labs/photoshop-qmlexporter [2] https://drive.google.com/open?id=1D733SdbUvGsGvct8jdGqJ3R9iJ... [3] https://github.com/UVicFH/infotainment
The official pronunciation of Qt is “cute”. It is not pronounced as “cue tea”.
Last week someone else on hn did the same; and I kept quite.
Unfortunately this time I could not stop the graybeard in me.
Except this sucks if, you know, you want to make some money on your app... Kicking the tires for a potentially commercial app is a FULL stop for me right there.
JS and so many newer language(s)/bindings that compile to JS make the option to good to ignore.
I love Python, but it has stagnated hard in the last few years. The 2 to 3 transition really hurt the Python ecosystem in ways I am just starting to recognize. There are only "ok" to "terrible" options for GUI creation in the python ecosystem. Furthermore, packaging for different platforms is still a problem in 2018.
Why is that a problem? You get a commercial license for PyQt and are good to go(?)
> I love Python, but it has stagnated hard in the last few years. The 2 to 3 transition really hurt the Python ecosystem [...]
I disagree. I think the ecosystem is more vibrant than ever.
> Furthermore, packaging for different platforms is still a problem in 2018.
That is exactly what this project is trying to help with.
Beside the ML/AI sub-community, I am having a hard time finding GUI innovation in the Python ecosystem. Perhaps, you could show me an option that doesn't suck? I've tried Kivy, PyQt, PySide, Eel, gooey, etc... I am not a JS dev and had an electron/react app up and running that I easily ported to my Android phone in under an hour.
[1]: https://fman.io
if nuklear.button_label(title="Button"):
print("Button pressed!")As much as I love Python, I don't want its GUI ecosystem to become the next Delphi.
I don't know of any other cross-platform native GUI library that even matches Qt in quality or features. I don't think WxWidgets is a contender, unless someone here proves me wrong.
EDIT: I see, all it needs is the PyQT license for $500 and the Qt is covered under LGPL, for any commercial release.
That's the whole reason for the whole Javascript fadigue. Computer Science has had "had tools for the right jobs" for years, but now we have a large developer base that only knows Javascript and think it's some kind of holy grail of computing. Happened before with Java. Happened before with PHP. It will happen again.
It even happened in Python, too. I personally attribute a whole generation of failure for the Linux Desktop to the "Python for Desktop" frenzy of the Gnome 2/KDE 4 times. I remember I had a dual-boot Pentium 4 box, and while Windows apps were always slick and responsive, Linux always felt sluggish and unresponsive, until I found C/C++ alternatives to all the apps I used.
(If someone has a high-quality way to use asyncio or Twisted with the Qt event loop, I'd probably bump Python a bit higher.)
But what makes those apps resource hungry and sluggish is usually not the UI: it's the whole lot of applicationg logic that's buried into their cores using Javascript code for stuff the language was not designed for.
I'm primarly a Python developer too, and on that respect I like Python's approach to C extensions. It's easy enough to rewrite your application logic into C when performance is important, and in general I think experienced Python programmers will do just that. The problem with Electron is both the lack of support for doing this, and the lack of experienced developers willing to do it.
I am reasonably excited about WebAssembly as a solution for this for web apps. (Although web apps also have a natural front-end/back-end separation, and people consider JS as just one of many potential options for a back-end language, which helps a lot here.) It does surprise me that there isn't good support for doing this with actual native code on Electron.
Priority #1: Runtime, your code will (hopefully) be run a lot more than it does anything else.
Priority #2: Debug, your code will be debugged more than it is read
Priority #3: Reading, you will probably read your code a significant amount more than you write code.
Priority #4: Writing. A software should spend the least amount of time on a CPU being written.
I'm not saying that you should only focus on making fast/slick runtimes that are easily debuggable above literally everything else; but you should absolutely have slanted priorities towards this goal.
And in that respect, why wouldn't you learn the right tool for the job?
Given that, what makes sense to optimize for? The slowest, most error-prone processor in the mix is, the wetware in your head.
So, almost all of the time, put #1 at the bottom of the list. Put #3 next, because once it works, the slowest process is relearning why it works, necessary to debug or extend it.
#2 and #4 are simultaneous.
So, for most coding most of the time on most projects, write dead-obvious code using normal design patterns and simplest abstractions. Because time is money, and your wetware time is millions of times more expensive than cpu time.
My argument is about runtime, not about developer comfort - if you have race conditions between threads, or deadlocks, or blocking I/O on the UI thread, that's a runtime problem, not a developer comfort problem.
(I do also disagree with your priorities, in part because if you get #4 right you avoid a lot of #2, but I wanted to be clear about what my argument is.)
I've experimented around with Quamash[1] a bit with Asyncio and it seems to work nicely! Looking at CI it seems to have some rough edges (at least on Windows) though.
It looks like this is done by subclassing QAbstractEventDispatcher and filling out virtual functions registerSocketNotifier(), registerTimer(), etc. I suppose you could do this for asyncio/Twisted, but I'd prefer to import something where someone has done this for me and is accepting bug reports from the community, because this is the sort of thing that's made of edge cases that are hard to notice in testing.
Wat? The PyKDE binding were always an afterthought. The big KDE4 language bet was, guess what... javascript bindings, to build widgets. And then Ruby bindings, since Ruby had just exploded. Except web developers never cared for the Linux desktop, they are Mac users.
If anything, python bindings allowed a generation of new distros like Mint to emerge, as “sysadmin types” could develop simple GUIs much faster and cheaper than if they had been forced to learn C/C++. The failure of established companies to capitalise on this is entirely their fault; for example Maemo/Meego refused to let Python apps on the Nokia store, and never even tried to push PyQt as their mobile story (which would have predated the Swift/Kotlin moves by almost a decade, giving them a fighting chance to get some developer mindshare).
Web developers hate the idea of using C++ to write desktop apps because the language is brittle, outdated, and overly complex.
We need a middle ground: a language with the syntax of a scripting language, like Python or JavaScript, that compiles down to native code, like C++ or Rust.
I am under the impression that Qt is attempting this with QML and JavaScript.
https://blogs.gnome.org/despinosa/2017/02/14/vala-is-not-a-p...
Its fairly fast, easy to link out to C if you need to. There are versions of the VM that are blisteringly fast, like Luajit, and others that are tiny like eLua.
Its syntax is incredibly easy, as is most of the language to understand.
It can be event and callback oriented.
And though dynamic, most gotchas about JS don't apply, as it isn't overly eager to typecast everything.
The best situation I can think right now, and the one I would adopt myself, is indeed PyQt. Mostly because Python makes it easy to drop the compute-heavy application code into C extensions, not because of the GUI toolkit itself.
I want to like it. The problem is that the one character symbolic syntax notation remain nonsensical and seem arbitrary to me.
I guess with something like React there's even more overlap in UI and application flow, but you still have to learn interacting with the filesystem, dialogs, preferences, menus, menu icons and window settings, state between launches, and any other fiddly things that your app brushes up against. There's also building and packaging, bundling for the app store (if you're using one), and updating the app.
Javascript is itself an example: it solves very well the problem of giving web pages interactivity. It was not designed to be a general purpose language though - it was, and is - being worked around into one.
If you write your program in C/C++ we're good, though now you're using a clunkly language.
If you're using Java you have some decent GUI options, but it's a bit ugly. Still alright.
In almost any other languages you're in deep trouble. The prototypical example: building out interfaces in Python.
You have some GUI bindings to the cross platform libs, but many have really old and outdated docs. Or licensing issues. Or installation issues. It's super hard to ship a GUI for your Python app compared to anything else with the language
Ultimately almost all other languages are used for server software. Packaging and GUIs are super low on the list of priorities.
The only exception to this is JavaScript! JavaScript is so much about front-end stuff that legitimate effort is put into getting stuff working well and painlessly. Sure React didn't invent FRP, but the communities gone further with the concepts than any other community. Bar none.
So many people refuse to admit it, but the JavaScript community is the state of the art in GUI development. The biggest crutch bring the weak native support of course.
I would also wonder about performance scaling. Are there good examples of "large" applications where CPython drives the main loop, as opposed to a scripting layer over a C++ core? CPython has a shallower optimization floor than Javascript+V8, and most larger Python GUI applications I've tried had noticeable lags (thinking of several visualization apps, and several Python-centric IDEs). I was similarly skeptical of Javascript-based desktop applications until recently, but Visual Studio Code has been very impressive.
As a side note: I see the Arch Linux package is 16M, unlike Ubuntu's 39M. Perhaps the app needs a relatively recent Qt or PyQt release that is available from Arch's repos but not on the oldest supported Ubuntu and thus needs to be shipped.
The Arch package is smaller because it declares PyQt as a dependency, rather than shipping it itself. The reason for this is that it was difficult otherwise to make the shipped version of PyQt libraries and dependencies compatible with the ones already on the system.
For comparison of installed size:
- Code.exe is 77MB (version 1.20.0)
- directory "C:\Program Files\Microsoft VS Code" is 225 MB
I haven't used it personally but they appear to have a few notable clients. Seems they also have popular language bindings[1] (Go, Python, Rust etc...).
It's not opensource though so that could be a deal-breaker for some but licensing/pricing[2] isn't prohibitive.
Has anybody here on HN used this before? Care to share your experience with it?
[0] https://sciter.com/
[1] https://sciter.com/developers/sciter-sdk-bindings/
[2] https://sciter.com/prices/That's not really what being licensed under the GPL means.
PC-BSD thought that they had to license their own stuff under the GPL because they were using Qt, but all you need is GPL compatibility. After that realisation, PC-BSD relicensed their code to 3-clause BSD.
Here are my bindings to python for the nuklear framework. https://github.com/billsix/pyNuklear
Lisp is interesting in that unevaluated code is a data structure of the language. In immediate mode GUIs, the sequence of function calls is your data structure.
Electron needs to be competed with in two areas, though: Developer experience and end user experience. Solving just one of them means you don't really compete with Electron.
For a good user experience I'd have recommended a Qt Quick [QML] based interface. Developer experience requires some good tooling, which unfortunately Qt creator doesn't really provide for me.
Electron is backed up by Github , we are talking about a billion dollar unicorn , and a lot of commits made are coming from outside github ( microsoft engineers for instance)
For this ? I doubt it would go beyond 1 year of surviving .
Also I've been using VS Code for years ,it's incredibly well optimized and doesn't have a problem in terms of memory or CPU .I personally found electron very reliable , it has surprised me on this point.
Ultimately this tech feels a lot like all the 'I hate javascript so here is my alternative' frameworks we had for the past year.
That is super welcoming for people that want to run more than CLI in 2018! /s
[1]: https://fman.io
I don't have an answer to your questions, but it's at least somewhere to start looking.
E: Most of the links are broken. This one is a bit better, but it's Windows-specific: https://wiki.tcl.tk/8646
HTML Forms suck until you have to write form classes/UI in native languages, and then realize how annoying it is when you need to customize something or want a unique input that might make said form easier to deal with.
e.g, NSTextField in Cocoa _still uses cells_ behind the scenes.
But well, Qt presentation is not nearly as sexy as HTML/CSS, that's for sure.
I recently wanted to dabble with a tiny Android app, after hours wasted trying to get Kivy to work I bought a book on Kotlin and downloaded Android Studio, lots to learn but with the advantage that it works.
If I had just learnt JavaScript instead I could have done both in one hit.
Personally, I tend to use QtDesigner to layout apps and Qt for implementation (this applies for PyQt/PySide or C++). It tends to reduce the code necessary to get something up and going and helps keep things more MVC.
Tkinter is the standard UI library for Python, but I haven't used Tk in close to 15 years. Tk worked well enough for smaller Perl or Tcl apps, but when I first moved to Python professionally (around 2005) I bounced between WxWidgets, PyGTK, and PyQt. Qt was always ahead of the rest, but had licensing concerns at the time. I feel like there's a bit of roughness conceptually between Qt and Python that are just fundamental, but I think that's more on Python and asynchronous needs of UIs.
I was trying to figure out when this decision was made. I see references of tkinter dating back to 1999 (tk is from 1991), but it looks like it was officially included along with Python starting in 2008. If true, I would think it would be obvious it wouldn't be the best general choice going forward by that time. But I can see the reasoning behind choosing it due to licensing, size, volatility of api.In all of the comparisons I found on different frameworks the criticisms of Tk all seem to be about the looks (in that it didn't take on native styles), but that seems to have been resolved. It doesn't affect my in house use case either. The other thing mentioned is that Qt has more widgets. I don;t need those right now. Therefore it would seem that for simple in house software Tkinter was a pretty fair choice.
> I feel like there's a bit of roughness conceptually between Qt and Python that are just fundamental, but I think that's more on Python and asynchronous needs of UIs.
I can't get over this. I am not a good enough scientist to explain what the problem is but there is something that just doesn't feel right with Python GUI programming.
Most of the guis Ive needed just use basic widgets. I've poked at the browser and opengl widget, but never really used them. I have had to add custom behaviors to widgets to match other apps and it seemed pretty well suited. Funny enough, the Qt organization has stopped development on Widgets over 5 years ago (which is all I've ever really used). They consider Widgets feature complete and are focusing on QML.
> there is something that just doesn't feel right with Python GUI programming.
I think it's because GUIs, by their nature, are event driven and require parallel execution. Python doesn't do this very well so there's awkward syntax, a few competing paradigms, and unexpected behaviors (with memory, code flow, etc). I can see an argument for Javascript in this regard.
[1]: https://github.com/mherrmann/fbs/blob/cb0d57e59c9fecf24fb281...
It's unclear what the other advantages over PyInstaller are. Does @cached_property provide a performance benefit?
[1]: https://github.com/mherrmann/fbs/blob/cb0d57e59c9fecf24fb281...
AFAIK the main performance issues come from chromium's vast size - browsers are complex machines and it's easy to hurt performance by doing something that looks reasonable at first, but blocks the UI. Being single-threaded doesn't help. But reality is, most of the time Electron apps perform really well, it's just that they have slower startup times, consume massive amounts of memory, more CPU than average, and are 100MB each.
Killer innovation is not the markup language but components (extremely flexible and trivially composable at any level).
Here's a small list (which could easily be a much bigger list) of things that are much easier in web dev land than their native counterparts.
- Want to chart some data with nice animations? The chart library in Qt is good... until you need to make it look sexy. If you're in HTML/CSS/JS, you can just reach for an unlimited number of alternative libraries to pull from. (No, saying "go without the animations" isn't an answer.)
- Universal stylesheets are a godsend for quickly iterating on UI. Qt's stylesheets do not come close to the abilities that modern CSS provides you (and frameworks beyond Qt often lack something even close to this). Saying "CSS shouldn't be doing this stuff" isn't an answer, because the alternatives are simply less productive. It's absolutely amazing to be able to target an arbitrary node in a nested structure and tell it to behave differently, and have the entire thing render appropriately.
- You want smooth scrolling (that matches the OS behavior...) at 60fps? There is an untold amount of work that each browser vendor has put in to this effort, and the benefit is greatly undersold. Ever looked into wxWidgets? You have to go out of your way to make a scroll view bounce on macOS. That is utterly insane in 2018 - and no, saying "why does Mac need to be different?" isn't a solution. The entire point of cross platform development is that it should handle this.
- Have you ever tried to optimize scrolling on a TableView in Qt/wxWidgets/Cocoa/etc? Give me HTML/CSS/JS any day of the week.
- This point is slightly separate, but... I've written Python for over 10 years now, and I would not want to write a UI in Python. The language is one of my favorite and works well for most things, but UIs are often just kind of hacky - Python isn't a language that's ideal to write hacky code in. I'd sooner do it in Ruby or something.
Want the tl;dr? There is no other frontend community that even comes close* to the wide range of documentation, available libraries, built-in/free benefits, approachability, and general "it'll just work" feeling across platforms.
I write native UI code daily, and the writing is on the walls for it. Tangentially, this is very much why I suspect Apple is looking to merge Cocoa and UIKit more - it's the only way native Mac apps survive (oh, and even Apple renders significant chunks of some of their apps with Webkit... three finger swipe right on your trackpad if you wanna see some ancient Webkit app history).
* - _maybe_ UIKit for iOS comes close, due to Apple's vendor lock in factor and focus on UI, but that's something that a) rarely extends back to macOS apps and b) usually winds up splintered between Objective-C/Swift implementations.
There's also the point I forgot to mention in my original post, which is that... if your entire app starts as a webapp, there's no sense in maintaining an entire separate Qt codebase when you could just wrap it. Standalone products like this (embedded, etc) might have an easier time justifying it, but I really don't think it hits the ease of use metric (not even touching on the fact that you then need to handle product changes across multiple codebases/teams - money doesn't absolve your, your team or your company of the inherent difficulty here).
Also, hell, the simple act of refactoring native level UI code is often more of a PITA than the HTML/CSS/JS counterpart. Native APIs need to make themselves more accessible and sexy if they want to have a chance here.
Alsoooo to just end this rant of mine, I'll point out that the OP's project shouldn't charge money for this. It's not that they're not allowed to or anything like that, but you're in no way making PyQT a viable Electron alternative if you require licensing. There's little money in building UI frameworks for this reason; the web kind of requires you to compete on free to use. There are people (regardless of your take on the matter) that don't use Qt for licensing reasons and that is a hard blocker.
It's the norm for Qt apps since 2011 - 2012 when qml was introduced (of course, older apps use the older tech - and honestly, sometimes it makes more sense : at least all the colors, fonts, etc... will respect your desktop theme unlike "modern" toolkits). Here's how some QML code looks: https://github.com/jcelerier/TodoMVC-QML/blob/master/Main.qm... ; as you can see, it's far from bloated (mostly due to the language being based on reactive semantics).
For instance a consequent part of KDE has been rewritten in QML and more is underway with Kirigami : https://dot.kde.org/2017/01/12/kde-releases-kirigami-ui-20
I'm currently trying to formulate some thoughts on this; While I understand that HTML/CSS generally seems more flexible and may be more easily accessible to more/newer devs, it carries huge, negative implications in the forms of HCI (not having consistent interface elements on the user platform), performance and energy usage (particularly Electron), OS-integration, and accessibility features.
Can someone please give me some arguments as to why this not only seems like a good idea, but also why it's the best tool for the job?
* Cost. Why hire a separate dev team for each of web, Windows, and MacOS (and in this scenario, you never get a Linux app) when you can hire a single dev team to work on the core of the app with maybe one person to handle platform issues (and you get a Linux app nearly for free, which you wouldn't otherwise bother with)? Hell, you might not even need to hire more people to deal with your desktop apps initially, if you have at least one web developer who is resourceful and can figure out the remaining details.
* Hiring. Web developers are everywhere and easy to hire. Finding someone with expertise in a particular GUI toolkit is harder. Even if you initially don't care about which particular GUI toolkit, after you start building in one, you need to find more people to hire who are familiar with it. (This is also another "cost" item, I guess.)
* Ignorance. My biases are probably showing here, but my impression of most frontend developers is that they don't worry about performance too much, at least not to the level that, say, a C++ or JVM or CLR developer would. They seem to view many performance issues as something to be solved by the Javascript engine or browser renderer. They also likely develop and test their app on a high end machine and don't notice perf issues until users complain.
* Marketing. Visit Electron's website, and then visit PyQt's (or Qt's, though they're a little better) or GTK's. I guess it shouldn't be a surprise that the websites made by people who work on web technologies look better and tend to have better marketing.
* Tooling. Web debugging tools have gotten pretty great during this decade, closing the gap with native-code IDE debuggers, gdb, valgrind, etc. Electron's tooling make it fairly easy to build for each platform. Building a cross-platform app in Qt or GTK requires native compilation for different platforms, which is still, even today, a bear to set up.
There is a increasing number of people that never had to deal with boot sectors or config files to get a computer up and running, they just hit a button and a few seconds later it lights up in massive colors and sounds.
And the only languages they know are web related languages, because that was the thing to know when they got interested in computers. And as the saying goes: When all you have is a hammer, all problems looks like nails.
This is a double-edged sword for multi-platform apps, but isn't a drawback for monoculture environments.
> Can someone please give me some arguments as to why this not only seems like a good idea, but also why it's the best tool for the job?
For a certain class of apps (such as IDEs), its a great idea due to the ease of extensibility as well as making multiplatform releases effortless. I doubt VS Code would have been available for Linux had it used a non-web-tech stack, and it has displaced PyCharm for some of my lighter tasks. PyCharm is written in Java, so it's also not native, but it's the best IDE in the world, IMO.
Then as you get familiar with web tech doing it in native toolkits requires you to learn new paradigms and quirks which is a barrier to creating new apps so people revert to what they know (web tech).
It's just that web is so popular so people stick to what they know. Same reason people would use say python with c extensions over golang. Even though go is faster out of the box, if they're used to the python ecosystem it makes sense for them to prototype in python and then optimize with c extensions, they can get something that works with less cognitive friction.
That's it.
Why learn frameworks and UI paradigms for different platforms if you can just build it once? You can have a desktop app in under an hour if you already have a web app.
[edit] There is also emscripten-qt. Full circle.
http://vps2.etotheipiplusone.com:30176/redmine/projects/emsc...
The market shapes the tech that's developed and companies shape the market.
It's a self-reinforcing vicious cycle of hype-driven demand.
Disclosure: I'm a web dev :(.
I don't know if I agree that it's the best tool for the job, but I can see the appeal to someone whose world is JS and Python only. Especially if memory management is a foreign and scary world to them - and having done it, it certainly is scary!
Webdev is not the best tool for the job but it's cheaper and substitutes for a sleeve of other specialised tools.
The user experience is secondary if you do a product on a budget and iterate over it all the time. Especially if you are a web-first experience like Slack. Having native stuff there would make it even worse adding cognitive dissonance to the overall design.
I guess there's a method in this madness.
We've got enough RAM & CPU cycles spare that we can run GUIs in a headless browser and CSS & JS have come along far enough to make this easy(ish) to pull off, especially when combined with a framework such as React or Angular.
I can see why it's done, from the cost PoV, but I'm always a little dismayed when I find yet another desktop app which has the 'uncanny valley' of an almost-native look and feel. Same goes for ReactNative vs true native mobile apps.
This means not only implicitly making a choice about the users' hardware, but it may in some cases exclude certain user segments as well.
I'd love to learn other languages and stacks! It's just that, often, it isn't a worthy use of my time. All that time used into learning C++ and Qt would be better used in making and improving my software.
This is even more impactful when hiring people. I'm building a small team that has to handle Web development, mobile apps, and someday a desktop app. The less different skills I need for all of this, the more cost-effective it will be.
Personally, I'd rather have ultra-fast, spartan-looking, as-efficient-as-possible apps. If I could choose just by heart, I'd code in Lisp, and probably I wouldn't even make GUIs and just make CLI apps. Sadly, programming is not only a hobby and I have to consider my business needs before my technical preferences.
Engineering isn't about picking the best, most perfect technologies, but about handling trade-offs. Many are using web tecnologies because of the fads, and some out of lazyness, but many (i'd guess most) are doing it because it's worth it.
This line of thinking, that it's not worth your time to learn tools that would improve your software, and make it less resource intensive, is a large reason for that trope.
"Many are using web tecnologies because of the fads, and some out of lazyness, but many (i'd guess most) are doing it because it's worth it."
I can't agree with this, mainly because, it's not worth it. It doesn't improve the software in any way; if anything, it makes it worse.
Yes it may be a wonderful language, but it seems so damned easy to get the interpreter to not find libraries that should by all accounts be right damn there in its search path.
Chromes rendering engine is objectively better than Qt's for an awful lot of things.
What you may win back is a gig of ram that wasn't really being used anyways...
[1]: https://fman.io/blog/picking-technologies-for-a-desktop-app-...
Let's just contrast and compare: The ENTIRE story for Qt accessibility is tree navigation, with trust that readers exist: http://doc.qt.io/qt-5/accessible-qwidget.html
Meanwhile Electron has an auditing tool for a wide range of accessibility requirements which also explains how you can fix the problems: https://github.com/electron/spectron#accessibility-testing
But congrats now we can run 2 tabbed text editor instances at once. Because for some crazy reason we're going to pretend Electron apps aren't competitive on $30 computers but IntelliJ is immune to criticism.
On a more emotional and personal level, in my entire time using linux since 1995, I've never once used a Qt app I liked. I wrote them professionally, and I hated each one and felt ashamed of the outputs.
To me, to then layer Python on top is like taking stale bread and slathering on that curiously pale, overly sweet peanut butter that they use on airlines. It's quite possibly the most Nope thing you could say other than, "Oh and also we embedded an APL interpreter and you'll need to write C++ circa 1995 for memory management."
First, Qt accessibility on Windows is improving:
This blogger specifically mentions the JAWS screen reader, but this should also help users of the Narrator screen reader built into Windows.
Speaking of which, Electron is not very accessible with Narrator. The reason is that Chromium implements IAccessible2, a non-Microsoft extension of the old Microsoft Accessibility API. Since IA2 is not a Microsoft API, Narrator doesn't support it.
Also, one of my blind friends told me a few months ago that Electron apps are inaccessible on Linux. I haven't yet verified this myself. Qt is accessible on Linux, though I don't know how it compares with GTK.
I don't know what the situation is on Mac.