Design Patterns Flashcards

1
Q

What is a design pattern

A

Description of a problem that reoccurs and an outline of an approach to solving a problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a framework

A

partially completed design that can be extended to solve a problem in a domain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an idiom

A

A small language specific pattern or technique.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Use of Init in constructors

A
  • If many constructors, make each one call a private function init()
  • Initialize in one place despite multiple constructors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Essential Elements of Design Patterns

A

Vocabulary of patterns, need to know where to apply patterns, how to represent components and conditions to be met before using. Use Design Elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Design Elements:

A

Relations, Responsibilities, Collaborations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Patterns are;

A

name and description of proven solution to problem. Documentation of design decision.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Patterns are not;

A

Reusable code/libraries. Don’t need complex integrations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Pattern Format

A
  • Name and Classification
  • Intent
  • AKA
  • Motivation (Sample Problem)
  • Applicability (Situation)
  • Structure
  • Participants
  • Collaborators
  • Consequences
  • Implementation
  • Sample Code
  • Known Uses
  • Related Patterns
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Static Factory Methods

A
  • Singleton Pattern will use static factory method
  • Advantages over public constructors
  • Wrapper Classes used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Factory

A

Something that creates an instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

State Design Pattern

A

Connection can be in various state requests, handles differently depending on state. Connection delegates request to state object which changes dynamically.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly