Live data from Hacker News

An Introduction to Polymer - A Web Component Library

wearenorthern.com

31–40 of 56 posts

Re: An Introduction to Polymer - A Web Component Library

#31

I've used Polymer for about a year now, and it's not my favorite. Two way data binding yields bad design, and stack traces are incredibly opaque (they go through polymer guts). That means debugging is an absolute nightmare (I come from strongly typed closure javascript, so this was a punch in the face). If your HTML has problems, the browser won't yell at you; debugging tools are just plainly lacking. There's a reaso…

Two-way data-binding is definitely still controversial and/or can be hard to use in some cases, but its also very easy to use in others, and we've found it help people get started very quickly. I think it's important to know that it's an _option_ and has potential downsides. I'm not sure we communicate that enough. We do have large customers who follow a mostly-one-way pattern.

Speaking of, Google does use Polymer widely. All of YouTube is converting to Polymer right now, plus quite a large number of "smaller" projects like Play Music, Chrome, Translate, Chromecast, TensorFlow :), etc.

Re: An Introduction to Polymer - A Web Component Library

#32

Earlier quoted context omitted.

No, we used Polymer in an Angular 2 app. Even though Material 2 is in alpha, the components we need just work better than in Polymer; They have fewer quirks, fewer bugs, and fit better into the Angular 2 ecosystem.

Ah, I understand now. I've done some work integrating Angular 2 and Polymer and there are pitfalls. I've come across this repo in the past for integrating the two but I personally haven't used it yet. https://github.com/vaadin/angular2-polymer

The integration into Angular 2 was actually fairly seamless once I added vulcanize into the build process.

Re: An Introduction to Polymer - A Web Component Library

#34
I work with Polymer quite a lot, it is my favorite platform both professionally and for personal projects.

What I like about it most is that it lets me program for the web like I would normally code for software projects without UI. You can completely deconstruct your application into components and encapsulate logic and responsibility, giving you all the tools you need for great architecture. I am traditionally more of a backend guy, but Polymer makes building frontend projects fun for me, because the most interesting thing about programming to me is software architecture, creating powerful abstractions and designing interaction and APIs.

I have been working with Polymer since the first beta release (before 0.1) and completed multiple projects, both at work and during my free time. It has not been without it's problems. I have to say that it takes quite a while before it really 'clicked', because you have to learn quite a few patterns to make things work. If you started early on, it was very unpolished (despite that, we have a fairly large Polymer 0.5 application running in production, and it's still chugging along nicely), and the upgrade process is extremely painful (hence aforementioned application still running 0.5). It can also be dangerous, because if you don't know what you're doing, it is easy to end up with some frankenstein contraption that performs terribly, and is a horror to maintain. My advice to anyone looking to get into Polymer is to get advice from more seasoned developers, the Slack channel[1] is a great resource for that. Learn from existing projects and applications as much as possible to see how they solve the issues you will run into, and get a feeling for how the general architectural patterns work.

The good part is that all the techniques you learn are almost directly applicable to the future native Web Platform, as one of the core concepts of Polymer is that it tries to emulate what the future Web Platform will look like, and allow you to use that platform today. Quite a large part of the platform is already natively supported on most of the evergreen browsers, and I find that I use less and less Polymer code these days and use more and more plain native code. One day we may no longer use Polymer at all, but your newly learned skills will still apply.

A recent side project of mine has been an exploration of what future Web Applications might look like, and to test what is possible on the platform today. I built it completely from scratch, with no libraries or dependencies other than Polymer:

- https://overwebs.ruph.in (warning: sound and relatively high bandwidth. Works best in Chrome, other browsers untested)

[1] https://polymer-slack.herokuapp.com/

Re: An Introduction to Polymer - A Web Component Library

#35

I've used Polymer for about a year now, and it's not my favorite. Two way data binding yields bad design, and stack traces are incredibly opaque (they go through polymer guts). That means debugging is an absolute nightmare (I come from strongly typed closure javascript, so this was a punch in the face). If your HTML has problems, the browser won't yell at you; debugging tools are just plainly lacking. There's a reaso…

Two-way data binding is indeed a bad pattern, but the issue is that there is only syntax to bind data down, with [[]]. Sometimes it makes sense to get data from a child, and {{}} can be convenient, as long as you follow the rule that you only use it to retrieve data, and never try to set it. Unfortunately there is no syntax for such a binding, but as long as you follow the style that {{}} is only used as a one-way binding (but in the opposite direction compared to [[]]) it works just fine.

I usually create elements that are responsible for managing a certain type of data, and expose is through properties. This data can then be used anywhere in the application, by using that element and observing with {{}}. I really like that pattern, it feels like a traditional model object that exposes a nice API to consumers.

I definitely agree that you need a pretty strict style guide, it's too easy to go crazy and just stitch things together, and end up with an entangled mess.

Re: An Introduction to Polymer - A Web Component Library

#36
A few months ago I started working on a large web application that is being implemented with Polymer. A few take a ways that are top of mind:

1) Very easy to learn, but it has no idiomatic way to write large applications; it is not a framework like Angular or Ember.js. What the best way is to write large, maintainable, applications with Polymer is still open IMHO.

A potentially useful way to structure large Polymer based applications is to combine Polymer and Redux, separating presentation code from state/business logic.

2) No idiomatic way to do dependency injection. In Polymer even services are stated declaratively in HTML (e.g. ``). Because of this, there is no natural way to replace my-service with, for instance, a stubbed version for testing purposes. There are some solutions, but they are somewhat laborious [1].

3) Build process still buggy. We encountered multiple issues with the polymer-vulcanize library.

Looking back at the ease with which I started writing application code using Polymer I foresee a great future for this library, especially for smaller applications. We need to learn more best practices in order to use Polymer to create large maintainable applications.

[1] “Polymer - Dependency Injection with Custom Elements by Justin Fagnani” https://www.youtube.com/watch?v=6o5zaKHedTE

Re: An Introduction to Polymer - A Web Component Library

#39

I've used Polymer for about a year now, and it's not my favorite. Two way data binding yields bad design, and stack traces are incredibly opaque (they go through polymer guts). That means debugging is an absolute nightmare (I come from strongly typed closure javascript, so this was a punch in the face). If your HTML has problems, the browser won't yell at you; debugging tools are just plainly lacking. There's a reaso…

Also, using the two way binding is optional. We've been using Polymer for about the same time with Redux and a unidirectional data flow. I'm very happy with it.

Re: An Introduction to Polymer - A Web Component Library

#40

A few months ago I started working on a large web application that is being implemented with Polymer. A few take a ways that are top of mind: 1) Very easy to learn, but it has no idiomatic way to write large applications; it is not a framework like Angular or Ember.js. What the best way is to write large, maintainable, applications with Polymer is still open IMHO. A potentially useful way to structure large Polymer b…

Exactly this. I think some of the tutorials and introductions were a bit overwhelming with their huge dependency lists (see Polymer catalogue), and a lot of opinionated ideas about how to form a Polymer application. Core Polymer is so easy to pick up and flexible. It's been a joy to work with. Well ok, there's a few gotchas, and the build process if you're mostly rolling your own can be a real pain. But once you find your feet with it, everything works pretty well.
Post reply on HN