1 / 11

Patterns – Day 8

Patterns – Day 8. Adapter continued Facade Reminders: Faculty candidate talk Friday 4:20 PM O-267. Brian Postow: Games and Complexity Theory No class tomorrow. Questions, comments, rebuttals, etc.? Why do Software patterns people like Christopher Alexander?. Unforseen Adaptation.

Download Presentation

Patterns – Day 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Patterns – Day 8 Adapter continued Facade Reminders: Faculty candidate talk Friday 4:20 PM O-267. Brian Postow: Games and Complexity Theory No class tomorrow.

  2. Questions, comments, rebuttals, etc.?Why do Software patterns people like Christopher Alexander?

  3. Unforseen Adaptation • Adaptation is easy when the client plans for it. • In Metsker’s example, we have a situation where we can redirect “standard” output to a PrintStream that is different than System.out. • What if we wish to redirect to a JTextArea? CHALLENGE 3.4You'd like to narrow the responsibility of the MessageAdapter class with a specification of the calls the client might make to it. What request should you make? CHALLENGE 3.3Write down a comment explaining what might go wrong with this approach to adaptation.

  4. Challenges 3.5 and 3.6 • Provide an argument that MessageAdapter, as it appears in Figure 3.8, is or is not an example of ADAPTER. • Provide an argument that you are applying the ADAPTER pattern when you use the MouseAdapter class. Alternatively, argue that this is not the case.

  5. Two-way adapter • The adapter, in addition to providing the interface that the client requests, also provides the interface of the adaptee. • Then the adapter can be used by someone who understands either interface. • A class adapter is automatically two-way, provided that no adaptee methods are overridden in a way that is inconsistent.

  6. Closely related patterns (GoF) • Bridge: separate an interface from its implementation so they can be varied independently. • Decorator: Enhance an object without changing its interface. • Proxy: defines a representative or surrogate for another object without changing its interface.

  7. Other Adapter Issues • Pluggable adapters • Maybe some dayOther issues from anyone else in the class

  8. Façade Pattern • What is it? What is its purpose? • Purpose: To provide a simple interface to services from a complex subsystem.

  9. From wikipedia • There may be a large set of objects with broad uses that are used in conjunction to perform a few functions for client objects. • The façade pattern provides a simplified interface to achieve only those functions needed without having to reference many different, complicated interfaces. • The result is a simple feel to a complicated process.

  10. GOF Example • A software system has a compiler as a subsystem. • The compiler has many components. • Clients don’t care to interact with individual components. • The Compiler façade provides the needed functionality. • Picture on next slide.

  11. GoF Compiler Example

More Related