Chapter 11: Anti-Patterns Flashcards

1
Q

What is refactoring?

A

A refactoring is a correctness-preserving transformation that improves quality of the system

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

Are anti-patterns refactored?

A

True, they are refactored to overcome their negative consquences.

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

What are the state of affairs?

A
  • One of six software projects are unsuccessful
  • One third of software projects are cancelled
  • Delivered system the budget and time to deliver is double as expected
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the God Class anti-pattern?

A

There is one god class that performs most of the work of the system while all other classes provide a very small role

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

What is the problem with God Class?

A

Causes excessive message traffic

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

Solution to the God Class?

A

Refactor the design to uniformly distribute intelligence to top-level classes in the system.

Locality principle.

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

What is the Excessive Dynamic Allocation anti-pattern?

A

Excessive dynamic collection addresses frequent unnecessary creation and destruction of objects in the same class

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

What is the problem with excessive dynamic allocation?

A

The time it takes to initialize the dynamic object on the heap and delete it off the heap ruins performance

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

What is the solution to the excessive dynamic allocation?

A

Pre-allocate a “pool” of objects that are used frequently and store them in a collection or share objects.

Application of the processing vs frequency principle.

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

What is the Circuitous Treasure Hunt?

A

Software retrieves data from a first table, uses those results to search a second table, retrieves data from the table and so on, until the “ultimate results” are obtained

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

What is the problem with Circuitous Treasure Hunt?

A

Impact on performance is the large amount of data processing required to do the ultimate search.

Especially when figuring out the last call to make in the search.

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

What is the solution to the Circuitous Treasure Hunt?

A

Select a different data organization if a database access problem occurs early in development

In distributed systems use adapter pattern to allow for a more reasonable interface for remote calls

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

What is the adapter design pattern?

A

Adapters are used to enable objects with different interfaces to communicate with one another.

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

What is the one-lane bridge anti-pattern?

A

One, or only very few processes are allowed to execute concurrently

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

What is the problem with one-lane bridge anti-pattern?

A

All other processes must wait while other processes run.

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

Solution to the one-lane bridge anti-pattern?

A

Allow for more resources to be shared for that more processes are allowed to run concurrently.

Follows the shared resource principle.

17
Q

What is the traffic jam principle?

A

The performance impact of the traffic jam is the transient behavior that produces wide variability in response time

18
Q

What is the problem with the traffic jam principle?

A

One-lane bridge produces many processes waiting for a turn which then means it takes time for the service to get back to normal

19
Q

What is the solution to the traffic jam principle?

A

If problem is caused by one-lane bridge then solving that pattern will help

If problem is caused by periodic high demand then use the spread-the-load principle.