What is defensive design?
Creating programs that can handle unexpected or erroneous data and/or inputs by anticipating misuse.
How is defensive design put into place by programers?
they will try to:
* use input validation & authentication
* anticipate how users might misuse their program, then attempt to prevent this
* ensure their code is well maintained
* reduce the number of errors in the code throught testing
What is anticipating misuse?
designing a system, predicting how users can act in an unintended or malicious way and minimising this
What is authentication?
the process of determining the identity of a user
What is input validation?
the process of checking that the data entered by a user is appropriate for its use, so that it can be correctly processed without any errors
What are the (3) types of input validation?
What is a presence check?
checks that data has been entered and not blank.
What is a range check?
checks that an input falls within the required range.
What is a length check?
checks a specified number of characters have been entered.
Give a python example of presence check
name = input(“Enter your name”)
if name == “”:
print(“Invalid”)
Give a python example of range check
num = int(input(“Enter a number less than 10”))
if num >= 10:
print(“Too large!”)
Give a python example of length check
password = input(“Enter a password, minimum 8 characters.”)
if len(password) < 8:
print(“Password too short!”)
What is maintaining programs?
What are the (4) ways of maintaining programs?