Hacker News new | ask | show | jobs
by csense 4736 days ago
I like the blog post format better than a Google Hangout. When there's a conversation, unless (or perhaps even if) it's heavily moderated, things get lost in the noise.

I was really confused about the word "polyfill," which the author used without explanation. Since I've written code to render filled polygons before (concavity is a fun corner case), I assumed this was what it was referring to, and I was really confused about how that's even remotely relevant. Wikipedia finally straightened me out [1].

[1] http://en.wikipedia.org/wiki/Polyfill

3 comments

> Since I've written code to render filled polygons before (concavity is a fun corner case), I assumed this was what it was referring to,

I was told it is part of the web startup, full-stack hipster vocabulary, because "shim" is just not cool enough and a new word was needed.

When did "polyfill" replace "shim," I wonder?
http://remysharp.com/2010/10/08/what-is-a-polyfill/

"Shim, to me, meant a piece of code that you could add that would fix some functionality, but it would most often have it’s own API. I wanted something you could drop in and it would silently work (remember the old shim.gif? that required you actually inserted the image to fix empty td cells – I wanted something that did that for me automatically).

I knew what I was after wasn’t progressive enhancement because the baseline that I was working to required JavaScript and the latest technology. So that existing term didn’t work for me."

I think of "polyfill" as filling many different holes to make it so you can forget about the different cases (browser compatabilities in this case). A polyfill pours concrete over a bumpy surface and makes its smooth. "Shim", to me, is essentially synonymous with monkey patch, i.e. something you shove in there to make something work- shoving a folded napkin under a table leg to make it flat is shimmy to me.
> I think of "polyfill" as filling many different holes to make it so you can forget about the different cases (browser compatabilities in this case). A polyfill pours concrete over a bumpy surface and makes its smooth.

Kind of like a façade then[1]? A shim would probably be synonymous with an (very informal) adapter.

[1] http://en.wikipedia.org/wiki/Facade_pattern

[2] http://en.wikipedia.org/wiki/Adapter_pattern

I've always taken it to be that it's a polyfill if it's somewhat elegant, or where a newer technology encompasess a superset of an older one and a shiv if it's somewhat hackish or where older technologies are made to stand in for newer ones. I am probably wrong.
Thanks for feedback, I added link to the wikipedia article.