Recognizing Adapter
Adapters are healthier when a Java interface narrows the responsibility that the adapter class bears to the client. The JTable class, for example, specifies the exact interface it needs with the TableModel interface. By comparison, the MessageAdapter class has no contract with the application it plugs into that the application won't expand its use of a PrintStream object's behavior. In fact, although the word adapter appears in the name of the MessageAdapter class, you might question whether MessageAdapter is an instance of the ADAPTER pattern.
|
In answering Challenge 2.4, you explained the value of the ...
Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.