News for hackers. Stuff that matters.
Re:How Four Native Developers Wrote an Electron App by ridiculous_fish on Friday May 19, 2017 @01:05AM (#14373154)
GitHub calls this electron app "the new native" on https://desktop.github.com. But the app does not look or feel native. It has an active appearance even when it's in the background, content lags the window frame during resize, menu items are enabled even when they don't apply or work, some buttons with the default appearance don't respond to return, you can't drag and drop text, many context menus are broken, rubber band scrolling doesn't work, the title bar text is absent, selection modifier keys don't work properly...

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.

Re:How Four Native Developers Wrote an Electron App by HappyTypist on Friday May 19, 2017 @01:12AM (#14373180)
It's not just UI but performance as well. For native apps, UI (hover state, clicks, etc) react in 0-1 frames. For Electron apps, these range from 3-10 frames.
Re:How Four Native Developers Wrote an Electron App by rjeli on Friday May 19, 2017 @01:16AM (#14373201)
Don't worry, just wait a few years and the processors will be fast enough for native-like performance.
Re:How Four Native Developers Wrote an Electron App by sha666sum on Friday May 19, 2017 @01:23AM (#14373219)
In other words, in a few years everyone will need to replace their perfectly good computers because of software bloat.
Re:How Four Native Developers Wrote an Electron App by fludlight on Friday May 19, 2017 @12:07PM (#14377009)
You just summed up the history of the industry.
Re:How Four Native Developers Wrote an Electron App by pavel_lishin on Friday May 19, 2017 @11:01AM (#14376314)
And by then we'll have our pick of Neutrino, Electrode, and Amber as the new, shiny, laggy way to build "native" apps.
Re:How Four Native Developers Wrote an Electron App by coldtea on Sunday May 21, 2017 @10:14AM (#14387394)
Re:How Four Native Developers Wrote an Electron App by nwienert on Friday May 19, 2017 @04:13AM (#14373730)
This is not true, nor has it been historically. Since 2001, you can make hover effects in <16ms.
Re:How Four Native Developers Wrote an Electron App by coldtea on Sunday May 21, 2017 @10:15AM (#14387402)
You didn't say anything that disagrees with the parent.

Except if you mean that you could do it since 2001 on web pages in < 16ms -- which is clearly not the case.

Re:How Four Native Developers Wrote an Electron App by vram22 on Friday May 19, 2017 @11:26AM (#14376586)
What is rubber band scrolling?

Edit: thanks for the replies.

Re:How Four Native Developers Wrote an Electron App by fny on Friday May 19, 2017 @11:32AM (#14376644)
It's the bounce you see if you try to scroll past the end of some content. See this image for an example http://blog.christoffer.me/content/images/2015/12/2_touch_ad...
Re:How Four Native Developers Wrote an Electron App by imron on Friday May 19, 2017 @11:34AM (#14376659)
When you scroll past the very top or very bottom of a page and it bounces and springs back.
Re:How Four Native Developers Wrote an Electron App by tonyedgecombe on Friday May 19, 2017 @04:17AM (#14373746)
However it is a beta release which implies some rough edges.
Re:How Four Native Developers Wrote an Electron App by imran3740 on Friday May 19, 2017 @12:19AM (#14373001)
The problem with Electron apps is that they're all running their own little Chromium-like instance, hogging up hundreds of MB of RAM, clogging up the process table with all its helper processes, using up CPU when idling. I get the easy cross-platform solution part, but this is just horrible UX.

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/

Re:How Four Native Developers Wrote an Electron App by LeoPanthera on Friday May 19, 2017 @12:34AM (#14373053)
I avoid Electron apps for the above reasons. On a laptop they will eat your battery dry.

It reminds me of "Adobe Air", all over again.

Re:How Four Native Developers Wrote an Electron App by vvanders on Friday May 19, 2017 @01:22AM (#14373218)
My gut wants to agree but then I see things like VSCode that shows it can be done with discipline and proper engineering.

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.

Re:How Four Native Developers Wrote an Electron App by adrianN on Friday May 19, 2017 @02:15AM (#14373368)
The editor that became known for consuming nontrivial amounts of CPU for blinking the cursor, something computers could do since they replaced paper tapes with screens.
Re:How Four Native Developers Wrote an Electron App by BoorishBears on Saturday May 20, 2017 @07:51PM (#14385012)
*became known to you for a big that consumed nontrivial amounts of CPU

- Many people know VS Code before that

- It was a bug, not something inherent to Electron

Re:How Four Native Developers Wrote an Electron App by roryisok on Friday May 19, 2017 @02:20AM (#14373383)
That issue was limited to mac, as far as I know
Re:How Four Native Developers Wrote an Electron App by Amezarak on Friday May 19, 2017 @07:43AM (#14374650)
I like VS Code and I don't want to crap on it, but I frequently experience massive UI lag on Windows - i.e., I start typing and the letters show up five seconds later. I think maybe it's related to source control? The same laptop runs Visual Studio fine.
Re:How Four Native Developers Wrote an Electron App by Matthias247 on Friday May 19, 2017 @12:46PM (#14377350)
Do you have any kind of anti-virus tool running? I experienced several slowdowns for autocompletion in VSCode, which turned away once Avira was deactivated. I think VsCode (and especially some plugins like the language services) are working with lots of files in the background, which got slowed down due to the filtering of these tools.
Re:How Four Native Developers Wrote an Electron App by kej on Friday May 19, 2017 @12:20PM (#14377120)
Out of curiosity, do you get this regardless of file type? I've noticed something similar but only in Python files, and I had assumed I had misconfigured my setup somehow. Just curious if your experience was similar.
Re:How Four Native Developers Wrote an Electron App by Amezarak on Friday May 19, 2017 @12:26PM (#14377170)
I see it in text files and Rust code, which are the only ones I've edited so far in VSC.
Re:How Four Native Developers Wrote an Electron App by cwbrandsma on Friday May 19, 2017 @11:03AM (#14376343)
oh heck, I get that in Visual Studio, IntelliJ, and XCode. Not saying I'm in love with electron apps, but they have their place. (I once wrote a trivial app using Adobe Air, also consumed hundreds of megs of ran, all the same issues as Electron...it just seems like the nature of the beast)
Re:How Four Native Developers Wrote an Electron App by coldtea on Sunday May 21, 2017 @10:17AM (#14387407)
>My gut wants to agree but then I see things like VSCode that shows it can be done with discipline and proper engineering.

VSCode just makes an tolerably-fast Electron app. Still doesn't solve the CPU usage, battery hungrinees, and memory hoginess of the platform.

Re:How Four Native Developers Wrote an Electron App by sfifs on Friday May 19, 2017 @12:16PM (#14377078)
Usefulness amd usability trumps efficiency every time in any user facing application.

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.

Re:How Four Native Developers Wrote an Electron App by Mithaldu on Friday May 19, 2017 @04:22AM (#14373771)
I created an issue reporting the main problem caused by Electron for them: https://github.com/desktop/desktop/issues/1641

Maybe they'll figure something out.

Re:How Four Native Developers Wrote an Electron App by shoover on Friday May 19, 2017 @01:41PM (#14377843)
Nice. I came here to ask, "What exactly is Chrome doing while using CPU when the app is idle?" Answering this would leave the memory usage and installer size issues but make the architecture tenable for more applications.
Re:How Four Native Developers Wrote an Electron App by bakchodlonda on Friday May 19, 2017 @01:08AM (#14373165)
Natives apps are native for a reason, right? If there one extra layer of abstraction to run your code, there is going to be a performance hit.
Re:How Four Native Developers Wrote an Electron App by riffraff on Friday May 19, 2017 @01:14AM (#14373190)
The complaint is that the layer of abstraction is too thick.

Other cross platform solutions are not nearly as heavy (though they might have other issues).

Re:How Four Native Developers Wrote an Electron App by tonyedgecombe on Friday May 19, 2017 @04:34AM (#14373820)
This would be fine for an app you ran occasionally but for something that's likely to be running all day it isn't good.
Re:How Four Native Developers Wrote an Electron App by rpwverheij on Friday May 19, 2017 @12:38AM (#14373066)
is anything being done to improve this? would it be reasonable to expect this to change in the future?
Re:How Four Native Developers Wrote an Electron App by forgotpw1123 on Friday May 19, 2017 @01:06AM (#14373157)
No. JS is not statically typed and that prevents the vast majority of optimizations and better memory efficiency(native types underneath).
Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @01:13AM (#14373188)
Not to mention the levels of indirection that also impact java and c# performance, despite 20 years of people saying "compilers will improve".
Re:How Four Native Developers Wrote an Electron App by forgotpw1123 on Friday May 19, 2017 @01:30AM (#14373250)
The level of indirection is minimal, basically c++ with garbage collection. That's why they're statically typed.

Both perform within a small margin of native code, with the major exceptions of vector instructions that aren't supported by all CPU's

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @01:56AM (#14373317)
In an artificial benchmark they are pretty similar, but in real world idiomatic code they are very different to c++. Nearly everything is on the heap so you've got pointers everywhere, dynamic data structures are used everywhere, virtual functions (particularly with java) and interfaces. There's is a reason java was so much slower than native code 20 years ago and that gap has been bridged by CPU progress more then compiler progress.
Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @02:26AM (#14373401)
You are forgetting the crappy programmers as well.

I lost count how many times I have reviewed code where a for loop is used instead of System.arrayCopy().

Or the times I have seen code that my CS data structures teacher would probably give a plain 0, even if done in C.

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @04:20AM (#14373756)
It's probably for the best those people aren't writing c/c++ ;)

I'd love to make them code in rust, their inability to write code, to even copy/paste it will save so many maintenance problems.

Re:How Four Native Developers Wrote an Electron App by forgotpw1123 on Friday May 19, 2017 @07:46PM (#14380161)
This just isn't true. There's many Java ports of C/C++ applications and benchmarks are usually within 30%.
Re:How Four Native Developers Wrote an Electron App by coldtea on Sunday May 21, 2017 @10:20AM (#14387425)
For the easy tasks. Try a CPU heavy C/C++ app -- like an audio/video editor, number crunching of any kind, etc.
Re:How Four Native Developers Wrote an Electron App by forgotpw1123 on Tuesday May 23, 2017 @08:21PM (#14406623)
Like I said, the major exception is SIMD instructions. AV and heavy math are a tiny fraction of applications. For these you can use JNI.

There is precedent for this in Netty where they use a native poll mode driver and everything else Java, and it performs about as fast as pure C code on Techempower benchmarks

Re:How Four Native Developers Wrote an Electron App by dmsnell on Friday May 19, 2017 @12:57PM (#14377458)
note: the article mentions that the app is written in TypeScript which _is_ statically typed and therefore many of these optimizations are at least possible if not in place
Re:How Four Native Developers Wrote an Electron App by TomMarius on Friday May 19, 2017 @05:29PM (#14379491)
He was probably talking about runtime optimizations done by CLR and JVM; this kind of optimizations is impossible even when you use TypeScript.
Re:How Four Native Developers Wrote an Electron App by yogthos on Friday May 19, 2017 @01:38PM (#14377824)
I see somebody has never heard of JIT compilers.
Re:How Four Native Developers Wrote an Electron App by lucb1e on Friday May 19, 2017 @01:20AM (#14373213)
TL;DR:

"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.

Re:How Four Native Developers Wrote an Electron App by joatmon-snoo on Friday May 19, 2017 @05:16AM (#14373964)
Git itself isn't quite cross-platform - it's very backwards-compatible on *nix, yes, but it would be a stretch to call it native Windows software. There's a reason the Git for Windows project bundles MSYS2 ;)
Re:How Four Native Developers Wrote an Electron App by lucb1e on Friday May 19, 2017 @09:17AM (#14375283)
Today I learned! Thanks :)
Re:How Four Native Developers Wrote an Electron App by roryisok on Friday May 19, 2017 @02:19AM (#14373379)
Anyone know what the telegram Desktop team uses?
Re:How Four Native Developers Wrote an Electron App by mhotchen on Friday May 19, 2017 @02:35AM (#14373428)
Re:How Four Native Developers Wrote an Electron App by tonyedgecombe on Friday May 19, 2017 @04:24AM (#14373778)
Qt
Re:How Four Native Developers Wrote an Electron App by MarkMc on Friday May 19, 2017 @12:32AM (#14373043)
> 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....Now we can share our logic and UI across all platforms, which is fantastic

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.

Re:How Four Native Developers Wrote an Electron App by DaiPlusPlus on Friday May 19, 2017 @12:39AM (#14373069)
I haven't touched Java UIs since university - back then we were taught about AWT and Swing. I remember being unhappy with AWT because it never worked right and was inflexible - and I was equally unhappy with Swing because it never looked or felt native - and for some reason window resize redrawing was done slowly. I first heard about SWT more recently and it brought back my faith in the native desktop, but I've never used it.

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?

Re:How Four Native Developers Wrote an Electron App by MarkMc on Friday May 19, 2017 @01:12AM (#14373184)
Yes AWT/Swing was bloated, buggy and slow - Sun's poor UI implementation really doomed Java on the desktop.

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/[email protected]/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."

Re:How Four Native Developers Wrote an Electron App by kodfodrasz on Friday May 19, 2017 @02:26AM (#14373402)
As one who has experience with multiple UI frameworks, and 2 years of SWT i can only say that it is on par with Gtk+/C Gui development experience. It is terrible, with those int constants all around the API, not groupped in any intuitive way, to communicate what should be Or-able with what. The widgets are stupid, as to be native everywhere they usually provide only the common features.

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.

Re:How Four Native Developers Wrote an Electron App by lacampbell on Friday May 19, 2017 @01:06AM (#14373158)
The UI situation for Java is so confusing. Why are you using SWT and not JavaFX or Swing or...?

In 2017, where do you start?

Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @02:22AM (#14373387)
JavaFX is the way to go.

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.

Re:How Four Native Developers Wrote an Electron App by Scarbutt on Friday May 19, 2017 @01:17AM (#14373203)
I think having to install a JRE is no go for lots of devs, unless you bundle the JRE but still lots of devs will complain because Java.

I wonder how Jetbrains manage to handle all the anti-JVM/Java crowd.

BTW, where can I trial your software?

Re:How Four Native Developers Wrote an Electron App by MarkMc on Friday May 19, 2017 @01:34AM (#14373263)
Yes I bundle the JRE with the download. In the old days I created a custom JRE with all the cruft stripped out but these days it's not too much to ask uses to download 50Mb. Hopefully with Jigsaw I can easily produce much smaller JREs in future.

You can try it here: https://www.solaraccounts.co.uk/

Re:How Four Native Developers Wrote an Electron App by tonyedgecombe on Friday May 19, 2017 @04:23AM (#14373773)
Off topic but did you ever get round to supporting multiple currencies?
Re:How Four Native Developers Wrote an Electron App by MarkMc on Saturday May 20, 2017 @05:21AM (#14381600)
Not yet. A workaround is to set up a second business with a second currency.
Re:How Four Native Developers Wrote an Electron App by stephenr on Saturday May 20, 2017 @12:42AM (#14381074)
> I wonder how Jetbrains manage to handle all the anti-JVM/Java crowd

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.

Re:How Four Native Developers Wrote an Electron App by nkkollaw on Friday May 19, 2017 @01:29AM (#14373246)
Electron apps are made for developers, but it's users who they're built for and who have to use it.

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.

Re:How Four Native Developers Wrote an Electron App by SomeStupidPoint on Friday May 19, 2017 @01:34AM (#14373262)
Short-term thinking: they save money of dev effort and assume their users will just tolerate their worse apps.

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.

Re:How Four Native Developers Wrote an Electron App by nkkollaw on Friday May 19, 2017 @02:16PM (#14378120)
Sure, I know they're saving money, but unless you _have_ to use something (Spotify, Skype), many people will choose a competitor instead of your app.

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.

Re:How Four Native Developers Wrote an Electron App by cleeus on Friday May 19, 2017 @12:32AM (#14373047)
> If you’re making a native app, your tech stack choices are pretty limited. On the macOS side, you’ll use Xcode, Swift, and AppKit. On Windows, you’ll use Visual Studio, C#, and WPF or UWP.

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.

Re:How Four Native Developers Wrote an Electron App by imron on Friday May 19, 2017 @11:39AM (#14376721)
When I was developing the Linux version of a piece of software I make (https://www.chinesetextanalyser.com/) I started out with Gtk but it was a massive PITA to work with.

I switched to Qt and was pleasantly surprised at how nice it was to use.

Re:How Four Native Developers Wrote an Electron App by ClausSualC on Friday May 19, 2017 @12:52AM (#14373110)
I don't know what's worst these days, WannaCry ransomware or Electron apps, both makes me cry. Yet, WannaCry is native so I don't hate that as much as Electron apps.
Re:How Four Native Developers Wrote an Electron App by kristianp on Friday May 19, 2017 @02:08AM (#14373343)
Sourcetree, a git/hg client, was written in c# for windows and Objective-C for Mac: https://community.atlassian.com/t5/Questions/What-technologi...
Re:How Four Native Developers Wrote an Electron App by vram22 on Friday May 19, 2017 @11:35AM (#14376675)
Is C# good for writing GUI apps on Windows? I saw someone in a recent HN thread about Kotlin mention C#, and say that it works on many platforms (including for GUI's, maybe). But my question is limited to Windows.
Re:How Four Native Developers Wrote an Electron App by WorldMaker on Friday May 19, 2017 @11:53AM (#14376864)
C# with XAML is your best bet for writing GUI apps on Windows. UWP is the present of Windows GUI app development and just glancing at documentation you can quickly see that C# and XAML are front and center. You can do C++ and XAML if you wish/must, but C# is generally a better idea. (UWP supports .NET Native which AOT compiles C# UWP applications.)

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.)

Re:How Four Native Developers Wrote an Electron App by nozzlegear on Friday May 19, 2017 @12:55PM (#14377445)
> You can do C++ and XAML if you wish/must, but C# is generally a better idea.

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...

Re:How Four Native Developers Wrote an Electron App by WorldMaker on Friday May 19, 2017 @02:48PM (#14378353)
I didn't mention it because HTML is great and all (and in fact right now more of my projects are HTML/JS), but XAML is a superior "native" GUI experience in Windows. Especially with things like Fluent Design's recently announced Acrylic material which doesn't have an easy-to-use HTML equivalent (yet?).

It would be great if there was an easier transition point from HTML/JS to XAML/JS or at least XAML/C#, for better more "native UI toolkit", but right now it feels like there is too much of a wall separating the rendering engines. HTML/JS can still feel quite native UI, but the gap is widening, especially once Fluent Design starts to become more common.

Re:How Four Native Developers Wrote an Electron App by nozzlegear on Friday May 19, 2017 @08:45PM (#14380379)
I agree completely, C# and XAML are definitely the way to go. I only wanted to mention JS as I've built a few UWP apps with it and it was a relatively painless experience. That was back when WinJS was a thing though, so at the time JS apps were very much "native" in design too.

Like you said though, it looks like JS apps are about to be left behind with Fluent/Acrylic in the Fall update. It seems like Microsoft is pushing the "Hosted Web App" for UWP instead of plain JS apps, even if they're still supported.

Re:How Four Native Developers Wrote an Electron App by WorldMaker on Monday May 22, 2017 @11:29AM (#14394355)
Yeah, JS is still the easiest way to build a native app and get the most cross-platform bang for the buck with the most UI shared (HTML is HTML and browser inter-compatibility is strong these days).

The push at build was even past the Hosted Web App to Progressive Web Apps in the Fall update when Edge has broader Service Worker support, etc. PWAs build on the footprint of the Hosted Web App, but include some of the standards efforts that others such as Google have also been pushing to the Progressive Web App space, including things like Service Worker-based caching (rather than Hosted's Manifest-based caching).

Hosted Web Apps and PWAs still have access, when installed, to the UWP APIs and it would be great if there were some APIs to composite things like Acrylic or certain XAML elements into an HTML page, in a Progressive way (fallback to HTML elements when the XAML ones aren't available).

I think, however, the focus for doing JS with Native UI has shifted over to React Native, which should have full support for all of that.

Re:How Four Native Developers Wrote an Electron App by vram22 on Friday May 19, 2017 @12:03PM (#14376957)
Thanks for the detailed answer. I was thinking of writing a few small apps in C++ on Windows, but may now check out C# for that instead.
Re:How Four Native Developers Wrote an Electron App by strangerding on Friday May 19, 2017 @11:12AM (#14376442)
same goes for Tower (https://www.git-tower.com)
Re:How Four Native Developers Wrote an Electron App by salutis on Friday May 19, 2017 @06:00PM (#14379665)
GitUp is awesome too. 100% native Mac app.
Re:How Four Native Developers Wrote an Electron App by iaml on Friday May 19, 2017 @01:21PM (#14377676)
I think gitkraken is a better git client than sourcetree, and it also works on electron.
Re:How Four Native Developers Wrote an Electron App by em3rgent0rdr on Friday May 19, 2017 @12:16AM (#14372990)
Even though they rewrote to cross-platform API, they still don't provide linux support yet...

I also worry about performance and file size with Electron. Why couldn't they just use a native cross-platform toolkit from the start?

Re:How Four Native Developers Wrote an Electron App by LeoNatan25 on Friday May 19, 2017 @05:53PM (#14379630)
Cheaper that way. Get some web "devs" to also write a "desktop" "app" in React.
Re:How Four Native Developers Wrote an Electron App by akhatri_aus on Thursday May 18, 2017 @11:54PM (#14372908)
Can't drag and drop a repository into the app. It's often the small things & little touches that are the problem with non native apps.
Re:How Four Native Developers Wrote an Electron App by aroman on Thursday May 18, 2017 @11:58PM (#14372920)
I mean, this is just as easy to do with electron as it is with a native app. The fact that they didn't implement doesn't mean it isn't possible :-)
Re:How Four Native Developers Wrote an Electron App by ridiculous_fish on Friday May 19, 2017 @12:40AM (#14373073)
Is it actually the case that this is "just as easy to do?"
Re:How Four Native Developers Wrote an Electron App by adnzzzzZ on Friday May 19, 2017 @12:52AM (#14373112)
Re:How Four Native Developers Wrote an Electron App by ridiculous_fish on Friday May 19, 2017 @01:37AM (#14373271)
Based on that link, Electron drag and drop seems extremely limited compared to what native APIs provide:

1. No way to declare what drop types you accept

2. No way to validate the contents of the drop before it occurs

3. No way to provide a visual indication of the action of the drop (copy, move, link...)

4. No way to generate a file drag

5. No drag promises

6. No custom drag images

This seems like the typical web development story: quick to build a low-quality implementation, impossible to build a good one.

Re:How Four Native Developers Wrote an Electron App by bhanu423 on Friday May 19, 2017 @02:18AM (#14373378)
How to solve the issues above: Just listen to 'ondrop' event on body and store the path of the file and call event.preventDefault() to prevent the file loading. Now I think all of your issues are solved:

>1: You can now filter the extensions as per your requirements

>2: Now you can load the file separately and verify the content as per your satisfaction using the fs module available in electron

>3: You can use: ondragover and ondragend events to facilitate ui feedback

>4: Not sure what you mean by file drag, but I cannot think of anything that cannot be implemented here.

>5: Not sure what do you want here.

>6: Not inbuilt but can be built easily.

Editors like atom and vscode have very good file-drop functionality and have image viewer apart from many other goodies. Depending on your familiarity with js, these things are more or less trivial to implement. Github team must have a different feature-set in mind that unfortunately didn't had drag and drop functionality for their first release. If anyone really wants the feature, the better way is to leave a feedback in app or open a issue (not sure if either exists).

Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @02:28AM (#14373409)
> quick to build a low-quality implementation, impossible to build a good one.

You just gave me a new quote to use. :)

Re:How Four Native Developers Wrote an Electron App by Devagamster on Friday May 19, 2017 @12:54AM (#14373117)
yes...
Re:How Four Native Developers Wrote an Electron App by paradite on Friday May 19, 2017 @12:14AM (#14372975)
It's pretty easy to implement drag and drop on web apps, in fact there are specific JS DOM APIs and various libraries to handle that.
Re:How Four Native Developers Wrote an Electron App by akhatri_aus on Friday May 19, 2017 @08:06AM (#14374790)
Onto the app icon too?
Re:How Four Native Developers Wrote an Electron App by qarioz on Friday May 19, 2017 @01:18AM (#14373207)
> JavaScript. It’s the lingua franca of programming.

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.

Re:How Four Native Developers Wrote an Electron App by relyks on Thursday May 18, 2017 @11:50PM (#14372895)
Why is Java not considered as a cross-platform solution?
Re:How Four Native Developers Wrote an Electron App by flukus on Thursday May 18, 2017 @11:55PM (#14372910)
Java on the desktop died because it didn't provide a native enough look and feel and it performed too slowly. Now we just don't care about look and feel and pretend every user has 16GB of RAM like the developer machines do.
Re:How Four Native Developers Wrote an Electron App by brandonmenc on Friday May 19, 2017 @12:09AM (#14372956)
> and pretend every user has 16GB of RAM

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.

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @12:26AM (#14373024)
I was talking more historically. Java was slow and fell out of favor at a time when the average desktop had 16MB of RAM (and many had less). It never recovered from that perception and was pretty much confined to server side tasks.

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.

Re:How Four Native Developers Wrote an Electron App by relyks on Friday May 19, 2017 @12:00AM (#14372929)
JavaFX is actually pretty good and the performance is much better than Electron.
Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @12:28AM (#14373031)
Java on the desktop died because most developers were too lazy to learn how to use Swing properly, while writing everything on the UI thread.
Re:How Four Native Developers Wrote an Electron App by pssdbt on Friday May 19, 2017 @12:48AM (#14373094)
Example of a properly done Swing app? Not trolling, genuinely curious to see what that looks like (code + result). I also assumed it was because they perform terribly and look non-native.
Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @02:15AM (#14373370)
Bitwig Studio, https://www.bitwig.com/en/bitwig-studio.html

Booksmart. http://www.blurb.com/booksmart

Ultramixer, http://www.ultramixer.com

jAlbum, https://jalbum.net/en/

VRL Studio, http://vrl-studio.mihosoft.eu/

Centigrade UI Components, http://www.centigrade.de/en/products/bizlaf-stock-look-and-f...

Synthetica UI Components, http://www.javasoft.de/synthetica/

JGoodies UI Components, http://www.jgoodies.com/products/smart-client/

SQL Developer from Oracle is also quite ok.

The sample applications developed on the "Filthy Rich Clients" book, http://filthyrichclients.org/

You can watch the related JavaONE 2008 session at

http://www.oracle.com/technetwork/java/j1sessn-jsp-155597.ht...

Oh and MATLAB is also a Swing application.

Re:How Four Native Developers Wrote an Electron App by riffraff on Friday May 19, 2017 @01:19AM (#14373209)
The IntelliJ stuff is Swing IIRC, but not open source.

jEdit, IIRC, was often mentioned as a properly written java GUI app, I think it's Swing, but I might be wrong.

EDIT: IDEA code is apparently open https://github.com/JetBrains/intellij-community

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @12:45AM (#14373086)
I don't buy that excuse, it never affected winforms or vb take-up that often had the same issue.
Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @01:07AM (#14373160)
First of all you are talking about OS SDKs, first class platform languages designed by the OS owners.

Second anyone that bothered reading Filthy Rich Clients book should be capable of doing a WinForms like experience.

What I conceed is that Swing has the wrong defaults and requires more UI design skills from devs than Forms does.

Re:How Four Native Developers Wrote an Electron App by pvg on Friday May 19, 2017 @12:11AM (#14372961)
All the IntelliJ environments are Java based and seem reasonably well-liked. So it seems alive and well, in its niche.
Re:How Four Native Developers Wrote an Electron App by imron on Friday May 19, 2017 @11:42AM (#14376752)
> Java on the desktop died because it didn't provide a native enough look and feel and it performed too slowly

Not to mention end users needed to download and update hefty runtimes in order to run the software.

Re:How Four Native Developers Wrote an Electron App by pyrophane on Friday May 19, 2017 @12:55AM (#14373122)
Has the latter problem been solved? Jvm startup times still seem like an issue to me.
Re:How Four Native Developers Wrote an Electron App by niftich on Friday May 19, 2017 @01:20AM (#14373212)
The JVM isn't actually slow to start [1] (albeit it does start about 3x-4x slower than python, ruby, or node) [2]. Most of the slow startup in a JVM-based application is in classloading [3] or waiting for your chosen framework to initialize [4] before the control is handed to your custom code.

[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

Re:How Four Native Developers Wrote an Electron App by ben_jones on Thursday May 18, 2017 @11:52PM (#14372900)
My guess is they didn't have much in-house expertise for Java and just neglected to mention it in the write-up.
Re:How Four Native Developers Wrote an Electron App by dleslie on Friday May 19, 2017 @12:00AM (#14372925)
Also, Java isn't cool.
Re:How Four Native Developers Wrote an Electron App by themihai on Friday May 19, 2017 @12:02AM (#14372933)
And JS is?
Re:How Four Native Developers Wrote an Electron App by dleslie on Friday May 19, 2017 @12:06AM (#14372946)
Sadly, it appears so.
Re:How Four Native Developers Wrote an Electron App by Mayzie on Friday May 19, 2017 @12:17AM (#14372994)
:-(
Re:How Four Native Developers Wrote an Electron App by ilyaeck on Friday May 19, 2017 @12:51AM (#14373107)
This is so backwards.
Re:How Four Native Developers Wrote an Electron App by zubat on Friday May 19, 2017 @12:16AM (#14372988)
For clients, JS runtimes offer a more polished experience on average than Java. That's not because of anything really intrinsic to the languages or platforms - it's just worked out that there is a lot of Java server code and a lot of JS client code, and consequently more catering to either of those extremes.
Re:How Four Native Developers Wrote an Electron App by stephenr on Friday May 19, 2017 @12:36AM (#14373055)
> JS runtimes offer a more polished experience on average than Java

[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.

Re:How Four Native Developers Wrote an Electron App by IncRnd on Friday May 19, 2017 @09:59AM (#14375678)
You are pushing the maintenance and testing from your teams onto your users. Sure, you can easily have a multiplatform app this way, but your users suffer for that. It _should_ be the other way around, instead of transferring the cost of software engineering onto users.
Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @12:31AM (#14373038)
Thankfully I stopped using the Github app long time ago, rather using the native Tortoise one.
Re:How Four Native Developers Wrote an Electron App by wjh_ on Friday May 19, 2017 @03:33PM (#14378735)
Okay so, as much as we all want to complain about how awful Electron is for battery life and just general efficiency, the facts are that it most likely is going to stay - at least for a little while, considering how much is being invested in it.

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?

Re:How Four Native Developers Wrote an Electron App by codesternews on Friday May 19, 2017 @02:49AM (#14373462)
This app has really have bad ui performance. Just check sourcetree. Atlassian has done wonder full job at creating and making it. No offense but, They now even have a chance to compete with it.
Re:How Four Native Developers Wrote an Electron App by LeoNatan25 on Friday May 19, 2017 @04:14AM (#14373733)
Check out Tower. Best git UI software for Mac.
Re:How Four Native Developers Wrote an Electron App by SyneRyder on Friday May 19, 2017 @03:09PM (#14378533)
Tower is now also available for Windows too (as a native app): https://www.git-tower.com/
Re:How Four Native Developers Wrote an Electron App by salutis on Friday May 19, 2017 @06:05PM (#14379682)
Also GitUp!
Re:How Four Native Developers Wrote an Electron App by cheez on Friday May 19, 2017 @12:29PM (#14377191)
I don't understand...

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.

Re:How Four Native Developers Wrote an Electron App by flukus on Thursday May 18, 2017 @11:52PM (#14372903)
> If you’re making a native app, your tech stack choices are pretty limited. On the macOS side, you’ll use Xcode, Swift, and AppKit. On Windows, you’ll use Visual Studio, C#, and WPF or UWP.

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.

Re:How Four Native Developers Wrote an Electron App by esrauch on Friday May 19, 2017 @12:16AM (#14372991)
> c# is not native code and WPF is not a native 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.

Re:How Four Native Developers Wrote an Electron App by pyrophane on Friday May 19, 2017 @12:52AM (#14373108)
I always interpret "native" to mean "without the use of an intermediary virtual machine." I assume my definition is overly simplistic, but am I incorrect?
Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @01:04AM (#14373150)
Android is a bit weird because the platform is the VM that you're targeting. The same goes for Chromebooks, html and JavaScript are native there.
Re:How Four Native Developers Wrote an Electron App by niftich on Friday May 19, 2017 @12:25AM (#14373017)
The terminology for "native" used in the blog post is inexact (actually, incorrect), but consistent with how the casual usage of the term has drifted due to the competition from the 'web technologies' stack. In this usage, "native" means non-webview; and/or non-HTML5/JS/CSS-bundled-with-the-entire-browser-runtime.

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".

Re:How Four Native Developers Wrote an Electron App by shakna on Friday May 19, 2017 @12:53AM (#14373115)
> In this usage, "native" means non-webview

I wonder what the authours would think of C++, Qt and webviews?

Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @12:26AM (#14373025)
C# compiles to native code since Windows 8, when targeting store applications.
Re:How Four Native Developers Wrote an Electron App by microcolonel on Thursday May 18, 2017 @11:54PM (#14372909)
Yeah, I'm genuinely surprised that "four native developers" didn't realize that there is one native language which works great on all three platforms, and has direct bindings to all of the platform UI toolkits...
Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @12:33AM (#14373048)
There isn't one that I know of. A language like c++ though would compile to a native library on each platform and allow them to share logic between 3 front ends in the same or a very similar language.
Re:How Four Native Developers Wrote an Electron App by microcolonel on Friday May 19, 2017 @12:55AM (#14373121)
That's mostly what I meant. I don't particularly think it's a good idea to share UI code between platforms as different as macOS and Windows. I'm sure there will be serious integration regressions with the new version.
Re:How Four Native Developers Wrote an Electron App by glandium on Friday May 19, 2017 @12:14AM (#14372976)
You mean several native languages with multiple multi-platform ways to create native UI.
Re:How Four Native Developers Wrote an Electron App by mal34 on Friday May 19, 2017 @04:27AM (#14373799)
The only env. i know is Lazarus-ide and Freepascal
Re:How Four Native Developers Wrote an Electron App by paulddraper on Friday May 19, 2017 @12:00AM (#14372927)
> c# is not native code

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?

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @12:14AM (#14372979)
A native UI is one that uses that platforms (or desktop environment) native toolkit, that's win32 on windows, qt on KDE, gtk on gnome and cocoa (or whatever it is today) on Mac.

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?

Re:How Four Native Developers Wrote an Electron App by pvg on Friday May 19, 2017 @12:30AM (#14373035)
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.

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @12:37AM (#14373061)
> 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?

About as well as swing ever did, no where near as good as Qt does, I think we'd all agree qt is not the native UI of windows.

Then again, it is hard to judge. Not a lot of win32 apps seem to follow system wide settings either, even the MS ones.

Re:How Four Native Developers Wrote an Electron App by pvg on Friday May 19, 2017 @12:47AM (#14373092)
About as well as swing ever did

Really? It's just not the impression I get, granted it's been a while since I've used Windows for anything other than to, well, play a bit of GTA. I remember paint.net being a thing (seems it's still around) and it looked and behaved like a Windows app. Qt apps look instantly recognizable and fugly to me on any platform. It's hard to believe that WPF apps had or still have, say, the font-rendering problems Swing apps had or were missing access to affordances like control over the tray icon, etc.

The reason I'm skeptical is that WPF was very much intended to be a first-class Windows-specific ui toolkit. You're telling me it's worse than cross-platform toolkits with all of their necessary design and implementation compromises.

Edit: Oh! I figured out where I was confused. WPF and Winforms. Not the same thing.

Re:How Four Native Developers Wrote an Electron App by WorldMaker on Friday May 19, 2017 @12:08PM (#14377011)
Win32 is essentially deprecated and the native toolkit from Windows 8 on is the WinRT components/engines in "Windows.UI.*" which natively speak XAML (and natively here means these are C++ components baked into the OS). WPF has much more in common with the modern Windows.UI toolkit than Win32 does.

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.)

Re:How Four Native Developers Wrote an Electron App by flukus on Sunday May 21, 2017 @08:22PM (#14390078)
The problem is they didn't provide backward compatibility for Windows.UI. Until windows 7 is dead win32 is the only native option.
Re:How Four Native Developers Wrote an Electron App by WorldMaker on Monday May 22, 2017 @11:18AM (#14394269)
I think to some extent they felt WPF was a strong enough backward compatibility story. Windows 7 supports WPF well. There is a cross-over between WPF XAML and UWP XAML and it is possible to support both with a lot of code shared and even some XAML shared.
Re:How Four Native Developers Wrote an Electron App by WorldMaker on Monday May 22, 2017 @12:29PM (#14394891)
Of course, there have been bumps in the road in the compatibility story between the two XAML environments. .NET Standard 2.0 will help a ton (in the very near future), deeply increasing the amount of .NET code that can be shared between the environments. XAML Standard 1.0 (in the slightly further future) will help a lot, in particular the fact that Xamarin.Forms is planning to implement a WPF renderer for sharing a much larger portion of XAML across every platform.
Re:How Four Native Developers Wrote an Electron App by kensai on Friday May 19, 2017 @12:51AM (#14373103)
On another note, the classic opening Window of Unity games (when you select resolution and quality) looks remarkably native!

Examples: My Summer Car, Sol 0, Software Inc.

Re:How Four Native Developers Wrote an Electron App by dleslie on Friday May 19, 2017 @12:05AM (#14372945)
> How do you classify "native" vs "non-native" UI?

Not OP, but presumably WPF can be considered non-native because it relies upon the .Net stack.

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @12:10AM (#14372958)
Not just .net (I think it's all c underneath), I'd consider winforms with c# to be a native UI (but not native code) because it's just a .net wrapper around win32.
Re:How Four Native Developers Wrote an Electron App by LeoNatan25 on Friday May 19, 2017 @02:57AM (#14373495)
Is UWP UI "native"?
Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @03:15AM (#14373557)
Yes, although the windows desktop situation is such a clusterfuck that I could make a case that it's not ;) It all depends on if you consider the full desktop or the metro interface to be the native one.
Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @12:25AM (#14373021)
Sure it does.

Ever heard of NGEN, Mono-aot, .NET MDIL, .NET Native?

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @12:31AM (#14373041)
To what degree are they native? I wouldn't consider something native just because it bundles the VM into the exe.
Re:How Four Native Developers Wrote an Electron App by pjmlp on Friday May 19, 2017 @01:07AM (#14373162)
To the same degree as C is native, there isn't any VM doing JIT compilation.

All straight sugar free Assembly instructions.

Now if you mixing the notions of VM and runtime, even C has a runtime called crt0 on most UNIX systems.

Re:How Four Native Developers Wrote an Electron App by flukus on Friday May 19, 2017 @01:50AM (#14373304)
> Now if you mixing the notions of VM and runtime, even C has a runtime called crt0 on most UNIX systems.

I was mixing them up. The line seems be kind of blurry though once you start embedding garbage collectors though, then again the GC could just as easily be in an external library.

Re:How Four Native Developers Wrote an Electron App by z3t4 on Friday May 19, 2017 @01:20AM (#14373211)
You can do an Electron app without electron!

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.

Re:How Four Native Developers Wrote an Electron App by murukesh_s on Thursday May 18, 2017 @11:45PM (#14372881)
I think this is great, especially for the electron ecosystem as github engineers are directly involved in making production apps on the stack(other than atom)

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.

Re:How Four Native Developers Wrote an Electron App by stephenr on Friday May 19, 2017 @12:38AM (#14373065)
> The overhead is very minimal

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".

Re:How Four Native Developers Wrote an Electron App by gjjrfcbugxbhf on Friday May 19, 2017 @01:18AM (#14373208)
Minimal regard for the users' system resources? Minimal chance of being used because the user notices their laptop grinds to a halt and then runs out of power when the app is opened?
Re:How Four Native Developers Wrote an Electron App by stephenr on Friday May 19, 2017 @01:26AM (#14373232)
Well played.
Re:How Four Native Developers Wrote an Electron App by murukesh_s on Friday May 19, 2017 @04:36AM (#14373825)
Don't want to create a flame war, but let's look at real world stats, at least for me, the overhead is very minimal. Look at the screenshot of my macbook pro 2013. I am running vscode for 100% of my development time. In the graph, I have sorted the processes by CPU Time (Not just CPU). That is the average amount of CPU used by each process over time. I have also included memory usage. While the total memory comes to around 400mb, it's still lesser than some Java based IDEs. For an app that I use as my main IDE, the resource usage (CPU) is very minimal.

cpu usage https://www.dropbox.com/s/x743mmnqvnffja1/cpu.png?dl=0

memory usage https://www.dropbox.com/s/twss8stdl12j83n/memory.png?dl=0

Re:How Four Native Developers Wrote an Electron App by stephenr on Friday May 19, 2017 @04:48AM (#14373865)
> it's still lesser than some Java based IDEs

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).

Re:How Four Native Developers Wrote an Electron App by murukesh_s on Friday May 19, 2017 @01:27PM (#14377720)
> But it has a lot of functionality too, which is why I accept the JVM overhead

This is something that can be replicated with additional plugins. To be honest, I have used Eclipse and Netbeans extensively. They do have additional features, but not a lot.

If I am not wrong, VSCode ships with a debugger and syntax highlighter built-in. There are tons of other plugins to add the extra functionality like GIT integration, built-in terminal, more syntax highlighting etc (Nowadays, you name it you have it). Even if you add 10 such plugins you are noway near a JVM based IDE on memory consumption. Also Netbeaans is very very slow, atleast in perception. Eclipse feels snappy, due to the use of SWT, but its a memory hog.

Re:How Four Native Developers Wrote an Electron App by stephenr on Friday May 19, 2017 @02:00PM (#14377985)
I'm talking about stuff like:

- Static analysis of code

  - Find calls to methods

  - Find usage of Classes/Interfaces/Variables

  - Alert when classes don't properly implement interfaces/abstract methods

  - Detect language-level syntax/feature changes/compatibility
- Code refactoring

  - Rename variables/classes/interfaces

  - Change method signatures

  - Pull/push methods to parent/child classes
Re:How Four Native Developers Wrote an Electron App by murukesh_s on Tuesday May 23, 2017 @12:33AM (#14398816)
Most of the above features dont need constant monitoring, so adding a plugin for that purpose won't add any large overhead. And many plugins do similar tasks in Atom/VSCode with minimal overhead. Even for continuous monitoring of filesystem, node.js is very fast(there are many native plugins).

Disclaimer: I am developing an IDE using electron for a visual programming language. I have worked on JRE based IDE toolkits before (SWT/Swing). Both the runtime performance and developer experience appear better to me. You can of course get better performance if you directly write in the platforms native stack, but my point is that JRE is only as good as a properly architected Electron stack.

Re:How Four Native Developers Wrote an Electron App by stephenr on Tuesday May 23, 2017 @01:41AM (#14399045)
> Most of the above features don't need constant monitoring

The above features flat out aren't available in the Electron based editors people like to call IDE's now.

Im not talking about how possible it is to implement them - I'm explaining why I accept the overhead of a JVM based IDE, but won't accept an Electron one: the JVM one (JetBrains IDEA) has those features, none of the other options on macOS have them.

Re:How Four Native Developers Wrote an Electron App by simion314 on Friday May 19, 2017 @11:26AM (#14376575)
VS Code has less features then the main Visual Studio and Intellij IDEs, also I don't think the problem is the language but Electron. About memory uisage, garbage collected languages will show a larger memory usage because they will not start cleanup when an object is freed, it waits until it needs free memory and then it starts the GC and in Java I think you can specify options to control this,CPU usage is more important since that uses battery/enrgy
Re:How Four Native Developers Wrote an Electron App by murukesh_s on Friday May 19, 2017 @01:28PM (#14377729)
JVM has the same problem, isn't it?. In fact VSCode even after extending it with lots of plugin to make it a full-fledged IDE, feels more responsive and relatively lean on memory usage compared to full-fledged (JVM based) IDEs.
Re:How Four Native Developers Wrote an Electron App by simion314 on Saturday May 20, 2017 @08:15AM (#14382050)
If you think VS Code with all plugins is an IDE at the level of Intellij or the main Vs then why VS still exists? Maybe you did not used this large IDEs so you don't know what the features or speed is, maybe your projects work good enough with VS Code or a plain text editor(not all projects need a big IDE). My opinion is that Electron needs more optimizations, and the developers that use it need better tools and need to also care more about the CPU usage. Even if you would use c and compile to web assembly to run n electron the problems would still be there so not the Language is at fault but the implementation.
Re:How Four Native Developers Wrote an Electron App by devwastaken on Thursday May 18, 2017 @11:48PM (#14372891)
>The overhead is very minimal

You're still using JS, unless you're compiling modules for node.js.

Re:How Four Native Developers Wrote an Electron App by murukesh_s on Friday May 19, 2017 @12:18AM (#14372995)
I find node.js pretty fast. The V8 engine does compile it to native during the run time using a JIT compiler. While it is not quite up to the level of java, it is comparable. The major lacking is no thread support, but it is a boon in many cases as tracking down runtime bugs in multi threaded environments is sometimes very tough. Threads can be simulated using child processes to some extend, but its the only major drawback as far as i have encountered.
Re:How Four Native Developers Wrote an Electron App by GRiMe2D on Friday May 19, 2017 @01:12AM (#14373179)
While nodejs is fast enough, Electron and apps built on it aren't fast. Electron is a mix of Chromium and nodejs. Chromium's rendering isn't meant to be used as desktop app. Especially for laptops. I have a MacBook pro mid 2010 with two GPUs. Integrated GPU uses less battery energy than discrete one. And every Chromium app switches GPU to discrete one and causes battery drain.
Re:How Four Native Developers Wrote an Electron App by dragonwriter on Friday May 19, 2017 @01:30AM (#14373249)
> Chromium's rendering isn't meant to be used as desktop app.

Yes, it is. That was pretty much the entire point of Google making Chrome (to make web apps have acceptable parity with desktop apps), and the entire premise of them building on Chrome with ChromeOS.

Now, it may not satisfy you in that role, but it absolutely is meant for it.

Re:How Four Native Developers Wrote an Electron App by murukesh_s on Friday May 19, 2017 @01:30PM (#14377749)
Good point. People are bashing Electron and chromium in general. But they do forget JVM based IDEs had the same problem. Rather than bashing Electron, if we can figure out to make it more leaner and faster, it would be much better.
Re:How Four Native Developers Wrote an Electron App by LeoNatan25 on Friday May 19, 2017 @06:03PM (#14379673)
"We"? You mean people that know C++ and low level native APIs, right? Which is decidedly not you. You are building a "hackable" "node.js" "npm" "app". The problem is, people who are indeed capable of making some improvements, including people on the V8 and WebKit teams themselves, do not believe in what these tools attempt to accomplish. (Listen to Don Melton's interviews on the subject, for example.)

I say "some improvements, as the problem cannot be solved completely; you'd understand why if you understood the underlying technology.