Design Techniques Flashcards

1
Q

Design Technique: Documentation

A

Main focus on readability:

  • code documentation and comments
  • code style conventions and restrictions of language features
  • good naming of identifiers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are API comments?

A

comments on class level and method level

  • add useful information for developers
  • > describe in detail when method is called, its behaviour (side effects, exceptions, etc), additional restrictions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are Statement level comments?

A

Describe implementation details for own code

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

Design Technique: Refactoring

A

technique for restriction an existing body of code without changing its external behaviour

  • preparing addition of features
  • improving design (eg. cohesion) and maintainability
  • increase comprehensibility
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Refactoring Technique: Extract Method

When?

A
  • one method does many things

- code duplication within the method itself or across several methods

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

Refactoring Technique: Extract Method

Worauf achten?

A

Variables:
- ensure that they are only used in the extracted
code
-> declare them locally
- exactly one variable is modified in code
-> check if it can become the return value
- more than one var is modified
-> method not applicable

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

Refactoring Technique: Move Method

When?

A

Class has too many responsibilities

-> split them into different classes (SRP)

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

Refactoring Technique: Move Method

Check

A

Does the source method

  • use features of the source class
  • override method or is overriden
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Refactoring Technique: Extract class

When?

A

if class has two or more independent responsibilities and no other class is suitable for the fields and methods

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