I’ve been listening to Jake and Paul‘s new HTTP203 audio podcast 1 and in the middle of it, a weird thing happened. They were talking about moment.js, an excellent date parsing and formatting library for JS, and pointed out Intl, “the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting”. And that seems great. But there was a sort of air, an idea, that I picked up from them when listening with which I disagreed. Specifically, they seemed pretty keen on Intl because it’s part of the platform, rather than being a library. Now, I might be making this up, and they may be horrified that I misunderstood them, in which case I apologise. I may be accusing them of this unfairly because they work on a specific browser and therefore I see them as liking the platform more than they maybe should. But here’s the thing.
The platform is just another library.
That something’s available “in the platform”, for me, when developing, is no major benefit. I pretty much prefer “use this one library, which works everywhere”, to “use this platform API, which works some places, and polyfill it for other places”. I admit that I rather expect that the library I choose will itself use the underlying platform API if it’s available, and I prefer in general to use libraries which polyfill platform APIs rather than provide their own distinct APIs, but that something is available “in the platform” is no major benefit in my eyes. Sure, there are performance benefits to having the browser do it, and greater performance benefits in not having to load a library to do it (and I am by preference a Vanilla JS coder) but in practice there are hardly any APIs that I’m learning about now which are actually available wherever I want them. “It works everywhere except on iPhones” is about the same as “it doesn’t work anywhere”. “It works in Chrome and others will catch up soon” is about the same as “it doesn’t work anywhere”. “It works everywhere except Internet Explorer” is… well, I’m impure and horrid, so sometimes I just give in and say “fine, no IE support” and feel guilty about it, but basically it feels about the same as “it doesn’t work anywhere”. Now, obviously browsers need to build this stuff so that it’s everywhere, and some browser has to be first. But the idea that “this is available in a library, and that’s not great” but “this is available in the platform and is therefore better”… doesn’t actually seem to play out as better for me.
Maybe I’m alone in this. Maybe I’m completely mischaracterising Jake and Paul and if so, sorry chaps, don’t burn my house down.
- not the same as the videos! Loads more hot Paul and Jake action! nice one, chaps! ↩