Life's random bits By b1thunt3r (aka Ishan Jain)…
PWA vs Native

PWA vs Native

Ishan jain
How much time does a concept need, before it is fully mature and accepted by the masses?

Disclaimer: Currently I am employed by Microsoft, but my views and thoughts are still my own. The reason I joined Microsoft was, the work Microsoft have been doing for last couple of years in Open Source Space. Today I am a advocate for Open Source representing Microsoft.

Background

iPhone

I remember when iPhone was launched back in 2007, there was no support for Apps. If I remember it right, the idea was to use only Web Apps. But at the time the support for rich web apps was a bit, lets say, scarce.

App Marketplace

The App Store in Apple eco-system was a after thought, to enable more rich content to the device, apart from built in apps. The App Store was released with iPhone OS 2.0, in 2008. Google released its first Android phone (HTC Dream) with Android Marketplace (renamed to Play Store in 2012) from the start the same year.

The idea of app marketplace was not new. Most Linux at the time came with a package manager, which is a primitive form of marketplace.

As early as 2005, Nokia released a marketplace for its N-series tablets. By the time I started to use Nokia N900 in 2010, marketplace was a core component of the Maemo OS.

The Web

So why did the idea of web apps fail at the time of the Steve Jobs envision?

I think the answer lies in, how the Web was perceived at the time. Web was mainly meant to be accessed by devices with big screens, with lots of computing power and little to no access to the host. Web at the time was isolated inside the browser. Microsoft had released ActiveX to enable API to access system resources, but ActiveX was restricted to the Internet Explorer, and to be fair, was quite popular with in the enterprises.

JavaScript

The second, and the biggest problem I think was the JavaScript. Back in 2007, JavaScript did not have that much of innovation, and lacked the performance. I would say it was V8 and SpiderMonkey followed by Chakra that made JavaScript a contender for mainstream development. Before the V8 and NodeJS, JavaScript was not meant to run full blown enterprise applications.

It is only after NodeJS with help of V8, was able to show that JavaScript can be used for heavy enterprise applications. Since then we have had new concepts like; Mobile First, Web Storage, Responsive Design, Single Page Applications, Progressive Web Apps, etc.

PhoneGap

I remember as early as 2012, I was looking at PhoneGap. PhoneGap was one of the few frameworks at the time that gave you access to some of native APIs from JavaScript. This was achieved by presenting the Web Application inside a micro browser (WebView).

Since then there have been several framework try to achieve same thing. The one I used most was, Intel XDK. Today most of these frameworks have been super seeded by Apache Cordova.

Xamarin

At same time as PhoneGap was trying to wrap the Web Application inside a WebView, there were other efforts to use other programming languages then the platform native (Objective C for iOS and Java for Android). One of these was Xamarin.

The Idea behind Xamarin is simple, write your app in C# and compile it to native Android and iOS packages.

Windows 8 and Window 10

Along side Windows 8, Microsoft also released a new concept Modern Windows Applications. These application will not use the tradition Win32 API, but rather a more modern Windows App API. Microsoft enabled developers to choose between WPF+C# or WinJS to developer these applications.

Along side Windows 8, Microsoft released a new OS that ran on ARM architecture, Windows RT. Windows RT could only run Modern Windows Applications.

With the release of Windows 10, Microsoft renamed Modern Windows Applications to Universal Windows Platform, now same UWP app could run on Desktop, Laptop, Mobile Phone, Xbox One, and many more Windows based devices.

Microsoft also tried with a liter version of Windows, Windows 10s, that could only run these UWP apps.

Pre Processors

As the usage of JavaScript become more mainstream, several new languages (i.e. CoffeeScript, TypeScript) were creates, to enable faster and more optimized code. The code written in any of these languages needs to be compiled to VanillaJS.

Because of the need of compilation, these languages are able to provide some features that might be experimental or not at all present the the current versions of the browsers.

TypeScript, among other things, is able to provide strong typed objects while the application is being developed.

State of Web

The new Web

With the advancements in the tech, since the release of first iPhone, the Web has come a long way. With the help of the newer and more optimized JavaScript engines we can run a heavy enterprise application in the browser with out feeling any major performance issue.

Even most of the apps we use today either are based on Electron or just live right into the browser. In fact, I am writing this article in Visual Studio Code, which is an IDE using the modern Web.

Frameworks like Angular, React and VueJS are designed to enable developers to create rich and heavy application using just JavaScript.

WebAssembly

One of the most resent breakthrough in the Web realm is WebAssembly. WebAssembly enables developers to run byte code directly in the browser. A developer can now write their app in any language they fancy, i.e. C#, Java, Go, C, C++, Rust, etc. As long as, it can be compiled to byte code.

Microsoft has released Blazor, that allows developers to write their application using ASP.NET Core technology. Blazor apps can run, without the need of a webserver, which is required by a traditional ASP.NET application.

Progressive Web Apps

Progressive Web App or PWA is not a framework, but more of a concept. A PWA is designed to work offline, with access to OS level API (in most cases), able to push notifications. In other words act and behave just like a native application, without any need to running any native code.

Another advantage PWA has over native app is, to publish the app one does not need to go through the established market places. One can install a PWA directly from the application authors website.

Stores

With help of some tools, a PWA can be packaged as a native application.

Just because PWA allows one to skip established marketplaces, it doesn't mean that one should not utilize these facilities to spread the word about your application. In some cases you will have better performances (specially on Apple hardware) if the application is installed via a marketplace.
It is always good to reuse the established infrastructure if it can be used, and is not a major blocker.

Also installing the application via a marketplace, will make the app behave more like a native application. If you just install it from the web, you are limited to maybe just a home screen icon.

Conclusion

It took more then a decade to reach the point when we can use Web Apps on our mobile phones. We can truly use the Web Apps, without the use of any workarounds and the with high performance. Today the performance and capability of Web Apps is on par with native apps. A developer can write a single Web App that will work on most modern devices.

KaiOS is what iPhone OS 1.0 was meant to be. KaiOS is based on FirefoxOS and uses exclusively WebApps. Today a lot of feature phones used KaiOS as the OS. Some of the notable KaiOS powered phones are Nokia's re-imagined cult classics like 8110 and 2720. KaiOS has PWA versions of all the major applications like Facebook, Twitter, WhatsApp, etc.

Since last year, I have been using just Outlook Web Access and GMail PWA (on some devices), and don't even realize that these are not native apps.
Most of the major app publishers have now a PWA version as the Web version of their apps. Lately I have left less and less need of installing application on my mobile phone, as lot of the apps I use natively have a PWA version.

With time we will not have any need to native applications, apart from corporations needs to control the market. PWA or Web Apps are getting same performance as native applications, with most of the benefits of native apps.
A carefully planned responsive website can be more effective then a native app, and with less effort one can reach all the major device platforms.