Making more robust and maintainable programs Flashcards

1
Q

what are 2 defensive design methods?

A

data validation
anticipating misuse
verification

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is data validation?

A

checking that user input meets certain criteria before processing it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what are the 5 data validation checks and an example?

A

type check - strings, int
range check - 1 to 10
presence check- required fields
format check - dd/mm/yyyy
length check - longer than 10 characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what are the 3 benefits of data validation?

A
  • more robust
  • more user friendly
  • prevent further errors in the algorithms
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what are 4 examples of anticipating misuse and a way to prevent each?

A

dividing by zero - check before calculations if variables are zero
communication error - failing to connect to a server, having a cancel request button
printer/peripheral error - always have a reprint option
disk errors - checking files and data before using them for processing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

give 3 ways to make a program for verified

A

username and password
password recovery
encryption
Captcha
defend against SQL injections

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

why is keeping a program maintainable important

A

so that it can be understood and edited quickly by you or others

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are 4 methods to maintain a program?

A

use comments - to explain or section out pieces of code
leave gaps - to make it easier to read and more organised
use indentation - for increased readability
use descriptive variables - so it is easier to tell what they do
use functions - to structure code
use constants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly