Progressive Web Apps (PWA's)

Today, we install an app on our mobile phone using the app stores available for each operating system. This process allows us to find our favorite apps and companies, like Apple and Google, use this model to make money.

The mobile apps appeared with the intention of adding functionalities to a mobile phone. Apps work more closely to the hardware, so it’s more easy to do software that uses things like GPS, Blueototh, NFC, Accelerometer, etc. This provides rich applications to users and better user experience in detriment of using a browser. However, in the last few years, the web browsers and web technologies (like JS frameworks) evolved a  lot!

The Progressive Web Apps (PWA’s) appear in this context. Basically consists on Rich Web Apps with the functionalities of the mobile devices. In a simple way, imagine an Web App with GPS or bluetooth functionalities… Today, web browsers doesn’t show only websites, they show rich apps that can be even more rich with some of the features of PWA’s.

PWA’s could be the next big thing on web development. It could redefine the way we use mobile apps and the way we explore the web.


Nowadays a company that pretends to offer a complete software solution has to worry to hire specific resources to accomplish the mobile and web developments. Beyond this, the server API’s also may need to adapt to each client component. On this situation, companies has to hire different specialists to accomplish the all solution. This means more money and more time to market. The PWA’s tries to minimize this problem. In a simple way, you develop one time, and the solution will work on any kind of device. It is an website which may have app features. On this way you only need one team to build all  the client solution.

Another advantage consists on the installation process of a mobile app. Today, a user must take some steps before start using the app: go to the app store, search by the app, install, authorization to install… All this steps has the consequence of loss of potential users. Every Step Costs You 20% of Users
PWA’s can also minimize this. You use a PWA like a webpage access, so you don’t need to access to an app store. Also, we do not have to worry about updates to each application anymore.

Today, a user visits an average of 100 unique sites per month, but spends 10 times less on a site than an app. However, the time spent on apps is only done on the same 3 or 4 apps. PWA’s try to bring together the best of both worlds, users spending more time on the app (such as mobile apps) and easier access to more apps (just like traditional websites).

Service Worker

In technical terms, the role of the Service Worker is the hallmark of this new standard of development.

PWA Architecture
Progressive Web App Architecture

Technically the Service Worker consists of a Javascript script that runs in the background in the client (browser). This way you can synchronize with the server or launch notifications for the client independently of the user’s navigation. With this service you can also manage the application cache. When running the application, the Service Worker can load the information directly from the local cache instead of always making the request to the server as in a common web page. The programmer can now define more autonomy in the client by minimizing requests to the server. “App load may be almost instantaneous just like a native app!”

Currently, not all browsers support Service Worker. However, everything indicates that it is a matter of time. Chrome, Firefox or Opera are some of the browsers that already support this technology. Support for Microsoft’s Edge is under development and there are already some indications that Apple supports technology in Safari.


Some features of PWA’s are:

  • Compatible with any device. (as long as the browser supports it)
  • Fast loading! (probably at first load may be a bit slower if compared to a native application)
  • It is responsive and so adapts to any screen.
  • Native appearance. “Same as an app… “
  • No installation required. (And you can add a “link” to your smartphone’s home screen, simulating access to current mobile apps)
  • Works Off-Line! (Thanks to Service Worker)

Resistance to Change

There seems to be only advantages with PWA’s, but for mobile application mediators it may not be very enjoyable to end up with their stores. Nowadays, the stores bring a lot of money to Google and Apple. With PWA’s, new business models will have to be introduced…

Current Applications

There are already many applications with PWA technology. Some examples can be seen at this link:

Google currently has a site that helps you understand PWAs in more detail. It’s interesting to see the investment that Google makes in trying to steer the market to this new standard. Even when this seems to go against the Android application store. On the other hand, it could be a bet on cloud services (like Firebase) to deploy your PWA’s.

Personally, I am very interested in this area. I always liked watching the evolution of the web and I’ve always been curious about the mobile. I did not deepen on mobile development because if I’m going to develop some app, I would have to launch one version to all systems. I would have to invest a lot of time, to build one app to different systems and I wouldn’t be good on any of them. Although later discovering solutions like Ionic, I ended up not having the opportunity to invest the time that I would want in this type of frameworks.

This was a little introduction to PWA’s. I hope you like.

Functional JavaScript: forEach, map and reduce

Today, JavaScript is one of the most popular programming languages. Over time it has evolved and allowed to us build rich web applications and from a few years ago server applications also. However, writing code in JavaScript requires some attention, since the code could turn very messy easily. Functional Programming does not solve this problem at all, it is more an paradigm of writing code. It doesn’t tell you how do you structure your project as the popular frameworks like Angular or Vue.js.

This article is only about Functional Programming, I hope in the future to bring other articles about JavaScript and JavaScript Frameworks.

Now, let’s see some application of functional programming on JavaScript.

Considering the variable products that contains the properties name and cost:

var products = [
  name: 'Juice',
  cost: 4.2
  name: 'Rice',
  cost: 2
  name: 'Cookies',
  cost: 11.99

To print the description of all products on browser console we can build an function like this:

function logProducts(products){
 for (var i = 0; i < products.length; i++){
  console.log('product: ' + products[i].name);

This function makes an interaction through the list of products with for instruction to show the description of each product.

We can also specify the same behaviour with the follow function:

var logProducts = function(products){
 for (var i = 0; i < products.length; i++){
  console.log('product:' + products[i].name);

The difference now is that we haver an variable that contain an function (logProducts).

Let’s get more advantage from functions associated to variables:

var logProducts = function(products){
 for (var i = 0; i < products.length; i++){
  console.log('product: ' + products[i].name);
var doSomethingWithProducts = function(products, doSomething){
doSomethingWithProducts(products, logProducts);

The code was changed a little. Yet, Even in terms of behaviour nothing changes. The main difference is on pass of the function “logProducts” as a parameter to “doSomethingWithProducts”. It doesn’t look very useful at the moment, but is this functionality that allows to JavaScript apply the principals of functional programming.

To show the name of all products we had to create a for instruction and a variable to control the iteration (based on imperative programming).
However, if we use the forEach function we can simplify the code:

var logProductName = function(product){
 console.log('product: ' +;

Now we can see some advantages. The code is more clean and we do not need an auxiliary variable to iterate through the products.

And if we want to get the total cost of the products?

var sum = function(a, b) {
 return a + b.cost;
var total = products.reduce(sum, 0);

The reduce function returns only one value. The return is the accumulated result of the last call of the function “sum”.

Using other example, imagine that we need to get the element object for each identifier.
Let’s take a look on the follow code using imperative programming:

var ids = ['products','basket','categories'];
var listOfElements = [];
for (var i = 0; i < ids.length; i++){
 var el = document.getElementById(ids[i]);

Now the same behaviour using Map function:

var getElement = function(id){
 return document.getElementById(id);
var listOfElements =;

This “way” of programming requires some practice but in my opinion it allows to have more clean code and more adapted to the functionality that as consequence is more comprehensive.

This article was an little introduction to functional programming using the ForEach, Reduce and Map functions.