by rtpg · 9y ago · 0 comments
Wrap _all_ third party library calls. This lets you reduce the scope of these calls to "approved" ways and make much stronger assertions about who's doing what in your code.
This gets super useful the further down the line you get to adding really complex features. Being able to isolate all the places where certain objects get created to add a permission check is nice.
It also makes testing easier because you have some nice entry points to mock.
Raw usage of things like an ORM can let you get through a prototype super quickly, but makes editing the application later on quite hard.
It's a shame it's really really tedious though!
Other times, no, it doesn't seem worth it. And I don't do it for every single external library I use.
Although it does tend to end up being most of them - which seems to be a consequence of the way I've generally done n-tier application design at work. I'm not always a fan of this architecture, but sometimes it does fall out nicely.
I had a senior developer suggest I wrap jQuery one time.
C# is a very, very different matter, and that's the perspective I was initially commenting from.