Week 1 Flashcards

1
Q

Name this: formalized best practices can be used to solve
common problems when designing an application
or system. General & reusable.

A

Patterns

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

T/F - Patterns are a finished design that can be transformed into code

A

False

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

Patterns are a description or recipe for how to _____ a _______

A

solve a problem

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

What are 5 advantages of patterns?

A
  1. General, not tied to a specific problem
  2. Flexible
  3. Faster (proven, well understood)
  4. Easier to read/understand the code if you know the pattern
  5. Fosters communication among programmers (they don’t have to include a diagram if you both know)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are 3 disadvantages of patterns?

A
  1. They have to be programmed fresh for each application
  2. Can complicate designs and impact performance
  3. Must know when to use them (and how)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Indirection, when used in patterns results in both an advantage and disadvantage

A

Indirection is used to be flexible, but can complicate designs and impact performance

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

What are the 3 groups of design patterns?

A

Creative, Structural, Behavioural

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

What is the focus of the creative DP?

A

Class instantiation

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

What is the focus of the structural DP?

A

Class composition

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

What is the focus of the behavioural dp?

A

Communication among objects

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

Name this creative DP: Restricts object creation for a class to only one instance.

A

Singleton

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

Name this creative DP: constructs complex objects by separating construction and
representation.

A

Builder

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

Name this creative DP: Creates objects without specifying the exact class to create.

A

Factory

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

Name this Structural DP: Match interfaces of different classes

A

Adapter

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

Name this Behavioural DP: Register with an object and get notified of changes

A

Observer

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

Name this Behavioural DP: Encapsulate a command request as an object

A

Command

17
Q

Creative DPs pneumonic device

A

SOBFAP

18
Q

Behavioural DP pneumonic device

A

SOCISI or ISICOS

19
Q

Name 4 criticisms of design patterns

A
  1. Leads to ineffective solutions (Solution may be found but it’s not necessary/worse)
  2. “New” patterns are created which are already existing techniques
  3. No formal foundation (just opinions of the GoF)
  4. Focusing on pattern not code (could be eliminated with more abstraciton)
20
Q

T/F - Anti-patterns criticize DP’s and suggest not to use them

A

False, they build on the DP concept.

21
Q

These provide ways of dealing with frequent “pattern failure” encountered by the authors

A

Anti-patterns

22
Q

Anti-patterns describe repeated patterns that appear to be… BUT the negative….

A

appear to be beneficial, BUT the negative consequences out-weigh the possible advantages