News for hackers. Stuff that matters.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by scrollaway on Tuesday October 03, 2017 @11:45AM (#15393188)
Don't say no to Electron just yet. And if you do, jesus, there's better alternatives than JavaFX (use Qt).

You know what Electron has brought us? It's brought the Linux desktop reliable feature parity with other platforms. Fat chance Visual Studio Code (often hailed as "one of the best-optimized electron apps") would have existed on Linux without Electron.

Discord, another fantastic Electron app, is functionally identical on web and desktop (all platforms), feels fantastic on Linux, no issues at all. What are the odds I would have a functional Text/Voice/Video chat Linux desktop client for Discord if Electron didn't exist? How much time would have had to be spent reverse-engineering the protocol then implementing a decent UI for it all?

Obviously you shouldn't use Electron for certain things. If your app is tiny especially, you'll be better served with a leaner framework. But that's nothing new.

Electron has given desktop developers access to the web's fantastic tooling and iteration speed, and web developers access to the desktop market. It's given the ability and incentives to all those developers who might not have touched Linux before to make a Linux release alongside the rest.

If you don't like how Electron performs, your time would be better spent optimizing it than seeking out Java frameworks, which work atrociously bad on anything that isn't the author's platform (if even that).

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by mike_hearn on Tuesday October 03, 2017 @12:08PM (#15393431)
As someone who has written desktop JavaFX apps and web apps, I don't think you know what you're talking about. I can tell because you talked about the web's "fantastic tooling and iteration speed". That's a bit of a giveaway - I'm willing to bet you've never written a JavaFX app in your life.

JavaFX apps work just fine on Linux. Not even fine, they work well. I know because I've written them and tested them on Linux. And not just trivial toy apps: the app I wrote was a full blown peer to peer app with an integrated Bitcoin wallet, a Twitter Bootstrap themed UI, file associations, visual effects like animated Gaussian blurs and an integrated auto-update framework.

There's nothing magic about Electron. It's just another desktop app toolkit. There's no good reason to use it except developer familiarity with HTML. It gives you all the disadvantages of desktop distribution (you have to provide your own auto update framework, get users to download the app) but with none of the advantages like great tooling, great languages, UI builders and so on.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by harrygeez on Tuesday October 03, 2017 @01:49PM (#15394413)
It's not about superior tech. Devs don't care. Electron let's developers use all the library and frameworks that they are familiar with, that's what that matters.

I hate Electron apps but I can see why people do it. It's very tempting to be able write desktop apps with the web's best frontend technologies.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by oso2k on Wednesday October 04, 2017 @01:25AM (#15398451)
I'd also add that JS + Swing apps on top of Nashorn/Rhino also work really well.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by amcca029 on Tuesday October 03, 2017 @12:28PM (#15393617)
> but with none of the advantages like great tooling, great languages, UI builders and so on.

Its funny you say this while using java

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by e12e on Tuesday October 03, 2017 @01:02PM (#15393917)
Using the jvm.

So java 9, Kotlin, Scala or kawa (scheme), abcl (common lisp), clojure (nu lisp:), jython, jruby. While there are compile-to-js languages too (including Kotlin, Scala, clojure :) - there is quite a lot more history around jre/jvm languages for production desktop use.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by rootlocus on Tuesday October 03, 2017 @12:06PM (#15393412)
> And if you do, jesus, there's better alternatives than JavaFX (use Qt).

Because "god forbid" anyone use technologies associated with java? FUD at its finest.

> Fat chance Visual Studio Code (often hailed as "one of the best-optimized electron apps") would have existed on Linux without Electron.

I just use IntelliJ IDEA. It's ten times faster and ten times more powerful than Visual Studio Code. And it's written with java swing.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by vvanders on Tuesday October 03, 2017 @12:13PM (#15393485)
As someone who spends all day in IntelliJ there's no way it's 10x as fast, hell for me it's flipped the other direction.

VSCode is easily 10x faster than IntelliJ. If I'm writing Java I'll happily use IntelliJ but anything else it's VSCode or vim.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by joshribakoff on Tuesday October 03, 2017 @12:31PM (#15393651)
Same here, in a legacy code base with millions of lines of duplicated code that I unfortunately had to work on, IntelliJ would not even let me type, it just froze up all the time. Atom also sucked, fuzzy finder locked up the UI for 10 minutes. VSCode I can cold boot & start using the fuzzy finder, no issues. Feels like vim, in that it "just works". So performance is more dependent on what the software is doing, not what UI toolkit / runtime it uses. VSCode is faster on this codebase because it seems to not block editing due to a search index, like the others -- which has nothing to do with Electron vs Java.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by boondaburrah on Tuesday October 03, 2017 @12:19PM (#15393535)
Sure vim beats out both of them but I'm constantly having to wait for VSCode to catch up with me or my cursor will start inserting characters at the wrong spot. IntelliJ works as fast as I can think (minus the boot up time).
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by 13years on Tuesday October 03, 2017 @01:14PM (#15394044)
I use Eclipse with its native SWT UI and VSCode still blows it away in UI speed.

Actually, if Mozilla's Servo tech gets integrated into something like Electron, then we will have some serious performance capabilities surpassing pretty much anything else comparable.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by chillee on Tuesday October 03, 2017 @02:22PM (#15394703)
I believe the VSCode team is indeed looking into using webassembly.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by dangerboysteve on Tuesday October 03, 2017 @12:20PM (#15393549)
Are you running stock or loaded with plugins ?
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by vvanders on Tuesday October 03, 2017 @12:50PM (#15393820)
Stock Android IntelliJ, VSCode with a few plugins(Vim bindings mostly).
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by _pmf_ on Wednesday October 04, 2017 @04:08AM (#15398974)
Android "yes, you gave me 2 GB RAM for Gradle for building a 10 MB APK, but I'd still like more" Studio.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by stouset on Tuesday October 03, 2017 @12:16PM (#15393504)
IntelliJ faster than VS Code? I don’t think anyone who’s used both products could make such a claim with a straight face.

I joke with my coworkers that I know they’ve fired up IDEA because I can hear it. Whenever it’s on, their fans are dialed up to full blast.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by boondaburrah on Tuesday October 03, 2017 @12:21PM (#15393555)
I'm gonna make such a claim with a straight face. I don't know if it's VSCode's vim emulation or what, but on every platform I've tried it on IntelliJ beats it, while VSCode is busy catching up to where my cursor is still after chaining like 2 vim commands.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by crispinb on Saturday October 07, 2017 @08:15PM (#15426375)
IntelliJ is slow to start up (though I've no idea why that would matter for an IDE). And when indexing and building it can be very demanding on machine resources.

But I've never found it slow in any respect that matters for doing actual work. For everything that matters (opening files, project-wide search/replace, refactoring, typing latency, looking up docs, code navigation etc) it's easily competitive with lightweight editors.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by scrollaway on Tuesday October 03, 2017 @10:00PM (#15397753)
VSCode's vim plugin is pretty awful performance wise (I should know, I use it every day).
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by rootlocus on Tuesday October 03, 2017 @12:19PM (#15393536)
I'm curious how large the project is and whether it's the same project on both editors.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by boondaburrah on Tuesday October 03, 2017 @12:15PM (#15393501)
I mean, Java applications work ludicrously well. They're not slow, and they really do run on anything. I'm straight up double-clicking .jar files on Mac and Windows without any problems (on linux double click is kinda a myth so I just "java -jar" it). There are good Look&Feel jars for swing. I just wish Swing itself didn't feel like enterprise programming. Java requires me to be so verbose it feels like I'm doing WebDev again.

I'm convinced all of the mud slung on Java is due to enterprise programs and other software not motivated by quality (more of a "you have no choice but to use this to interact with our hardware/service and we CBA to make multi platform so you're stuck with our lazy java. Oh, and we come from the school of abstracting things to hell because creating more red tape impresses upper management.")

IntelliJ is I think the first application that showed me that Java is Good, Actually™ by delivering on those mythical promises of compatibility and speed.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by revelation on Tuesday October 03, 2017 @12:19PM (#15393542)
They don't seem to like double-click on the Linux Desktop. AppImage? Yeah, just go to the console, make it executable, then run it from there.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by boondaburrah on Tuesday October 03, 2017 @12:23PM (#15393574)
I think freedesktop made some standard for this, but I'm afraid it's making .desktop files that are just .INIs with the console commands to run. XDG is a weird place.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by chalupa-man on Tuesday October 03, 2017 @12:10PM (#15393452)
This is surprising, I've never seen anyone say that IDEA is faster than VSC. In my experience it's _vastly_ slower.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by rootlocus on Tuesday October 03, 2017 @12:14PM (#15393494)
I work with a project that contains tens of thousands of classes that span about 3m lines of code. Jump to any symbol responds to a fuzzy search in about one second. Jump to class autocompletes instantly as I type, and a rename takes a few seconds to update all classes in the project, including references from xml files and comments.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by brennebeck on Tuesday October 03, 2017 @01:27PM (#15394189)
In IDEA, right?
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by rootlocus on Tuesday October 03, 2017 @01:54PM (#15394465)
Yes.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by mthoms on Tuesday October 03, 2017 @12:13PM (#15393481)
There's something wrong in that case.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by modzu on Tuesday October 03, 2017 @12:25PM (#15393592)
+1 for intelliJ, or anything jetbrains. vscode gets a lot of hype but for serious development its still a toy. that said, as far as vscode proving that electron apps can be done very well, i do agree
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by amcca029 on Tuesday October 03, 2017 @12:35PM (#15393688)
why do "serious" Developers have to use heavyweight IDEs? what makes a more basic editor a toy?
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by rootlocus on Tuesday October 03, 2017 @12:36PM (#15393702)
I'd say a lack of powerful navigation and refactoring tools.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by kodablah on Tuesday October 03, 2017 @12:31PM (#15393644)
> there's better alternatives than JavaFX (use Qt).

I've recently written a decent-size Qt app (QtWidgets, not QML) and the problem is the language. C++ leaves a lot to be desired especially coming from higher level languages. If you look around at language bindings, the only quality one I can find is Python and I want to avoid that too (I don't want to build a large app in a dynamic lang). Couldn't use Go, I needed MSVC to interoperate. Rust bindings had drawbacks or were incomplete. Etc. (I probably need to revisit D's Qt binding)

I just want a full-featured (i.e. not QML) widget framework in Rust, Go, D, or some other high-level non-VM cross-platform language. I'd even take C bindings because we can work from there. And I want the widgets to appear native. C# + WinForms would be great if it worked great on non-Windows and was easy to interoperate with third party C-level widgets. WxWidgets is C++ or dyn lang (though there was a C binding maintained by Haskell devs IIRC), Gtk doesn't look very native, etc.

Widget-based desktop development will continue to lose to these alternatives while there is not a good widget library on a good sans-baggage language.

Edit: Just saw https://github.com/christolliday/limn (https://www.reddit.com/r/rust/comments/73w227/limn_gui_libra...) ...a good start!

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by jcelerier on Tuesday October 03, 2017 @02:34PM (#15394814)
> I just want a full-featured (i.e. not QML)

what are you missing with QML ?

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by kodablah on Tuesday October 03, 2017 @02:42PM (#15394888)
In my case, I needed to subclass QWidget to get native handles and do native things to embed Chromium (via CEF). There might be more, but it seemed appropriate to use QtWidgets from the start for my use case.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by jcelerier on Tuesday October 03, 2017 @03:19PM (#15395231)
I guess you have your reasons... but why not use the "official" way to embed chromium in Qt (QtWebengine) instead ? This would work both in widgets and qml.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by boondaburrah on Tuesday October 03, 2017 @12:00PM (#15393345)
I would argue that it doesn't give desktop developers "access to the web's fantastic tooling and iteration speed," as the tooling and iteration speed for the web is crap compared to desktop. "Hot Reload" is kind of a poor substitute, as I still need to edit text that correlates with what I'm seeing instead of interacting with it directly. I can get something working in C++/Qt, PyQt5, WinForms/C#/.Net (windows) way faster†.

However, it does let people hit 4 platforms way quicker than even two, which is a huge deal. And while I'm working out the kinks in my Qt app, the Javascript dev has a version anyone with a browser can use on anything right away, even if the desktop version isn't ready yet.

†Pouring one out for HyperCard. I miss that wonderland.

Edit: Damn you auto-markdown.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by skummetmaelk on Tuesday October 03, 2017 @11:49AM (#15393238)
If only skypeforlinux didn't need half a CPU core for itself............
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by _pmf_ on Tuesday October 03, 2017 @11:59AM (#15393322)
Qt + QML is IMO not just the currently best way, but also some kind of global optimum for me (coming from Swing, SWT and WPF/XAML). The data dependency handling is incredibly well done (it sometimes feels like using a Rx library without all the boilerplate), the handling of visual state is superb (think VisualStateManager without 4 pages of XAML).
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by Nullabillity on Tuesday October 03, 2017 @12:06PM (#15393403)
Huh? JavaFX works great on Linux.
Re:Say no to Electron: use JavaFX to write a fast, responsiv... by mwcampbell on Tuesday October 03, 2017 @09:00PM (#15397543)
Please don't use Qt if you want to target platforms other than Linux and make your applications accessible to blind users. [1] Electron is OK on Windows, but I've heard it's not currently accessible on Linux. Don't know about Mac.

[1]: https://blind.guru/qta11y.html

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by titanix2 on Tuesday October 03, 2017 @12:11PM (#15393464)
> Electron has given desktop developers access to the web's fantastic tooling

There must be irony here. The web development plateform is easy to get in, but hard to master: too many languages are involved (html, css, server side, javascript) and most didn’t have some really useful features until very recently (css grid for instance).

Then you have the language creep (Typescript, Dart or anything to paliate JS deficiencies; LESS/SASS), the JS framework creep, the libraries decay, etc.

I failed to see how this is ‘fantastic’ in regards to a language such as C#/F# that allow you to build desktop app very easily. If multiplatform support is not a requirment, the desktop languages and tooling are way ahead in term a ease of use.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by wieghant on Tuesday October 03, 2017 @01:58PM (#15394494)
> Then you have the language creep (Typescript, Dart or anything to paliate JS deficiencies; LESS/SASS), the JS framework creep, the libraries decay, etc.

That is totally a thing in Java too. Languages: Groovy, Kotlin, Scala. Framework: GWT, Spring, Struts, Vaadin, Grails. Libraries decay: commons, apache, different parsers, different db drivers.

On top of that though, you need to think about your JVM? What dependency manager: Ant, Maven or Gradle. Then figure out which JDK to use, cause that's a thing. Then figure stuff out like facets. Sure this is more IDE field but the fact Java app architecture can be so whack that something like 'facets' needed to be abstracted only proves my point.

> If multiplatform support is not a requirment, the desktop languages and tooling are way ahead in term a ease of use.

Ahead with the size of muddle yes. Web stack is just very good and fast at emulating the amount of it.

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by mjparme on Wednesday October 04, 2017 @11:26AM (#15401132)
> That is totally a thing in Java too.

I think you are confusing the JVM with Java. However, comparing languages needed for web development to available JVM languages is comparing apples-to-oranges. With web development you have to use different languages in the same app to accomplish anything. In a app you are using the JVM for you can pick one language and stick with it.

> Then figure stuff out like facets.

A "facet" has absolutely nothing to do with Java. The term "facet" is a term used by IntelliJ to configure adding features to your project. IntelliJ configures all of these on its own, I never even have to think about them (it actually took me a bit to even figure out what you meant by "facet").

Re:Say no to Electron: use JavaFX to write a fast, responsiv... by frozenport on Tuesday October 03, 2017 @12:17PM (#15393512)
>> Visual Studio Code (often hailed as "one of the best-optimized electron apps")

Is this some kind of joke? VS Code is a glorified text editor that ate your CPU trying to blink the cursor: https://github.com/Microsoft/vscode/issues/22900

Microsoft has a real IDE, and it ain't written in JS.