Week 2 Flashcards

1
Q

Meaning by Generalisation

A
  • You are given a specific problem
  • You decompose the problem into parameters, such that it can solve other type of problems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Methods of Generalisation

A
  • Generalised by paramets and not via global variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

IEEE classification

A
  • Mistake: human action, causing a fault
  • Defect, fault: anomaly in a product that can somehow lead to a failure
  • Failure: product deviates from requirements during use, Or
  • Error: difference between actual and expected result
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Economy of Defects

A

The longer a defect is undiscovered: the higher the cose to remove it
- The cost grows exponentially in distance between the injection and elimination

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

Why does defects decrease the predictability of a project

A
  • Hard to know how long to remove a defect
  • Cost (time) of defect localisation and repair are extremely variable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Kinds of Engineering Mistakes

A
  • Misunderstanding a customer
  • Misinterpreting a written requirement
  • Overlooking a case in analysing the requirements
  • Adopting an incorrect algorithm
  • Making an unwarranted assumption when implementing a method
  • Making a type error when entering the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to deal with mistakes

A
  1. Admit that people make mistakes
  2. Prevent them as much as possible
  3. Minimise consequence: fault tolerance, defensive programming
  4. Detect the presence of defects as early as possible
  5. Localise defects
  6. Repair defects
  7. Trace them: root causes and passible other consequence
  8. Learn from them
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Techniques for Construction test Cases

A
  • Boundary analysis: pick values on and near boundaries
  • Equivalence classes: pick a case from every equivalence class
  • Statement, branch, and path coverage
  • Random input
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Boundary analysis

A

pick values on and near boundaries

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

What is Equivalence classes

A

pick a case from every equivalence class

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

How to decide on pass vs. fail when making a test case

A
  • Select trivial or highly structured input with known output
  • ‘Manually’ determine expected output
  • Check correctness of output via ‘inverse’ process;
  • Use alternate implementation to compute expected output; e.g. using a slower but simpler algorithm
  • Cross check the consistency of implementation; e.g. check whether sorting a list and sorting a permutation of that same list yield the same output
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a Robust Program

A

continues to behave reasonably in the presence of a defect, a violated precondition call

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

What is the best way a robust program deals with default

A

At best: provide an approximation of defect-free behavior. Also known as graceful degradation.

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

What is the worst way a robust program deals with default

A

At worst: halt with a meaningful error message without causing damage.

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

What is a partial Function

A

Do nothing when given a wrong call: “Its up to the client to call it correctly”

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

What is a return special value for a robust program

A

The program returns a special value, which we know is not a legal value, to show that the function was not called properly.

17
Q

Why can’t we use special values for a robust program?

A

Because there may not be a specific value that is not a legal a value

18
Q

What are the three ways to deal with violated precodition (make a robust program1)

A
  • Do Nothin
  • Return a special value
  • Use an exception
19
Q

What is the best way to deal with a violated precondition (make a robust program)

A
  • Use an exception
20
Q

Advantages of robustness

A
  • Easier to locate an error
21
Q

Disadvantages of robustness

A
  • More code
  • Runtime overhead in checking the precondition, even if satisfied
  • Runtime overhead in throwing, propagating, catching exceptions.