DEV Community

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

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Ideally you would separate your code from third-party modules with an abstraction layer. Never expose the entire library, expose only the pieces you want, wrapped in a way that makes sense for your code. This shields against API instability as well as vendor lock-in.

Practically though, ideals are more like lofty visions than achievable goals. You strive for this, but you're going to take shortcuts. It's the conflict I talk about in this article.

Business priorities must play a role in your software design. Paying a hefty future cost is often more attractive than paying an upfront cost.

I'm also not really scared of difficult refactoring, or other code surgery. Sure, two weeks is a lot of time, but is it really a problem? This is a critical piece of code, who knows how long it took you to get this in place the first time.