DEV Community

Discussion on: Should we wrap critical built-in modules?

Collapse
orkon profile image
Alex Rudenko

I have heard a lot of troubling things about Angular: that the API is not very stable and developers change it quite often...

I usually use request (backend) or fetch API (client) for handling HTTP requests which I know are quite stable (the first one is quite old and the second one is a standard). Nevertheless, I also have a wrapper :-)

One approach to deciding if you should write a wrapper is to see if you can improve or simplify the API of the original module. Many modules have way too many options, and you might not need all of that. So it's good to write a simple wrapper with much smaller API surface and use it in the application code. I think if you just wrap every function of a complex module you won't gain much because it will be still a lot of work if you decide to migrate to an alternative.

Collapse
ben profile image
Ben Halpern

I agree. The JS community might seem to think of this as the price of doing business sometimes. Code against the possibility of overhaul or get out. The scenario is tricky, but with the recent history of JS and browsers I wouldn't bank on a ton of stability any time soon.

Tangential, but speaking of JS instability, this article is interesting: theverge.com/2018/1/4/16805216/goo...

Collapse
nektro profile image
Meghan (she/her)

On your tangent:

I saw the article earlier and think it is very misleading. While I do think they bring up some valid points. I wholeheartedly disagree Chrome is the new IE. The biggest problem I see that the article talks about is the rise in "Chrome only" sites. And while it is an issue, it's not born from a lack of features in Chrome or Google abandoning standards and forcing web developers to deal with quirks purely for market share.

These "Chrome only" sites are born out of (for one reason or another) other browsers, including Firefox and Edge, being behind in the implementation process. I was working on an app just the other day where I discovered it didn't work in Firefox because it still does not support JS Modules and one feature didn't work in Edge for lack of support of HTMLCanvasElement.toBlob and ImageBitmap.

I would be much more prone to say Safari is the "new IE"

Thread Thread
ben profile image
Ben Halpern

I agree with the sentiment in general. Google is a much better player in the browser space than some others, especially Apple, but I think they still deserve scrutiny with a direction that makes Google into the web in a way. It's no one thing but it's an ongoing thing to pay attention to. AMP, PWA, certain other Chrome APIs all create scenarios that blur the line in a way. It's not necessarily great for developers all the time. Microsoft and AOL before them put out services that hurt the web in ways reflective of what Google's doing.

Google is simultaneously the best thing for the web and a potential thorn and danger at the same time. Food for thought is all.

Thread Thread
nektro profile image
Meghan (she/her)

With how much investment they have in the web, it only makes sense they would also be the bearers of so much great web content as well. As time moves on I can only hope that they are able to properly balance the needs of the Web and themselves.

So far I think they've done a good job but it hasn't been a perfect road even though I do commend them on all the work they do on writing standards and developer education.