Download presentation
Presentation is loading. Please wait.
1
PPT6: Scientific debugging
CEN 4072 Software Testing PPT6: Scientific debugging PPT and video are due: no later than October 5, 5:00 PM Submit to: This template file is just an outline of the presentation that you need to complete. Additional pages will be necessary to fully explore the topic above. Each page should contain adequate text as well as illustrations. You are free to use all publically available information (text as well as graphics) as long as the sources are properly acknowledged.
2
Team members’ contributions
Member [name]:
3
Errors Content outline: What is an error in the software
4
Causes and effects Content outline: What is the cause of a problem?
Examples
5
Causes and effects Content outline: How to prove causality? Example
6
Causality Content outline: Repeating history
Can we repeat history in software?
7
Causality Content outline: Repeating program runs
How much data and knowledge does it take?
8
Causes by intuition Content outline: Can intuition be taught?
What is tacit knowledge and how one would acquire it?
9
Scientific method: what is it?
Content outline: Explanation and examples
10
Scientific method: main steps
Content outline: Steps and their explanations in using the scientific method
11
What is a theory? Content outline: The road from hypothesis to theory
12
Scientific method of debugging
Content outline: Details, explanation and chart
13
Sample program revisited
int main(int argc, char *argv[]) { int *a; int i; a = (int *)malloc((argc - 1) * sizeof(int)); for (i = 0; i < argc - 1; i++) a[i] = atoi(argv[i + 1]); shell_sort(a, argc); printf("Output: "); printf("%d ", a[i]); printf("\n"); free(a); return 0; } static void shell_sort(int a[], int size) { int i, j; int h = 1; do { h = h * 3 + 1; } while (h <= size); h /= 3; for (i = h; i < size; i++) int v = a[i]; for (j = i; j >= h && a[j - h] > v; j -= h) a[j] = a[j - h]; if (i != j) a[j] = v; } } while (h != 1);
14
Debugging with the scientific method
Content outline: Detailed steps of how to use the scientific method to debug the sample program
15
Explicit debugging Content:
Stating the problem explicitly can help solve the problem The Teddy Bear principle of software
16
Keep a notebook Content outline:
Keep a record of each debugging session
17
Algorithmic debugging
Content outline: Steps of the algorithmic debugging
18
Example code for algorithmic debugging
def insert(elem, list): if len(list) == 0: return [elem] head = list[0] tail = list[1:] if elem <= head: return list + [elem] return [head] + insert(elem, tail) def sort(list): if len(list) <= 1: return list head = list[0] tail = list[1:] return insert(head, sort(tail))
19
Algorithmic debugging session
Content outline: Step-by-step debugging of the sample code above Include an explanation as well as a chart
20
Pros and Cons Content outline:
Pros and cons of the scientific debugging
21
Obtaining a hypothesis
Content outline: Observing a run Deducing from the code Problem report Earlier hypotheses
22
Reasoning about the programs: deduction
Content outline: Details on how to use deduction Example
23
Reasoning about the programs: observation
Content outline: Details on how to use observation Example
24
Reasoning about the programs: induction
Content outline: Details on how to use induction Example
25
Reasoning about the programs: experimentation
Content outline: Details on how to use experimentation Example
26
Your code experimentations
Content outline: Share your experience(s) with experiments Examples
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.