119 points · by joeyespo · 9y ago · 172 comments
If native is to mean anything, it can't mean this. Calling it "the new native" is an affront, because its UI regresses in so many places relative to real native apps.
Edit: thanks for the replies.
I'm reminded of this article [0], about just how bad Electron is compared to native apps.
[0]: https://josephg.com/blog/electron-is-flash-for-the-desktop/
It reminds me of "Adobe Air", all over again.
I also don't think you'd see nearly the level of extensions and language support if they didn't go with an electron based solution.
- Many people know VS Code before that
- It was a bug, not something inherent to Electron
VSCode just makes an tolerably-fast Electron app. Still doesn't solve the CPU usage, battery hungrinees, and memory hoginess of the platform.
Electron enables a very large population of programmers and designers to produce useful applications using very evolved UI tech which can be multiplatform with nothing more than zipping with the right runtime - much easier than "native" or arcane cross platform UI libraries.
So of course people will develop useful stuff on it amd people will use it.
Maybe they'll figure something out.
Other cross platform solutions are not nearly as heavy (though they might have other issues).
"because it's easier"
I'm disappointed by the article. Thought it was going to detail how Electron is actually a good choice, not how they had two separate teams for the different platforms and wanted to get rid of doubly-implementing features (not wanting double work is the obvious requirement and leading reason for going Electron).
I mean, git itself is cross-platform and not Electron. How more obvious does it need to get? It even has a GUI. Telegram Desktop is a modern example that did it. And Libreoffice. And Firefox and Thunderbird. And Audacity. And FileZilla. And everything else traditionally written in the open source community.
Java applications aren't great either. Due to their platform-independentness things like selecting and context menus seem to be re-implemented by every platform ifnot every project, leading to a lot of inconsistency and ugliness. But at least they aren't as sluggish as the web crap dubbed into being native that Electron is.
There are lots of good options but all the engineering blog is able to give for a reason is that it was the easiest.
I wonder whether they considered Java with SWT. For the past 10 years I've been developing an accounting application for Windows and Mac using SWT, and it's been a blessing to have such a simple, stable, cross-platform UI library.
It's also possible to implement plaform-specific behaviour. For example, standard SWT doesn't allow a native toolbar on Mac, but with a few 'if (mac)' statements I made my application look exactly like all other Mac apps: http://imgur.com/a/l83yI
I'd say about 95% of my UI code is platform independent.
In your experience, how well does SWT handle the differences between platforms (fundamental things like macOS vs Windows' menu-bars, to smaller things such as the arrangement of buttons in a dialog)?
What is the graphics performance like too?
But then IBM came along and did it right: SWT is super fast and lightweight because it simply calls underlying native API like Cocoa or Win32. It's always been super fast even when I started 10 years ago.
Layout of components on screen is straightforward and much easier than Swing. (Just use GridLayout 90% of the time). I have to specify different margins and fonts for Mac and Windows and you will need to change the order of the OK/Save and Cancel buttons, but that's not a big problem. (In fact there is a library called JFace which can do alot of this stuff for you, but it comes with a lot of baggage so you may just be better off with pure SWT).
The difference in menu bars is perfectly handled by SWT, and it includes Mac-specific menu options like having the Preferences and Quit menu item in the application menu.
You may notice a loss of fidelity here and there - for example, on Mac my error messages don't look exactly like a standard Mac error dialog: http://imgur.com/a/znehj I'm sure I could fix this with 'if(mac)' and breaking out to the native OS, but in 10 years it's never been a high priority for me.
--------------------------
By the way, here's a juicy story about why IBM developed SWT: http://www.mail-archive.com/jug-discussion@tucson-jug.org/ms...
A few choice quotes:
"At IBM we hated Swing from day one. Big, buggy, and looks crap"
"All of the IBM developers are the same crowd who used to work with Smalltalk, and we reluctantly under management orders built our WebSphere Studio tools using Swing. It was a terrible, buggy, monster. In our initial previews when it was demo'd against Microsoft Visual Studio products all our users hated it just because of how it looked, never mind what it let you do"
"Swing was so badly broken deep down in the way it reads windows events...they read their event queue in a way that can leave memory holes so we had to have our own loop polling the windows event queue to do this correctly.....We tried over and over to get Sun to fix this but Amy just didn't understand this"
"Swing is like Java deciding not to do native IO using the operating system, but instead to use the disk motor arm API and read and write the disk data segments themselves."
Swing is way better choice, if you are on Java and want nice, feature rich, and somewhat (screen size) responsive UI.
I don't know JavaFx, but it may be worth a try also.
In 2017, where do you start?
If you also need to target Android, then it is a bit harder.
Yes there is now a port of OpenJavaFX to it but it was still a bit of work in progress, specially since it requires Java 8.
Probably the best way is to use MVVM and have separate views for JavaFX and Android.
I wonder how Jetbrains manage to handle all the anti-JVM/Java crowd.
BTW, where can I trial your software?
You can try it here: https://www.solaraccounts.co.uk/
Im definitely anti-jvm. I'm also a daily user of IDEA. Nothing else comes close to the same level of functionality with the breadth of language support available, on macos.
What I mean is, Electron apps make their life easier for a handful of programmers, to the detriment of thousands or in many cases million of users.
As a freelance developer, I think Electron is great for the little apps I build for clients for internal use. Companies like GitHub, Spotify, etc. have the resources to do much better than that. I have no idea why they settle for lousy performance just to use web technologies.
It's easy to sell yourself on the idea of cutting costs and growth potential to maximize returns now when you're an entrenched market player in a dominant position (as I would argue both GitHub and Spotify are).
Heck, it might even work.
One such case is Atom—which from what I know is what Electron was created for: many people use Sublime Text instead. Not because of functionality, but just because Atom is super-slow in comparison, and it won't open or let you work productively with files bigger than 2-5MB.
I would argue that the money they save by not going native, they lose from people using better software.
Or you could use C++ and Qt and suddenly have Windows,Mac and Linux support in one codebase. And the Qt mobile story is looking better with every release.
I switched to Qt and was pleasantly surprised at how nice it was to use.
C# and XAML can be used in WPF on versions of Windows prior to 10, if you need to support that. The C# is mostly compatible in both GUI systems, the XAML is very close, but subtly different, between the two.
(At Build last week, Microsoft announced the XAML Standard initiative to better standardize XAML across platforms. They also announced desktop support for Xamarin Forms, the XAML renderer for common subset of native controls across non-Windows platforms, to support macOS, Linux Gtk, and even WPF.)
Just want to point it out for those that didn't know, UWP apps can also be built with "native" JavaScript:
https://docs.microsoft.com/en-us/windows/uwp/get-started/cre...
I also worry about performance and file size with Electron. Why couldn't they just use a native cross-platform toolkit from the start?
Second result I found on Google
I don't know how I feel about that statement. One one side I want to scream "C", but with each passing day it's getting there.
I currently have two separate JetBrains IDEs each with multiple projects opened on my 8 GB MacBook Air. Doesn't seem to be a problem.
Now developers are working on electron apps and the average machine with 2GB makes an electron app today feel like a java one from 20 years ago.
Not to mention end users needed to download and update hefty runtimes in order to run the software.
[1] https://purelyfunctional.tv/article/the-legend-of-long-jvm-s... [2] https://dev.clojure.org/display/design/Improving+Clojure+Sta... [3] http://blog.ndk.io/clojure-bootstrapping.html [4] https://jkutner.github.io/2015/12/01/java-boot-time.html
[Citation needed]
They're both non-ideal solutions, but there is one caveat:
java tends to be the language of choice for companies like JetBrains, that want to deliver an awesome experience on all platforms, and go as far as shipping a custom JVM to make that happen.
javascript (read Electron) tends to be the language of choice for web developers who want to see their fancy icon in the Dock/Menubar.
Instead of complaining about what it does, perhaps we could be trying to make it more efficient, or make an alternative that solves the same problems (perceived or otherwise) in a better way?
You have 4 developers.
Git isn't that hard.
C++ isn't that hard.
Just write it in C++ and use Qt. I know, I know. It isn't cool.
I'm not sure they know what native means because c# is not native code and WPF is not a native UI.
> To maintain parity across the codebases, we had to implement and design the same features twice. If we ever wanted to add Linux support, we’d have to do it all a third time. All this meant we had twice the work, twice the bugs, and far less time to build new features.
Nothing forced them not to share logic from the start, they could have done that and still had a native UI on each platform. It only doubles the work if 100% of the work is in the UI.
"Native" confusingly has two different commonly used meanings. The one you seem to think is the only meaning distinguishes VM from non-VM runtime code (where C# is non-native). This meaning is the N in Android NDK.
The other common usage is "the preferred local platform specific language and dev stack", eg "A native Android app" which usually means "written in Java compiled to dalvik/art" distinguishing from a webapp or an app that is just a packaged webview.
Often it's also a byword for the platform-preferred first-party stack, making the argument somewhat tautological: of course there's a limited selection of first-party preferred stacks on every platform.
I'm guessing this usage is a contraction of the term "platform-native".
I wonder what the authours would think of C++, Qt and webviews?
Correct. C# does not ahead-of-time compile to hardware machine code (e.g. x86).
> WPF is not a native UI
How do you classify "native" vs "non-native" UI?
WPF is it's own toolkit built in directx, it's as native as swing. WPF sits at the same abstraction level as most games, would you consider the main menu in GTA to be a native one?
Does a WPF menu (and WPF-based apps in general) integrate with the systemwide conventions and settings for things like keyboard shortcuts, default font, etc? Is it a first-class UI toolkit for the system? My impression was it is supposed to be, in a way GTA's UI (or Swing) is not.
DirectX is at the same level of abstraction as Win32's Graphic Device Interface (GDI) and Hardware Abstraction Layer (HAL) that the rest of Win32's "native toolkit" was built on top of; Windows.UI is just as "native" as Win32 ever was. It should not be a surprise that the hardware abstraction toolkit beat into performance submission by performance demanding games is the new native layer for Windows. The surprise should be how long it has taken to make the transition across. (Avalon promised it back in Vista and WPF was the closest to delivering it. Windows 8 finally delivered on the Avalon promise.)
Examples: My Summer Car, Sol 0, Software Inc.
Not OP, but presumably WPF can be considered non-native because it relies upon the .Net stack.
This is how you run different browsers in chrome-less mode: iexplore -k %URL%, firefox -chrome %URL%, chrome --app="%URL%"
Launch nodejs, then launch the browser, and for the features not supported in the browser, have it talk to nodejs. You now have both a desktop app and a cloud app if you like. You could basically have the exact same code running on for example Github.com and on the desktop.
There are advantages with Electron/nw.js though, like only having to support one "browser" that makes it possible to use bleeding edge features.
The cross platform advantage(time & maintenance effort) that electron gives is immense. The overhead is very minimal and we can build some great apps like vscode and the likes have shown.
Compared to what exactly? Because compared to an app built using the platform SDK's, Electron is never "minimal" in anything, except perhaps "integration" or "accessibility".
cpu usage https://www.dropbox.com/s/x743mmnqvnffja1/cpu.png?dl=0
memory usage https://www.dropbox.com/s/twss8stdl12j83n/memory.png?dl=0
Once you have Java based IDE's like the IntellJ/IDEA family etc in the mix, you can't really call editors like VSCode/Atom/etc an IDE. The functionality is nowhere near the same.
I don't like relying on a Java tool. IDEA Ultimate uses a lot of memory. But it has a lot of functionality too, which is why I accept the JVM overhead. If someone produced a fully featured IDE (or even plugins e.g. for Xcode) for macOS that was a true native app, I'd use that. But that doesn't exist.
The options for me are: true native editors (Coda, TextMate, CotEdit, etc), web-page-as-an-app, slightly more featured editors (VS Code, Atom), fully featured IDEs (IntelliJ IDEA, maybe ActiveState KomodoIDE, possibly a NetBeans/etc setup).
You're still using JS, unless you're compiling modules for node.js.