[Design Pattern] Vendor Wrapper Pattern

The Vendor Wrapper Pattern is about isolating a third-party (vendor) library behind your own abstraction. Instead of scattering vendor-specific API calls throughout your app, you encapsulate them in a wrapper. This makes it easier to swap or update the vendor library later, and it keeps your codebase cleaner.

 

For example if you use ForntAwesome library, you might directly use it through your whole app, it seems to be easy, but when it comes to we need to support other icon library or custom icons then you need to find & replace code in you whole applciation which is not ideal.

 

The idea is never let 3rd party library directly be used inside your application. 

posted @ 2025-03-03 15:33  Zhentiw  阅读(18)  评论(0)    收藏  举报