0

Edit -- I have no limited my question down to a more specific question.

Is there an argument not to wrap a 3rd party user input validation library?

To me there are a few strong arguments to do so.

1) By writing a wrapper it makes it easy for me to extend or inject additional implementation into the library.

2) If I change the dependency, say I have found a better input validation library, I can swap them out relatively painlessly, I just need to update my wrapper.

3) If the dependency updates it is easy to migrate.

4) It makes testing easier

1 Answers1

1

Do it when you’re done experimenting with your needs.

It’s easy to become enamored with a new toy and buy into it’s way of doing things. That’s fine when you’re learning what it’s good for. But eventually you should get to a point where you can see what real needs you have that this thing can provide.

Formalize that relationship in some way that makes clear what needs to be replaced if the 3rd party software has to be removed. That can be done with an interface, an adapter, or a wrapper.

The advantage is this will clearly show future developers that rather than needing to recreate an entire library they only need these few features.

Then they can either implement those few features themselves or they can wire the wrapper up to some other 3rd party library.

candied_orange
  • 119,268