Category Archives: POLYMER.JS

PROS & CONS OF POLYMER.JS

Pros & Cons of Polymer.js

Building modern web applications requires a lot of tooling. This includes pre-processors, JavaScript frameworks, testing tools and much more. As the complexities of these applications increases, the breadth of tooling and services are needed to manage them.

Web components aim to solve some of these complexities by providing a consolidated way to create new elements that encompass rich functionalities without the need for extra libraries.
To bridge the gap and to give the developers an access to this rich functionality, Google has created the Polymer library which serves as a set of Polyfills to bring the promise of Web Components to you today. In this article, we will be covering what exactly the polymer is and its advantages and disadvantages.

WHAT IS POLYMER

The polymer library is designed for the developers to create some great and reusable components for the modern web. Polymer library is a set of Polyfills that helps a developer to create Web Components on all modern web browsers. It provides the framework for defining, creating, and rendering complex custom elements in a simple manner. It also helps to simplify the way you use complex components by:

• Encapsulating the complex code and structure.
• Allows the developers to use simple-to-use tag style naming convention.
• Providing a suite of predefined user interface elements to leverage and extend.

With Polymer.js, you can create your own HTML elements and can compose them into complete complex web applications that are scalable and maintainable.

Below is the sample code for Polymer.js:

Polymer({
is:’component-id’,
properties:{
propertyOne:{
type:Object,
value:{},
observer:’_valueChanged’
},
propertyTwo:{
type:Boolean,
value:true
}
},
ready:function(){
var self = this;
self.set(‘propertyTwo’,false);
},
_valueChanged:function(){
var self = this;
console.log(self.propertyOne);
if(self.propertyOne){
self.userDefinedFunction();
}
},
userDefinedFunction:function(){
console.log(‘its an user defined function’);
}
});

WHAT IS POLYFILLS

For backing Web Components, we always need Polyfills. The webcomponent.js Polyfills enables the Web Components in browsers that lack native support. Webcomponent.js is set of Polyfills built on the top of Web Components specifications.

THE MAJOR ADVANTAGES & DISADVANTAGES OF USING POLYMER:
PROS:
• Polymer believes in leveraging the browsers “Native” technologies rather than relying on some increasingly complex custom JavaScript libraries.
• Polymer web development is always about creating only elements.
• The polymer provides the ability to compose enclosed JS, CSS, and HTML as Custom elements.
• Polymer elements provide templating and bi-directional data binding. It also provides new functionality such as Shadow DOM which enables the encapsulation of CSS.
• Reduces the gap between developer and designer:
Polymer assures an easy working relationship between designers who uses Web page UX and developers who are concerned with Web page functionality. Developers use Polymer elements which include design and themes, which means there is no need to modify complex Web page source code to match designer specifications.
• Quick: The Polymer is a new library which is three times faster on Chrome, four times faster on Safari. Also, it is ready to be used in production applications and believed to be easier for developers to produce feature-rich applications and websites.
CONS:
• It is not entirely clear that how to organize larger applications.
• Dependency errors and pointing to a different version of dependencies.
• Downloading of entire library and Polyfills.
• Lack of server side rendering.