Chapter 7 - Refactoring Flashcards

1
Q

What is the Motivation of Refactoring?

A

es gibt 3 Stellschrauben: Deadline, External Quality (Features) und Internal Quality (Code, sieht der Kunde nicht) wobei oft nur 2 von 3 anpassbar sind. Code wird öfter gelesen als geschrieben, oft aktueller als documentation

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

What is Refactoring?

A

improvement of the internal structure without changing external behavior, longevity (langlebigkeit) of software requires continuous improvement

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

How is refactoring done?

A

carried out in small steps, test cases safeguard the correctness of transformations, if there are no tests: write them at first!

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

Why might Refactoring be necessary?

A

adding functionality leads to duplicate code (unabsichtlich da Entwickler evtl. nicht ganzen Code kennt) –> Refactoring

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

When should Refactoring be done?

A

beim dritten Mal wo man über das Problem stolpert

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

What are problems with refactoring?

A

leads to Indirection (Umweg): nice code but bad performance –> 90/10 rule (90% of runtime is spent for 10% code)

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

Explain “Bad Smells”

A

when is design bad? Code metrics do not really help (e.g. inheritance depth of 3 might be worse or of 7 might be still okay…)

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

Name Bad Smells Indicators

A

Duplicate Code, Long methods, Switch statements, Comments

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

Explain “Refactoring to Patterns”

A

introduce patterns while refactoring, e.g. null object

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