Why did I chose Polymer? Because it will be “gone”…
Now before anyone react, I would like to say that I really love developing web apps using Polymer. But I also know that my love for it will not last and I know it will be “gone”. Here’s why…
Polymer’s mission is to promote the use and creation of web components: modularized and customized HTML tags that are created by developers for developers. It’s mandate is to #usetheplatform.
Unlike other more popular frameworks like Angular and React, Polymer, for me, is not a framework. It is more of a library, much like jQuery. In essence, Polymer just allows you to create web components easier by sprinkling additional functional sugars to make life easier for developers.
And for my recent projects, I choose to invest my resources and time to learn and develop using Polymer. To give you a brief background of my web developer journey, I started with jQuery in manipulating DOM elements. After that, I discovered Angular around 2013 and switched to it, ditching jQuery. I used MEAN stack as my default stack. At around 2015, I discovered Meteor JS (A full-stack framework) and quickly fell in love with its DDP (Distributed-Data Protocol) without the explicit use of web sockets (or Socket IO). At that time, it uses Blaze as its front-end. So I switched from Angular to Blaze. When Meteor JS switched its front-end framework from Blaze to React JS, I also switched from Blaze to React JS. When I discovered Firebase, I switched to just React JS that is bundled using Webpack. And then Polymer became production ready with the release of 1.0 and the addition of Progressive Web Apps as part of its building process.
Given that, a lot of people I meet asked me why I chose Polymer. Surely, React is more popular. A lot of companies are still looking Angular developers for their legacy systems. Why would I go for something that is not popular and is not being looked at by a lot of companies? Besides, even if Polymer was created by people from Google, why should I prefer it over than Angular, which is also created by people from Google, and has a more established following? And why would Google invest on Polymer if it already has Angular?
In addition to above, a friend of mine told me that Polymer will be gone because of the question above. And I actually agree with him, but not because Google will ditch Polymer over Angular. I agree to the part that Polymer will not “last”. But I am still sticking to it as my default or go to front-end development library.
So why do I say that it will be “gone”? And why would I stick to something that will not “last”?
It is because of this: #UseThePlatform.
Unlike the other web libraries like jQuery and frameworks like Angular and React, Polymer promotes the use of the original framework/platform of the web: the browser.
The browser already has the tools that you need to create dynamic, custom, and modular web components without the need of additional build tools to compile or mirror the DOM tree for DOM manipulation. The power to create is just extend the capabilities of HTMLElement, and you can create your own web components.
In reality, Polymer really just extends HTMLElement, allowing you to extend Polymer.Element that adds a way for us developers to easily observe attribute changes or attach an HTML template to its Shadow DOM.
Another is you can use the original
<link> tags to import web components, may it be extended from Polymer or just plain extension of HTMLElement. The good thing here is the
<link> tag works much like Node JS’ import or require, without the need for bundlers like grunt, gulp, webpack, or browserify. And before we say we need to concatenate JS files for performance, we already have HTTP/2 that allows to do several parallel HTTP requests, removing the overhead of concatenated files that has mechanisms to mimic Node JS’s import/require functions.
All in all, Polymer extends the capabilities of the platform with the sole purpose of helping the developer make reusable web components, but without the additional bloated functions that are not needed.
For me, Polymer just paved the way for me to be reacquainted to the platform and forces me to learn and use the platform. Heck, it is now even easy enough for me to just create a reusable component without Polymer.
And here lies the thing I want to say: Once the browsers have matured enough to the point that you can easily import web components from anywhere, attach HTML templates to its web component’s Shadow DOM, and manipulate its Shadow DOM from changes from its attributes, Polymer will be of no use. The browser API will become so easy for developers that Polymer will be just a redundant and even an inferior set of functions. But the good thing here is, Polymer opened the use of the standard API before it becomes cool.
But our campaign to #UseThePlatform is ultimately not about driving people to use the stuff the Polymer Project builds. It’s about promoting the use of the web platform to deliver the best apps possible, and helping to ensure that web users and developers get everything they deserve from the platform in the future. — Polymer Project’s Role
Polymer, for me, is a gateway to the future of creation of web components using the platform with ease. Once we are in the future, the gateway is already behind us.
This is my reason as to why I am sticking to Polymer. Polymer helps me practice on creating web components using the browser’s existing API. I know one day, I will ditch Polymer. But I know that what I’ve learned from Polymer will become standard. There will be no need for me to re-learn new method names for another library, like I did when I switched from jQuery to Angular to Blaze, and to React. I can create my own opinion on my web components without tying myself up to the heavy opinions of existing frameworks.
Polymer will not stay, and it doesn’t aim to stay. It’s aim is for us to use the platform.
And my take on this is to #UseThePlatform.
Side note: I am creating a series of using what I learned in creating a web app from scratch: from user stories, to designing a living style guide, to developing it using your favorite platform (for my example, I am going to use Polymer and Firebase), and to making it sure it performant and up to standard. Hope to see you there.