Live data from Hacker News

An Introduction to Polymer - A Web Component Library

wearenorthern.com

11–20 of 56 posts

Re: An Introduction to Polymer - A Web Component Library

#11
post #10

Earlier quoted context omitted.

I think it's mostly due to browser support and developer awareness of Web Components. Chrome has native support (of course) for the four main technologies needed for Web Components, but other browsers are starting to catch on. In the meantime you need a few Polyfills to get full support, which is not ideal. The support graph is starting to look a lot better, though: https://jonrimmer.github.io/are-we-componentized-ye…

Sure, but look at it this way - with other solutions like lets say React their virtual dom is your "polyfill". Even with polyfills polymer is MUCH smaller than react core ;-) I don't see it as a problem as I've created elements that worked in IE10+ with it.

Oh I definitely agree with you. We've worked on projects with Angular 1/2, React/Redux, and Polymer and Polymer is, for me personally at least, the nicest to work with. I have grown to really like TypeScript since working in React land on recent projects but I'm excited because Polymer 2.0 will be [easily] TS compatible. Best of both worlds, I think.

Re: An Introduction to Polymer - A Web Component Library

#12
post #5

I've been using Polymer since 0.5 for a number of personal projects as well as professional. I have to say it's been a pleasure to use - coming from Angular 1.0. I like it has a very low barrier to entry, having only one real concept; Web Components. Polymer gives you Data Binding and a few nice things on top of that, but for the most part, you're writing things fairly vanilla. It's definitely not without it's proble…

Yeah that's a nice/bad thing about Polymer: how vanilla it is. 2.0 is even more vanilla. But the mantra is to #UseThePlatform and so that's what they do. The platform is becoming less burdensome than it used to be. Because of how isolated Web Components are it keeps things simple, particularly when you're dealing with DOM. Components tend to keep to themselves and interact with each other via your agreed-upon interfaces.

I also noticed the verboseness. On the projects I worked on at Google I had just made a Behavior of logic utilities that I added to components that needed that kind of behavior. So they could inherit some utilities like `_equalTo`. It wasn't ideal but it did stop the need to define essentially the same functions across multiple components.

Re: An Introduction to Polymer - A Web Component Library

#13
post #6

This framework seems very interesting, I wonder why it didn't become popular outside of Google

For a while there in the .5 to .8 days performance was pretty iffy, and the documentation was lacking (as was expected for a library pre-1.0), but it seemed that was when a lot of bloggers picked it up, compared it to react/angular, then dropped it.

And back then when I was trying it out there wasn't any easy way to integrate webpack (or something like it) which made it difficult as I've gotten very used to a good bundler/compiler.

Re: An Introduction to Polymer - A Web Component Library

#14
I found Polymer to be very easy to pickup coming from Angular 1 & 2. The only friction I experienced was difficulty integrating TypeScript.

Given how Polymer components are typically written with the JavaScript included with the HTML file of the component this was not really an easy option for a beginner.

However using tools like polymer-build with gulp you can still get TypeScript support. In the upcoming Polymer 2.0 release TypeScript typings are going to be included with the library!

Re: An Introduction to Polymer - A Web Component Library

#16
post #6

This framework seems very interesting, I wonder why it didn't become popular outside of Google

For a while there in the .5 to .8 days performance was pretty iffy, and the documentation was lacking (as was expected for a library pre-1.0), but it seemed that was when a lot of bloggers picked it up, compared it to react/angular, then dropped it. And back then when I was trying it out there wasn't any easy way to integrate webpack (or something like it) which made it difficult as I've gotten very used to a good bu…

Yeah... I remember those days. The first projects I built with it were 0.5. The migration to 0.8 was... painful. But given the huge performance improvements it was worth it.

As you said, you kinda just have to expect a little pain pre-1.0. But the time investment in learning and using it has been worth it in my opinion.

Re: An Introduction to Polymer - A Web Component Library

#17
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 reason Google doesn't use it widely.

So, it seems great at first because it does so much, but you realize you want some minor customization and you end up spending all your time trying to hack around it when you could have just written from scratch in the same time (for example, I wanted an iron-collapse to move upwards, and had to do some crazy CSS hackery to get that to work).

That being said, if you restrict Polymer with team style guide, it can be incredibly powerful for code reuse. My team has a style guide that looks like this: only use paper components if absolutely necessary, never use {{}} only use one-way data binding, and attach strongly typed javascript to the Polymer component classes with Closure or Typescript.

(I work at Google, was tech lead for the image search frontend team for 4 years, and now work on Tensorboard in Tensorflow which is Typescript + Polymer)

Re: An Introduction to Polymer - A Web Component Library

#18

I found Polymer to be very easy to pickup coming from Angular 1 & 2. The only friction I experienced was difficulty integrating TypeScript. Given how Polymer components are typically written with the JavaScript included with the HTML file of the component this was not really an easy option for a beginner. However using tools like polymer-build with gulp you can still get TypeScript support. In the upcoming Polymer 2.…

Yeah... I used it initially with no TS experience, but coming back to it later I do find myself missing TS. But yeah you can use polymer-build to split the script block out of the HTML file, run it through TSC, then insert it back into the file as JS.

Re: An Introduction to Polymer - A Web Component Library

#19
post #5

I've been using Polymer since 0.5 for a number of personal projects as well as professional. I have to say it's been a pleasure to use - coming from Angular 1.0. I like it has a very low barrier to entry, having only one real concept; Web Components. Polymer gives you Data Binding and a few nice things on top of that, but for the most part, you're writing things fairly vanilla. It's definitely not without it's proble…

I first looked at Polymer quite awhile ago, maybe over a year. I guess I kind of thought it was a stepping stone to Angular 2 which uses a component model, like most of the other latest frameworks. Or that maybe it was some kind of special one-off project at Google. Once I stumbled onto Angular Material I sort of forgot about Polymer because I didn't have a dedicated UI guy, and there was a nice cache of controls to work with. I'd consider looking into Polymer again if I see a some good demos in the PolymerElements, and if it seems like there's a roadmap with an active community. I'm always impressed with Google Play Music.

Re: An Introduction to Polymer - A Web Component Library

#20

I found Polymer to be very easy to pickup coming from Angular 1 & 2. The only friction I experienced was difficulty integrating TypeScript. Given how Polymer components are typically written with the JavaScript included with the HTML file of the component this was not really an easy option for a beginner. However using tools like polymer-build with gulp you can still get TypeScript support. In the upcoming Polymer 2.…

You can do something simple like this: https://github.com/tensorflow/tensorflow/blob/master/tensorf...

And a simple implementation: https://github.com/tensorflow/tensorflow/blob/master/tensorf...

Post reply on HN