Return to Video

The Mystery Program - Software Debugging

  • 0:00 - 0:03
    Now for your homework--your homework for this unit will be
  • 0:03 - 0:06
    statistical debugging on a mystery program.
  • 0:06 - 0:11
    The ideal is that you get the mystery program and the number of runs which pass or fail
  • 0:11 - 0:15
    and your job is to apply statistical debugging to find out
  • 0:15 - 0:18
    what is it in the mystery program that causes the failures.
  • 0:18 - 0:24
    However, this time we're going to look at another set of execution features that is not lines executed
  • 0:24 - 0:27
    but instead the return values of individual functions.
  • 0:27 - 0:30
    One of the outputs of your task could be
  • 0:30 - 0:36
    that the program fails whenever f returns a value that's greater than zero.
  • 0:36 - 0:39
    For this, you need to track the return values of individual functions
  • 0:39 - 0:43
    and again, the Python trace it function will do that for you.
  • 0:43 - 0:47
    The event is return and the return value is contained in the argument.
  • 0:47 - 0:52
    Plus you need to categorize the return values in multiple booklets.
  • 0:52 - 0:58
    I want you to use precisely three categories--namely less than zero, zero, and greater than zero.
  • 0:58 - 1:01
    For numerical values, this is straightforward.
  • 1:01 - 1:04
    Depending on the sign you put them into one of the three categories,
  • 1:04 - 1:11
    but what for non numerical values say list or strings or dictionaries or sets.
  • 1:11 - 1:16
    For these, you compute the length. If a string is empty, then it comes into the zero category.
  • 1:16 - 1:21
    If it has one character or more, then it comes into the greater than zero category.
  • 1:21 - 1:26
    Same goes for sets--no elements, one element or more, list in dictionaries likewise.
  • 1:26 - 1:32
    The Boolean values false and true, also going to zero and greater than zero.
  • 1:32 - 1:37
    Since less than zero is frequently used to indicate some exceptional return value,
  • 1:37 - 1:40
    we're going to use this category for special values
  • 1:40 - 1:44
    such as none, not a number. as well as for exceptions.
  • 1:44 - 1:49
    That is if a function does not return a value but raises an exception instead,
  • 1:49 - 1:54
    then you categorize this in the same way as the return value that is less than zero.
  • 1:54 - 2:00
    What you then do is for each function you compute the five coefficient for each category
  • 2:00 - 2:02
    as well as for its respective complement.
  • 2:02 - 2:06
    What do I mean by complement? Well, let me illustrate this with an example.
  • 2:06 - 2:10
    So again you set up a table and count in how many runs the function f
  • 2:10 - 2:12
    return the value that was less than zero.
  • 2:12 - 2:15
    Do this for the failing runs as well as for the passing runs.
  • 2:15 - 2:20
    The complement here of course is any value that is greater or equal than zero
  • 2:20 - 2:24
    and again you count the number of runs and this is something you do for each category.
  • 2:24 - 2:29
    For the zero category, we check whether the return value was zero or whether it was non-zero
  • 2:29 - 2:33
    and finally, we do the same for the third category namely greater than zero.
  • 2:33 - 2:39
    Now your task will be to compute the five coefficients for all function and all categories
  • 2:39 - 2:45
    as well as their compliments and then to find out for the mystery program, which is the one function
  • 2:45 - 2:49
    whose return value category correlates the strongest with failure.
  • 2:49 - 2:51
    Here's your chance to apply statistics to do the debugging. Enjoy.
Title:
The Mystery Program - Software Debugging
Team:
Udacity
Project:
CS259 - Software Debugging
Duration:
02:55
Udacity Robot edited English subtitles for 01ps-01 The Mystery Program
Udacity Robot edited English subtitles for 01ps-01 The Mystery Program
Fran Ontanaya edited English subtitles for 01ps-01 The Mystery Program
Amara Bot added a translation

English subtitles

Revisions Compare revisions