Wednesday, November 26, 2008

Wrapping 3rd Party Code Is Clean Code Crafty

The Clean Code book by Robert C. Martin has great points about system boundaries. In chapter 8 titled Boundaries and in the section called Using Third-Party Code, the book shares why and how to wrap 3rd party code.

Points For Why To Wrap Third Party Code (page 115):
  1. The third party code can evolve
  2. Your wrapper's interface can be made to precisely suit your application's needs
Like the book says on page 115, "If you use a boundary interface like Map, keep it inside the class, or close family of classes, where it is used."

That's huge! I also like the "Sensors" class example which has a method that will give you a "Sensor" class. Sensors giving you a Sensor, implies a naming rule-of-thumb which I also like.

1 comment:

  1. This goes for Grails too. I think that service plugins should also be wrapped.

    ReplyDelete