DesignPatternsI

DesignPatternsI - CMSC 132: Object-Oriented Programming II...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CMSC 132: Object-Oriented Programming II Design Patterns I Department of Computer Science University of Maryland, College Park
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Design Patterns Descriptions of reusable solutions to common software design problems Captures the experience of experts Rationale for design Tradeoffs Codifies design in reusable form Example Iterator pattern
Background image of page 2
3 Goals Solve common programming challenges Improve reliability of solution Aid rapid software development Useful for real-world applications
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Observations Design patterns are like recipes – generic solutions to expected situations Design patterns are language independent Recognizing when and where to use design Design pattern libraries serve as a glossary of idioms for understanding common, but complex solutions
Background image of page 4
5 Observations (cont.) Many design patterns may need to fit together Design Patterns (by Gamma et al. 1995, a.k.a. Gang of Four, or GOF) list 23 design patterns Around 250 common OO design patterns Design patterns are used throughout the Java Class Libraries
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Documentation Format 1. Motivation or context for pattern 2. Prerequisites for using a pattern 3. Description of program structure 4. 5. Collaborations (interactions) between participants 6. 7. 8. Example codes 9. Known uses 10. Related patterns
Background image of page 6
7 Types of Design Patterns Creational Deal with the best way to create objects Structural Ways to bring together groups of objects Behavioral Ways for objects to communicate & interact
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Creational Patterns 1. Abstract Factory- Creates an instance of several families of classes 2. Builder - Separates object construction from its representation 3. Factory Method - Creates an instance of several derived classes 4. Prototype - A fully initialized instance to be copied or cloned 5. Singleton - A class of which only a single instance can exist
Background image of page 8
9 Structural Patterns 6. Adapter - Match interfaces of different classes 7. Bridge - Separates an object’s interface from its
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 28

DesignPatternsI - CMSC 132: Object-Oriented Programming II...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online