Darren Hobbs: Third party code considered harmful: “A useful approach is to wrap all access to 3rd party code yourself, thus giving you a single point of contact between your system’s code and the external library. This wrapper is also a useful place to put any extension functionality that your system needs.”
Sorry, but I don’t buy this. For one thing, you have so much, good quality, open source components out there that most systems are probably comprised of 20% custom code vs. 80% 3rd party code. Assuming that the components you’ve chosen to adopt have reasonable API’s (otherwise you’d better not use them in the first place), what does it buy you wrapping it all in another set of abstractions, whose APIs you have to design and implement yourself?
Darren mentions Log4J as something that should be wrapped. Apart from the fact that there are already wrappers for logging libraries available, like UGLI, Log4J’s API is as simple as you can get. If you decide to wrap it, you’ll have to do a one-to-one implementation, which basically will just add overhead to your applications’ logging activity.
I say: If the APIs of the 3rd party code are at the right level of abstraction, use them right away and don’t bother encapsulating them. Only if they are too low-level, wrap them in a simplified, higher-level interface.
I agree with you completely.
Besides, we can write Adapters in the future, if we somehow change the library…
Another besides, why couple your application to some proprietary interface that you invented? For example, in the PHP world, anybody using PEAR DB will be dead easy to migrate to other DB libraries such as MDB and ADODB (maybe Creole as well), since they already have adapters for PEAR DB.
That won’t be situation had you wrapped PEAR DB in a proprietary interface.
BTW, this is a very nice blog template!!!
I wish I have something so beautiful as this design….. ugh ugh… perhaps I should go to WPThemes