BLOG

Is Polymer The Future of Front-end Development?

What are the current challenges surrounding Polymer JS and are these fixable?

Read to learn what the Polymer JS holds in store for developers.

Is Polymer The Future of Front-end Development?

PolymerJS is another open-source JavaScript library for using web components to make web applications. Developed by Google developers and released on GitHub, Polymer Js is designed to imitate the features present on the web platform to build components.  It’s the best library to introduce interactive application structuring by compiling components. It is being used by Google services and many other platforms. The popularity of PolymerJS in the market can be attributed to its structured design procedures i.e. the components. The very reason they have strengthened support for web components and have outstanding offline modules in comparison with React. 

Features of Google Polymer

  • PolymerJS library is designed with top web standards API which enables the option to build custom HTML elements.
  • Option to build your own reusable and customizable modules using polyfills web component specifications. 
  • With the feature of computed properties, you can view updates automatically with a computed value change.
  • With the app layout feature, you can create responsive designs.
  • Supports quick and easy development of hybrid applications
  • Create gesture events.
  • Comes with both one-way and two-way data binding to ensure one-way binding.
  • Shadow DOM: This encapsulates CSS, JavaScript, and templates to keep your web component code modular and separate from the rest of the DOM.

Pros and Cons of Polymer JS

Following are the pros and cons of Polymer JS

Pros

  • It allows you to create components that will facilitate understanding how things work in the same component. This will prepare you for writing plugins in JavaScript.
  • It will put you at liberty to create something people desire. 
  • Everything will be stored in elements and the unimportant codes will be discarded automatically.
  • Reduces the gap between the developer and the designer.

It ensures a work balance between the designer working on Web page UX and developers who are more concerned with the Web page functionality. With the help of polymer elements (themes and designs), developers don’t have to modify complex web page source code to match the designer’s specifications.

  • It is three times faster on Chrome and four times faster when used with Safari. It is believed to be more convenient and easy for developers to create feature-rich applications and websites.

Cons

  • It will be time-consuming to make components for every browser. You will know how different browsers work with shadow DOM.
  • It will be relatively slow in performance when operated using mobile devices as mobile devices don’t have as powerful a JS engine as the web does.
  • It doesn’t work with Internet Explorer.
  • There’s no clarity as to how you can organize larger applications using Polymer JS.
  • Requires download of the entire library and Polyfills.

How Often do Developers Opt for Google Polymer for Front-End Development?

Compared to React, Polymer JS doesn’t have much to offer, probably the reason why many of the developers don’t opt for it. Another is Angular2, which serves as an alternative to Polymer JS and both React and Angular2 enjoy a bigger community than Polymer JS. These aren’t the only ones that can be compared with Polymer JS but definitely the more popular ones. It isn’t likely for developers to choose Polymer JS leaving the above-discussed because of the constraints of Polymer JS that will be discussed later. 

Whereas, it is used on the Google websites such as Youtube, Google play music, and few others. Youtube is entirely developed using Polymer JS and the Chrome settings page is Polymer JS too.

Should You Use PolymerJS? The Reality!

PolymerJS on paper has an appealing approach but it is an idea that is ahead of its time. Polymer JS places several components requirements on the browser relying on technologies that are still in the process of standardization (by W3C) and are yet to be integrated into the browsers. Examples include the shadow dom, template elements, custom elements, HTML imports, mutation observers, model-driven views, pointer events, and web animations. These are great technologies but for now, aren’t available on modern browsers. The polymer is based on the strategy to have front-end developers use these still-to-come technologies that are currently in the process of standardization (by W3C) as they get launched on these browsers. 

To fill in the gap, Google polymer suggests the use of polyfills (downloadable JavaScript code which provides features that are not yet built into browsers). These polyfills are designed in a way that they can be easily replaced when the native browsers get these technologies introduced.

To simply put, we will be using JavaScript libraries (i.e., polyfills) to avoid the use of JavaScript libraries. Makes sense?

To make it easy to comprehend, the Google polymer theoretically is relying on technologies that are yet to come to these browsers. Polymer JS serves as an example of how element-centric applications can be built in the future (when the browsers get all the necessary features and dependency on polyfills ends). For now, Polymer seems like an interesting concept but not a practical one to be used for creating robust and dynamic applications which is why you might not come across a Polymer tutorial outside of Google documentation. 

Rough Edges Around Google Polymer

Considering the newness of Google Polymer as a technology, novice app developers might find it a bit brittle because of some of the findable rough edges.

Not enough documentation and guidance 

  • Polymer JS doesn’t have all the UI and non-UI elements documented. The only guidance available is demo code at times. Sometimes, it requires accessing the source code of a polymer element to understand how it ought to work.
  • The organization of the larger applications is unclear. Questions regarding the passing of singleton objects between elements and the strategy to choose to test the custom elements are particularly not made clear. The guidance and information available are scant right now.

Dependency errors and versions 

You will encounter dependency errors that point to the different version dependencies even in the same elements even when you download the polymer.js elements as recommended. It has been established already that Ploymer.js is currently under development regarding the element’s issues but it can make development challenging thus might put off developers to work with it.

Mobile platform problems

The performance of Polymer JS on mobile phone platforms is nothing short of a frustrating experience. 

  • It can be taxing to download the entire library and polyfills as the process is slow. You also need to download every element that you will be using.
  • The processing of libraries, polyfills, and custom elements is an expensive task on mobile phone platforms. The process is slow to the extent that even after you’re done downloading, you might have to bear a blank screen for a few seconds
  • Functionalities like drag and drop and others at work absolutely fine on the desktop don’t work or get the support on mobile devices.

Confusing and insufficient error reporting

  • You can simply receive an error message on the console if you break something related to the core layer itself or misspell an attribute. Sometimes, you can determine where the problem lies, and sometimes you can’t pin the source of the problem which can be really frustrating. 

Conclusion

Polymer JS is an interesting technology but it still is in the development stage and not fully functional. It can’t be relied upon to develop large-scale enterprise production-ready applications as of now but once it gets completed then the story can differ exponentially. Other than this, there aren’t many guides and tutorials available explaining the working of Polymer JS. 

Polymer makes some convincing arguments but the opposition to it exists and can’t be sidelined. We will have to wait and see how it is going to perform when it’s all done.