Week 2 Flashcards
Meaning by Generalisation
- You are given a specific problem
- You decompose the problem into parameters, such that it can solve other type of problems
Methods of Generalisation
- Generalised by paramets and not via global variables
IEEE classification
- 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
Economy of Defects
The longer a defect is undiscovered: the higher the cose to remove it
- The cost grows exponentially in distance between the injection and elimination
Why does defects decrease the predictability of a project
- Hard to know how long to remove a defect
- Cost (time) of defect localisation and repair are extremely variable
Kinds of Engineering Mistakes
- 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 to deal with mistakes
- Admit that people make mistakes
- Prevent them as much as possible
- Minimise consequence: fault tolerance, defensive programming
- Detect the presence of defects as early as possible
- Localise defects
- Repair defects
- Trace them: root causes and passible other consequence
- Learn from them
Techniques for Construction test Cases
- Boundary analysis: pick values on and near boundaries
- Equivalence classes: pick a case from every equivalence class
- Statement, branch, and path coverage
- Random input
What is Boundary analysis
pick values on and near boundaries
What is Equivalence classes
pick a case from every equivalence class
How to decide on pass vs. fail when making a test case
- 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
What is a Robust Program
continues to behave reasonably in the presence of a defect, a violated precondition call
What is the best way a robust program deals with default
At best: provide an approximation of defect-free behavior. Also known as graceful degradation.
What is the worst way a robust program deals with default
At worst: halt with a meaningful error message without causing damage.
What is a partial Function
Do nothing when given a wrong call: “Its up to the client to call it correctly”