Shared Flashcard Set

Details

Head First Design Patterns: Chapter 1 - 3
Questions about the Strategy, Observer and Decorator Patterns.
11
Computer Science
Professional
05/19/2009

Additional Computer Science Flashcards

 


 

Cards

Term

Design Principle

 

Identify the aspects of your application that ____ and separate them from what stays the ____.

Definition

Design Principle

 

Identify the aspects of your application that vary and separate them from what stays the same.

 

(Page 9)

Term

Design Principle

 

Program to an _________,

not an ______________.

Definition

Design Principle

 

Program to an interface,

not an implementation.

 

(Page 11)

Term

Design Principle

 

Favor ___________ over ___________.

Definition

Design Principle

 

Favor composition over inheritance.

 

(Page 23)

Term

This pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. This pattern lets the algorithm vary independently from clients that use it.

 

What is this design pattern's name?

Definition

The Strategy Pattern

 

(Page 24)

Term

This pattern desines a one-to-many dependence between objects so that when one object changes state, all of its dependents are notified and updated automatically.

 

What is this design pattern's name?

Definition

The Observer Pattern

 

(Page 51)

Term

Design Principle

 

Strive for _______ coupled designs between objects that interact.

Definition

Design Principle

 

Strive for loosely coupled designs between objects that interact.

 

(Page 53)

Term
The Observer Pattern is a combination of publishers and ___________.
Definition

The Observer Pattern is a combination of publishers and subscribers.

 

(Page 45)

Term

Design Principle

 

Classes should be open for _________, but closed for ____________.

Definition

Design Principle

 

Classes should be open for extension, but closed for modification.

 

(Page 86)

Term

This pattern attaches additional responsibilities to an object dynamically. This pattern provides a flexible alternative to subclassing for extending functionality.

 

What is the name of this design pattern?

Definition

The Decorator Pattern

 

(Page 91)

Term
Decorators have the same _________ as the objects they decorate.
Definition

Decorators have the same supertype as the objects they decorate.

 

(Page 90)

Term
Decorators and ________ components don't mix.
Definition

Decorators and concrete components don't mix.

 

"If you have code that relies on the concrete component's type, decorators will break that code."

 

(Page 99)

Supporting users have an ad free experience!