What should never happen if programs are functioning correctly?
- never produce errors
How will programmers try protect their programs?
Through defensive design
What are some examples of defensive design?
What’s the easiest way for a user to accidentally or unintentionally misuse a program?
When entering data
What are two ways you can prevent someone from entering something you don’t want them too?
Input sanitisation and input validation
What is input sanitisation?
removing any unwanted characters before passing data through the program.
What is input validation?
Checking if data meet certain criteria before passing it into the program. e.g. checking if an email address contains an @ symbol and has a suitable ending like .com
What are types of input validation you can use?
What is a check digit?
Checks numerical data has been entered accurately.
What is a format check?
Checks the data has a correct format.
What is a look-up table?
Checks the data against a table of acceptable values.
What is a length check?
Checks the data is the correct length.
What is a range check?
Checks the data is within a specified range.
What is a presence check?
Checks the data has even accurately entered.
What does the function formatName() do?
It goes through the character of a string and deletes the character if it’s “(“ or “)” and returns the amended string.
What does the method removeChar(x) do?
Returns a new string with the character in position x removed.
What is authentication?
How can you increase the security of a password based authentication system?
Why is having too much authentication an issue?
Can affect a program’s functionality and put people off using it.
What are the benefits of a well-maintained program?
What features can improve the maintainability of source code?
Why are comments good to improve the maintainability of source code?
Useful to explain the key features of a program and well written and clear comments help other programmers understand your code.
Why is indentation good to improve the maintainability of source code?
- allows other programmers to see the flow of the program clearly and pick out different features
How does naming your variables and sub programs improve the maintainability of source code?
- helps programmers keep track and recognise what the variables are throughout the program.