6 Design Patterns Java Structural m6 Slides
6 Design Patterns Java Structural m6 Slides
Bryan Hansen
twitter: bh5k | http://www.linkedin.com/in/hansenbryan
Concepts
▪ Make an API easier to use
▪ Reduce dependencies on outside code
▪ Simplify the interface or client usage
▪ Usually a refactoring pattern
▪ Examples:
▪ java.net.URL
▪ javax.faces.context.FacesContext
Design
String inputLine;
Complex Client
Client, Facade, JDBC
Simplified Client Code
Pitfalls
▪ Typically used to clean up code
▪ Should think about API design
▪ Flat problem/structure
▪ The “Singleton” of Structural Pattern
Contrast
Facade Adapter
▪ Simplifies Interface ▪ Also a refactoring pattern
▪ Works with composites ▪ Modifies behavior (adds)
▪ Cleaner API ▪ Provides a different interface
▪ Single Object
Facade Summary