Boundaries
Using Third-Party Code
| public class Sensors {
private Map sensors = new HashMap();
public Sensor getById(String id) {
return (Sensor) sensors.get(id);
}
//snip
}
|
The interface at the boundary ( Map ) is hidden. It is able to evolve with very little impact on the rest of the application. The use of generics is no longer a big issue because the casting and type management is handled inside the Sensors class.
Hide Map Objects.
Exploring and Learning Boundaries
Write Test cases on Third Party Jars.
Learning log4j
Use Log4J
Learning Tests Are Better Than Free
-> Write Test Scenarios on API’s
Using Code That Does Not Yet Exist
Don’t depend on Third Party API’s use adapter based classes
Clean Boundaries
We should avoid letting too much of our code know about the third-party particulars.
It’s better to depend on something you control than on something you don’t control, lest it end up controlling you.
We may wrap them as we did with Map , or we may use an A DAPTER to convert from our perfect interface to the provided interface.