Exactly, I’m with Ahmed on this one. I have this object that is from library A, and I want to use it in my own library B. I want to be able to change my mind and use A2 at some point without having to rewrite a lot of code, so I encapsulate object A from library A in a class.
To do this, I setup a facade where the rest of my library can request the functionality from library A’s objects, but they will only get it through my own facade’s objects that encapsulates the objects from library A.
Similarly, anyone using my library B will know nothing of my library A, will not have a dependency on it, and I can change out library A to library A+ later needing to change very little.
Finally, I setup some nice tests against my facade to make sure that keeps doing what it needs to do.