Robustness

Video

Slides

Slides

Exercise

  • Identify assumptions in your code

    • What assumptions/expectations exist on your data or (user) input?

    • What assumptions/expectations exist on the input of (a) function(s)?

Based on the assumptions/expectations you were able to identify, work on increasing the robustness of your code. Choose one:

  • Make the input/data assumptions explicit

    • Option 1: Explicitly state assumptions on data or input in your README.md.

    • Option 2: Write a piece of code that tests the validity of data/input, and reports an error if the expectations are not met.

  • Test the input for a function. Modify the code inside your function to:

    • check the value of the arguments passed to your function using if/else statements;

    • raise an error in case an argument is out of the range of acceptable values.