McConnell_2004_CH07_High_Quality_Routines Flashcards

1
Q
  1. What are some other words which mean the same as ‘routine’?
A

A routine is an individual method or procedure invocable for a single purpose. Examples include a function in C++, a method in Java, a function or sub procedure in Microsoft Visual Basic. For some uses, macros in C and C++ can also be thought of as routines.You can apply many of the techniques for creating a high-quality routine to these variants.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. List 10 good reasons for creating a routine?
A
  • Reduce Complexity
  • Introduce an intermediate, understandable abstraction
  • Avoid duplicate code
  • Support subclassing
  • Hide Sequences
  • Hide pointer operations
  • Improve portability
  • Simplify complicated boolean tests.
  • Improve performance
  • To ensure all routines are small?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. What does ‘cohesion’ mean when used a heuristic for designing a routine? p168
A

For routines, cohesion refers to how closely the operations in a routine are related.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. What are bad kinds of cohesion for a routine?
A
  • Sequential Cohesion
  • Communicational cohesion
  • Temporal Cohesion
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. State guidelines for creating a good routine name?
A

(Page 171 to 172)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. How long should a routine be?
A

(Page 173 to 174)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. What is one of the most error prone areas of a programme
A

A study at IBM found that the most error-prone routines where those that were larger than 500 Lines of code. Beyond 500 lines, the error rate tended to be proportional to the size of the routine.

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