News for hackers. Stuff that matters.
Re:Moving from Native Apps to Progressive Web Apps by josephg on Sunday November 13, 2016 @01:52AM (#12942194)
As a web developer, I honestly hope the author of this post is wrong. Performance of modern web apps is simply awful compared to their native counterparts by any measure. They load slowly and consistently feel sluggish in comparison to proper native apps. Slack takes seconds to load and it'll happily sit on over a gig of ram while in use. (And remember, its a glorified IRC client.)

Web apps only have two benefits over native apps:

1. They're easier to build in a cross-platform way, because you just have to make the app once

2. Users don't need to install anything

I hope in the long run we solve both of those problems for native apps and move back to writing applications which don't depend on a DOM implementation to run. React-native is a great step toward solving (1). I hope that in time we can have modern (reactish), good looking cross-platform toolkit for native app development.

But the biggest hurdle is (2), which very few people are attacking. App stores have helped a lot, but we need to be able to run native apps without installing anything. It should be as easy as it is on the web. Unfortunately native app authors usually assume all their assets are bundled. Nobody even thinks about how long it takes from the point when a user decides to install an app to when they see the first content. On the web we count that time in milliseconds and on native apps we count minutes. There aren't any hard technical problems there - we obviously manage it on the web, so its easily possible. We need native apps to catch up if they are ever going to be able to compete as a platform.

Re:Moving from Native Apps to Progressive Web Apps by dfabulich on Sunday November 13, 2016 @02:20AM (#12942247)
In addition to the benefits you mention, web sites can be created/updated without anyone's approval, and web browsers make URLs prominent (which makes it easy to share content via any textual format).

> Performance of modern web apps is simply awful compared to their native counterparts

> There aren't any hard technical problems there - we obviously manage it on the web, so its easily possible

"easily?" Didn't you just say we're managing it badly on the web?

It turns out that it's quite difficult to develop an app-like experience that loads from scratch on a cellular connection and is ready for the user to interact in just seconds. The app folks will have it just as bad, if not worse, because they've got no practice.

Re:Moving from Native Apps to Progressive Web Apps by the8472 on Sunday November 13, 2016 @03:53AM (#12942478)
The unilateral updates and URLs pointing to remote content also have downsides.

* it assumes you're online

* features can be removed at any time even if the user relies on them

* link rot

* totally unsuited for sensitive data

Re:Moving from Native Apps to Progressive Web Apps by josephg on Sunday November 13, 2016 @03:22AM (#12942416)
My point is that the technical problems have been solved. That is to say, there aren't any new, difficult CS problems we have to figure out before we can bring the desktop up to par.

Instead solving this problem will 'just' require tons of work. We need to improve our compilation toolchains to allow native apps to load progressively. We'll need better ways to monitor and analyse application size & performance. We'll need new libraries and we'll need buy in from vendors. And as thats going on we need to convince developers to actually care about this stuff. Again, all these problems have been solved for the web. We 'just' need to backport all that stuff to native apps.

No question there's lots of work to do. But its all (obviously) solvable with code.

Re:Moving from Native Apps to Progressive Web Apps by SkyMarshal on Sunday November 13, 2016 @04:34AM (#12942565)
Regarding #2 I feel like Oracle is dropping the ball here with Java for the desktop. They need to provide a lightweight JVM tailored specifically for desktop apps and for bundling into a self-contained install package, so that the app doesn't have to confuse users by downloading the JVM separately. Just pack it all into a single .msi/.dmg/.dpkg/etc, download one file, install it, and you're good to go. The JVM should be local to that app only, not global to the whole OS.

The filesize may be a little bigger than native apps, and redundant if you install more than one of such apps, but in this day and age of high bandwidth and storage that's an acceptable tradeoff. I spent 2015 working on a Win/Mac/Linux app where this would have been the preferred solution, it was annoying that in 2016 it still doesn't exist and as a result we're getting janky Node.js-based platforms like Electron (http://electron.atom.io/) instead.

Qt and GTK are the only mature enough x-platform non-web-based options it seems, but Qt is not open source and GTK's look is dated.

Re:Moving from Native Apps to Progressive Web Apps by gioele on Sunday November 13, 2016 @05:02AM (#12942631)
> Qt is not open source

Not only is Qt open source, it is also free software according to FSF. Core Qt and most modules are released under the LGPL, the rest under the GPL.

https://www.qt.io/licensing/

Qt even has a binding poison-pill promise that will make the code BSD-licensed should Qt (the company) stop releasing it. See https://www.kde.org/community/whatiskde/Software_License_Agr... and https://www.kde.org/community/whatiskde/kdefreeqtfoundation....

Re:Moving from Native Apps to Progressive Web Apps by jaysoncena on Sunday November 13, 2016 @08:33AM (#12943225)
He's probably referring to QT5. If you're a for-profit business and using QT, most likely your software is closed-sourced which requires a commercial license.

I've worked with a team who develops a windows app which still uses QT4. They cannot migrate to QT5 since it requires a commercial license.

Re:Moving from Native Apps to Progressive Web Apps by blub on Sunday November 13, 2016 @08:38AM (#12943246)
Open source doesn't always mean that one can do whatever they want with it, nor does it mean gratis.

Still, LGPL libraries can be used for commercial software, this is a rather common use case.

Re:Moving from Native Apps to Progressive Web Apps by SkyMarshal on Monday November 14, 2016 @03:16PM (#12952914)
Yes, we looked at Qt 1.5yrs ago, and we were a for-profit startup creating an MIT-licensed open source desktop software that we needed to add a UI to, for which we were considering Qt5 for specific features. It was a weird, edge case mix.
Re:Moving from Native Apps to Progressive Web Apps by skissane on Sunday November 13, 2016 @05:52AM (#12942764)
Have you looked at "Self-Contained Application Packaging"?

https://docs.oracle.com/javase/8/docs/technotes/guides/deplo...

(Disclaimer: I work for Oracle but I don't speak for them)

Re:Moving from Native Apps to Progressive Web Apps by SkyMarshal on Monday November 14, 2016 @03:13PM (#12952892)
Thank you! Is this supported/automated well in any IDEs?
Re:Moving from Native Apps to Progressive Web Apps by skissane on Monday November 14, 2016 @03:45PM (#12953166)
NetBeans supports it - https://netbeans.org/kb/docs/java/native_pkg.html

(I can't comment on whether it is supported well since I've never used that part of NetBeans.)

Eclipse was apparently working on support for it at one point, but it looks to me like the work has stalled (just my impression from their bug database, I don't really know):

https://bugs.eclipse.org/bugs/show_bug.cgi?id=441274

https://wiki.eclipse.org/JDT_UI/Java_Packager

Re:Moving from Native Apps to Progressive Web Apps by SkyMarshal on Monday November 14, 2016 @05:24PM (#12953910)
Thanks!
Re:Moving from Native Apps to Progressive Web Apps by pjmlp on Sunday November 13, 2016 @08:44AM (#12943266)
I imagine you are out of touch with Java efforts.

Since Java 8, the JDK offers tooling to package applications, making it standard the way many third party bundlers used to work.

In Java 9 there is a linker, which will allow for an application personalised JRE, coupled with the startup code.

The biggest problem was that using Swing properly required a mix of programming and designer skills, which most didn't bother to learn.

At least on enterprise space of our customer base, we are still on Java and .NET for native applications, no Electron on sight.

Re:Moving from Native Apps to Progressive Web Apps by mateuszf on Sunday November 13, 2016 @11:53PM (#12947651)
> The biggest problem was that using Swing properly required a mix of programming and designer skills, which most didn't bother to learn.

What about JavaFX 1/2? Do you have any information about its popularity and usefulness?

Re:Moving from Native Apps to Progressive Web Apps by pjmlp on Monday November 14, 2016 @02:35AM (#12948119)
Sadly yes.

It is the Java version of XAML, and it is quite nice to use, but the uptake has been on the slow side. There were quite a few sessions at JavaONE 2016:

https://oracle.rainfocus.com/scripts/catalog/oow16.jsp?event...

Probably the place where it has seen more uptake has been in car infotainment systems, like by Volkswagen.

https://static.rainfocus.com/oracle/oow16/sess/1462531766187...

However our Java desktop native projects are still mostly Swing based, or make use of either Eclipse or Netbeans as desktop framework.

And of course there is the Android Java fork, which doesn't offer any JavaFX compatibility (some guys on the community are porting it though).

Re:Moving from Native Apps to Progressive Web Apps by SkyMarshal on Monday November 14, 2016 @02:57PM (#12952710)
I am a bit out of touch, last looked at this stuff in spring of 2015, thanks for the update, good to see!
Re:Moving from Native Apps to Progressive Web Apps by pedalpete on Sunday November 13, 2016 @02:44AM (#12942328)
Why would you want to solve the problems of native apps rather than solve the problem (there is only one) of web apps, which is the performance issue.

Customers don't install apps for the most part. Why try to solve for that?

Re:Moving from Native Apps to Progressive Web Apps by josephg on Sunday November 13, 2016 @03:07AM (#12942382)
Why? Because building hack on top of hack is convenient, but terrible craftsmanship. The web today is a red hot mess of overlapping standards and inconsistent APIs. Google chrome is up to ~20M lines of code now, which makes it bigger than the linux kernel (with every device driver). Its basically a small virtualised operating system at this point.

How many more lines of code do you think it'll take for chrome to feel fast and light again? Is it possible to achieve that by adding code, forever? And then to work around all the cruft in browsers we have frameworks like react - conceptually beautiful but which do layout by diffing thousands of DOM elements through javascript.

The stack is a mess, and I don't see any direction it can possibly go but fatter, bigger and uglier than ever before. Forever. Surprisingly, this is a fate native apps have avoided. And in avoiding that fate new laptops have amazing battery life and work great. Well, until you open chrome or slack that is.

> Customers don't install apps for the most part. Why try to solve for that?

I don't write code for customers. I do it because as a kid I fell in love with the craft. I just... didn't fall in love with programming for this. Nope nope nope I want off the train before I throw up.

Re:Moving from Native Apps to Progressive Web Apps by dasil003 on Sunday November 13, 2016 @03:42AM (#12942456)
The reason native apps have avoided that fate is because they are not cross-platform, they are entirely controlled by a single vendor. Of course you also have cross-platform GUI toolkits like Java and Qt, but they suck because they don't have true vendor support.

The web has solved these things: it's an open standard which any serious device maker must support to be taken seriously. It can load applications in a relatively safe sandbox on demand. And it does all this with tremendous backwards compatibility that even 90s Microsoft would be envious of.

You're absolutely right Chrome is a virtualized operating system, but that's what it takes to be open and cross platform. Designing a better platform is the easy part; getting it to cross the chasm where it has first class device vendor support on a majority of platforms is the practically insurmountable part. I'm not saying it can't happen, but I don't think any organized group of humans has the power to do it intentionally.

Re:Moving from Native Apps to Progressive Web Apps by blub on Sunday November 13, 2016 @08:27AM (#12943202)
The irony in all this push towards web apps is that browsers will become more and more bloated, out of the user's control and insecure.

Chrome is not a virtualized OS, it has become a mega-plugin similar to Java or Flash, except with better but still insufficient security. As more of the platform services are exposed to the internet, we'll start seeing new and interesting exploits, such as tracking users based on battery status and attacks on the local network (https://news.ycombinator.com/item?id=12406310).

Re:Moving from Native Apps to Progressive Web Apps by caleblloyd on Sunday November 13, 2016 @06:21AM (#12942844)
> The stack is a mess, and I don't see any direction it can possibly go but fatter, bigger and uglier than ever before.

Yes, the stack is a mess! I am hopeful that Web Assembly will make things better.

Re:Moving from Native Apps to Progressive Web Apps by the8472 on Sunday November 13, 2016 @03:36AM (#12942444)
The problem of the browser environment is that it is yet another, less-powerful abstraction level on top of the operating system.

And the worst thing is that it is a hermetically sealed abstraction. There is no escape hatch to access the underlying primitives in those cases where you need them. Even virtual machines offer device passthrough these days for those cases where the virtualization overhead is too expensive and you need exclusive, direct access to some hardware. You could even assign the device to a container inside the VM.

Browsers offer no such way to punch through all the abstraction layers.

They don't even speak berkeley sockets.

Re:Moving from Native Apps to Progressive Web Apps by gbog on Sunday November 13, 2016 @06:05AM (#12942804)
This. And performance is actually very easy to solve, it is already solved by the sites like hn, wikipedia, etc: focus on content and drop all the useless "beautiful" stuff.
Re:Moving from Native Apps to Progressive Web Apps by paganel on Sunday November 13, 2016 @04:48AM (#12942584)
> Performance of modern web apps is simply awful compared to their native counterparts by any measure

For what is worth I can now only access FB from my phone using the browser (the web-app, so to speak), the native FB app has become ridiculously slow for quite some time. I use the native app only for uploading photos, once every 3 or 4 months. I'm using an iPhone 4 of which I'm still pretty happy, don't feel the need to drop 600+ euros on a New phone just yet if this one still does its job.

Re:Moving from Native Apps to Progressive Web Apps by rudedogg on Sunday November 13, 2016 @05:47AM (#12942751)
The app is said to have over 18,000 classes: http://quellish.tumblr.com/post/126712999812/how-on-earth-th...

I'm guessing that link will crash on mobile, it slows down chrome on a desktop.

Re:Moving from Native Apps to Progressive Web Apps by blub on Sunday November 13, 2016 @08:30AM (#12943210)
The native app tracks you harder, better but alas, not faster.

This will be fixed once web apps get more capabilities, don't worry, the entire web development community (except the josephg fellow above) is praying for it.

Re:Moving from Native Apps to Progressive Web Apps by pjmlp on Sunday November 13, 2016 @08:50AM (#12943291)
I am also voting along josephg.

Since I returned back to native apps development, couldn't be happier, instead of having to deal daily with the crap and hacks on top of hacks, to make a stack designed for interactive documents work as a virtual machine.

Re:Moving from Native Apps to Progressive Web Apps by claudiug on Sunday November 13, 2016 @12:59PM (#12944578)
You are following that guy on twitter, you will he is a avid javascript guy. So you can take his words with a grain of salt.

I never see any web app one mobile feel good. But you never know.

also, with kotlin and swift doing native app is not that complicated. Learning a new API on top of native API I don't think is safe.

Also, google, apple they can change the rules and parts of the apps don't work anymore for x reason.

Re:Moving from Native Apps to Progressive Web Apps by on_and_off on Sunday November 13, 2016 @06:01AM (#12942790)
Interesting that you mention #2. This is what Instant apps want to solve. tbh I wonder if it is that much of an issue but we are probably going to test it at some point.

About #1. I am not that convinced that they are easier to build. Well they are, but building them in a way that fits each platform and performs well looks harder than making 2 apps.

I should mention that I work in a 30 devs teams (half iOS, half Android) working on the same in-house app.

I do believe that there is some potential to reduce duplicated work with something like j2objc. It is probably not the definitive expression of this concept, but it seems to me that it should be possible to share a lot of the business logic and this is what this tool aims to do. Some of the data objects should be shareable as well.

All the rest : UI, integrating with the Home screen, notifications, services, et cetera is just very specific to the platform and IMO should be written specifically for each platform.

I am still waiting for the perfect kotlin-to-swift library allowing that.

Re:Moving from Native Apps to Progressive Web Apps by daleharvey on Sunday November 13, 2016 @05:31AM (#12942706)
Web apps do not need to be slow, they are slow because they are badly written or more usually rely on the network far too often. There is no reason

    <Button android:id="@+id/button"
is faster than

    <button>
Re:Moving from Native Apps to Progressive Web Apps by aikah on Sunday November 13, 2016 @08:02AM (#12943129)
> Web apps do not need to be slow

They are slow because HTML rendering engines are slow, they are slow because Javascript engines aren't that fast compared to Java, C or Swift. Native frameworks don't need to deal with the complexity of an HTML layout and CSS. And native applications can be optimized to use way less memory than web apps. There is very little room for performance tuning in a web app, since it depends on the browser engine. Something good for a browser can degrade performances in another browser.

> <Button android:id="@+id/button">

Isn't dynamic, it is inflated once and turned in a class instance.

> <button>

Is highly dynamic as it can be replaced by anything at any time in an HTML page.

Re:Moving from Native Apps to Progressive Web Apps by daleharvey on Sunday November 13, 2016 @09:34AM (#12943456)
Rendering engines are capable of turning html into on screen drawn pixels more than fast enough for the user to perceive and are capable of maintaining 60fps drawing.

JavaScript can certainly deal with handling user input faster than the user can perceive, rendering engines can 'inflate' html (cache the layer tree) of dom that hasnt been invalidated.

While a commercial failure I worked on Firefox OS and we built an OS and application suite that on low end hardware compared often favorably than the equivalent on Android. The web does not need to be slower than native applications it just needs to be built better

Re:Moving from Native Apps to Progressive Web Apps by qwtel on Sunday November 13, 2016 @10:39AM (#12943819)
> we built an OS and application suite that on low end hardware compared often favorably than the equivalent on Android

I haven't heard this before. I assumed firefox os failed because the web stack proved to be too crufty for the low end hardware. Are you aware of any resources that go into more detail?

Re:Moving from Native Apps to Progressive Web Apps by daleharvey on Sunday November 13, 2016 @11:02AM (#12943936)
Most of the code and metrics are now outdated but https://wiki.mozilla.org/Firefox_OS/Performance will have some historical perspective, http://eideticker.mozilla.org/#/android/lg-g2x/mozilla-centr... was our test for comparison between android and fxos.

When we started it was an open question whether we could build a fast enough platform to compete with native applications, thats no longer a question I think about.

People think the web is slow because opening facebook.com takes >200 requests loading >4MB over the network of which a large chunk blocks any rendering (and all of which interferes with it). Build a web application which loads its UI from disk, caches application data, only touches the network for updates, does not block rendering waiting on bundles of JavaScript and uses proper practices for JS / dom manipulation (use transforms over animating top/left, dont attach process heavy scroll handlers) and your web app will be as fast as a native app

Re:Moving from Native Apps to Progressive Web Apps by z3t4 on Monday November 14, 2016 @02:55AM (#12948196)
I think the problem is that web apps is new and we are still experimenting, but new developers, and there are a lot of them, now start with learning a framework, that compiles to another framework that compiles to a framework that complies to JavaScript and HTML. I think we need to take some steps back, and try writing plain old HTML, CSS and JavaScript and also teach new developers how to do so.
Re:Moving from Native Apps to Progressive Web Apps by aikah on Wednesday November 16, 2016 @01:12AM (#12964899)
That's a lot of do this/do that. With native apps you get all that for free with no effort and there is always a lot of room for optimization. The web on the other hand is hostile to apps.
Re:Moving from Native Apps to Progressive Web Apps by izacus on Sunday November 13, 2016 @08:20AM (#12943176)
The first one is also precompiled for quick parsing at compile time and doesn't burn battery/CPU every time a user accesses the app.
Re:Moving from Native Apps to Progressive Web Apps by victorhooi on Sunday November 13, 2016 @02:09AM (#12942224)
Is this a given though?

What is stopping a progressive web-app from performing as well, or nearly as well (to be impercetible).

I would have assumed that most of the time waiting is on network events - so using things like service workers to handle things asynchronously, and also handle caching would reduce things.

I watched a presentation on how Google made the IO 2016 webapp (https://events.google.com/io2016/):

https://www.youtube.com/watch?v=__KvYxcIIm8

and they used quite a few clever tricks to tweak performance.

Re:Moving from Native Apps to Progressive Web Apps by bsder on Sunday November 13, 2016 @03:01AM (#12942372)
> What is stopping a progressive web-app from performing as well, or nearly as well (to be impercetible).

Direct access to graphics, direct access to network, and direct access to storage.

The problem is that direct access to network and storage are ALSO security hazards.

Re:Moving from Native Apps to Progressive Web Apps by josephg on Sunday November 13, 2016 @03:25AM (#12942422)
The desktop is (slowly) making inroads on that front through app sandboxing, backported from mobile operating systems like ios and android. I really look forward to being able to run native apps on my desktop without worrying about the network & filesystem access they have.
Re:Moving from Native Apps to Progressive Web Apps by pjmlp on Sunday November 13, 2016 @08:53AM (#12943310)
That is the whole point.

Native apps are fast and enjoy every feature the OS has to offer.

Web apps are a pile of hacks that require conferences sharing clever tricks, usually browser specific, to make them usable at all.