Week 1 Flashcards
Name this: formalized best practices can be used to solve
common problems when designing an application
or system. General & reusable.
Patterns
T/F - Patterns are a finished design that can be transformed into code
False
Patterns are a description or recipe for how to _____ a _______
solve a problem
What are 5 advantages of patterns?
- General, not tied to a specific problem
- Flexible
- Faster (proven, well understood)
- Easier to read/understand the code if you know the pattern
- Fosters communication among programmers (they don’t have to include a diagram if you both know)
What are 3 disadvantages of patterns?
- They have to be programmed fresh for each application
- Can complicate designs and impact performance
- Must know when to use them (and how)
Indirection, when used in patterns results in both an advantage and disadvantage
Indirection is used to be flexible, but can complicate designs and impact performance
What are the 3 groups of design patterns?
Creative, Structural, Behavioural
What is the focus of the creative DP?
Class instantiation
What is the focus of the structural DP?
Class composition
What is the focus of the behavioural dp?
Communication among objects
Name this creative DP: Restricts object creation for a class to only one instance.
Singleton
Name this creative DP: constructs complex objects by separating construction and
representation.
Builder
Name this creative DP: Creates objects without specifying the exact class to create.
Factory
Name this Structural DP: Match interfaces of different classes
Adapter
Name this Behavioural DP: Register with an object and get notified of changes
Observer