Google Polymer – the future of web application development?
For those who are less familiar with Web Components, the standards include four key features:
- HTML Templates - The 'template' element, which allows pages to contain inert areas of DOM inside
- HTML Imports – Methods for importing HTML documents into other documents
- Custom Elements - APIs which enable building new HTML elements
Google’s Polymer project builds upon vanilla Web Components, adding new features such as improved custom element creation and repeatable templates. All of these features are directly built into the browser, and so are supported by (almost) all browsers. In addition to this, Polymer includes a large number of pre-built elements, which can kick start the development process.
Sounds great, right? Well, not everyone is in agreement. Facebook’s React library has exploded in popularity; it performs a similar role to Polymer elements, but supports code-sharing between front and back end environments, and has significant speed advantages over similar technologies. These speed advantages are a prominent argument for Reacts superiority.
So, what should you use when building a web application? React, Polymer, both together or something else altogether? It really depends on your implementation. More importantly, you should take care not to conflate React and Web Components. At a basic level, they are different things – Web Components are designed to allow encapsulation of reusable components, and React is excellent and keeping the DOM up to date in line with changes in your data. Given this, you should choose a tool based on what best meets your app functionality. You could even utilise both together; web Components behave as native HTML elements, and as such can be used in React applications as any other element would be.
The Web Components and Polymer specification is constantly maturing, though. And for a large number of potential use cases, the simplicity and modularity that Polymer affords is too good to pass up on. Developers wouldn’t need to worry about cross-browser interoperability as the library is based on a universal standard, and applications could be rapidly prototyped and developed due to the reusability of elements. As time goes on and in-built browser features become fuller and more developed, Polymer will certainly become more proliferate across the web, and change the way we build modern web applications.