Nói cách khác, tất cả các Java Beans đã cùng một giao diện được sử dụng bởi các chương trình xây dựng, và bạn có thể thay thế bất kỳ Bean cho bất kỳ khác và vẫn còn sửa đổi các thuộc tính của nó bằng cách sử dụng cùng một giao diện thuận tiện. | In other words all Java Beans have the same interface used by the builder program and you can substitute any Bean for any other and still manipulate its properties using the same convenient interface. The actual program you construct uses these classes in a conventional way each having its own rather different methods. However from the builder s point of view they all appear to be the same. Consequences of the Bridge Pattern Using the Bridge pattern has the following consequences 1. The Bridge pattern is intended to keep the interface to your client program constant while allowing you to change the actual kind of class that you display or use. This can help you to avoid recompiling a complicated set of user interface modules and require only that you recompile the bridge itself and the actual end display class. 2. You can extend the implementation class and the Bridge class separately and usually without their having much interaction with each other. 3. You can hide implementation details from the client program much more easily. lightbulb Thought Question 1. In plotting a stock s performance you usually display the price and price-earnings ratio over time while in plotting a mutual fund you usually show the price and the earnings per quarter. Suggest how you can use a Bridge pattern to do both. Programs on the CD-ROM 85 Program Description Bridge BasicBridge ava Displays a list box and a table of unsorted product names Bridge SortBridge ava Displays a list box and a table of sorted product names. Bridge T reeBridge ava Displays a tree list and a table of sorted product names and amounts. 86 Chapter 11. The Composite Pattern Programmers often develop systems in which a component may be an individual object or may represent a collection of objects. The Composite pattern is designed to accommodate both cases. You can use it to build part-whole hierarchies or to construct data representations of trees. In summary a