Solutions Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Replace Conditional with Polymorphism.

A

When using type information to branch logic.

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

Replace Conditional with Null Object.

A

For removing excessive nil checks.

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

Extract Method.

A

For making a method smaller, reusable, less complex, and decreasing duplication.

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

Rename Method.

A

For improving readability.

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

Extract Class.

A

For making classes simpler, more reusable and with a better SRP.

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

Extract Value Object.

A

For reducing duplication, making the code simpler and the business logic - more cohesive.

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

Extract Decorator.

A

For adding additional behaviour to an object dynamically - it makes SRP better.

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

Extract Partial.

A

For removing complex or duplicated view code from your application.

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

Extract Validator.

A

For making validations reusable.

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

Introduce Parameter Object.

A

To reduce the number of input parameters to a method.

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

Introduce Form Object.

A

To remove business logic from controllers when processing data.

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

Introduce Explaining Variable.

A

Improves readability.

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

Replace callback with a method.

A

When callbacks contain business logic it helps increase reusability.

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

Replace mixin with composition

A

Provides safe steps for cleanly removing mixins that have become troublesome.

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

Replace subclasses with strategies

A

Replace the subclasses with individual strategy classes. Each strategy class will implement a common interface.

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

Inline class.

A

Remove class and inline into 1-2 methods

17
Q

Inject Dependencies

A

Allows you to keep dependency resolutions close to the logic that affects them.

18
Q

Move method.

A

To find better place for a method

19
Q

Use Class as a Factory

A

An Abstract Factory is an object that knows how to build something

20
Q

Use Convention Over Configuration.

A

a rule(convention) is easier than configure each case in different way