Defensive design Flashcards

1
Q

What is the purpose of defensive design?

A

to ensure that a program runs correctly and continues to run no matter what actions a user takes. This is done through planning for all possibilities (contingencies) and thinking about what a user may do that the program does not expect

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

What 3 areas does defensive design encompass?

A
  • protection against unexpected user inputs or actions, such as a user entering a letter where a number was expected
  • maintainability - ensuring code is readable and understandable
  • minimising/removing bugs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How is the anticipation and protection of a program carried out?

A
through....
validation
sanitisation
authentication
maintenance
testing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does validation do?

A

checks data and inputs to ensure that it is sensible or reasonable.

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

What types of validation can be built into a program?

A
  • Range check
  • Length check
  • Presence check
  • Format check
  • Type check
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does a range check do?

A

checks that the input must fall within a specified range

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

What does a range check apply to?

A

numbers and dates, but can apply to characters.

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

What does a length check do?

A

that the input isn’t too long or too short

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

What does a presence check do?

A

checks that data has been entered

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

What does a format check do?

A

check that the data is in the correct format, such as entering a date in the format DD/MM/YYYY.

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

What does a type check do?

A

checks that the data is of a specified data type, such as an integer

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

Does validation ensure that data entered is correct?

A

No, only that data is sensible

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

What is a verification test ?

A

inputting data twice so that if the 2 entries match, the entry can be accepted as valid

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

What is data sanitisation?

A

to hide or protect data so it can’t be seen or disclosed.

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

What are the examples of data sanitisation?

A

masking and input sanitisation

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

What does masking do?

A

Masking hides visible data by replacing it with something else. A good example of this is when a person enters a password.

17
Q

.

A

.

18
Q

What is an example of input sanitisation?

A

A good example of this is on a website form. A hacker might try to gain access to a website’s data through a SQL injection attack. This would involve the hacker entering an SQL command into a website form to try and take control of the form’s linked database. Input sanitisation could be used here to remove any SQL commands from the inputted data, preventing a hacker from gaining control of the database.

19
Q

What is authentication?

A

the process of a user confirming that they are who they say they are on a computer system.

20
Q

What are the main factors of authentication?

A

something you are - username, bank account number, or anything that identifies the user uniquely
something you know - password, pin, secret answer to a question
something you have - swipe card, biometrics, any other physical identifying device

21
Q

What is the purpose of maintainability?

A

Ensuring that a program is easy to understand, modify and update over time

22
Q

What are examples of maintainability in use?

A

comments
sensible variable names
indentation

23
Q

What are comments?

A

lines in programs that provide information about what the different parts of the program do

24
Q

What should variable names do?

A

reflect the purpose of the variable and the data it is intended to hold

25
Q

Why is indentation used?

A

so you can see which code falls within the selection or iteration, and where it ends.

26
Q

What is the difference between syntax and logic errors?

A

Syntax errors occur when written code does not match the rules of the programming language. Logic errors occur when the program does not perform as expected.

27
Q

What is the purpose of testing?

A

The purpose of testing is to help the programmer remove such bugs and to ensure that the program functions as intended.

28
Q

What is iterative testing?

A

Iterative testing is carried out while a program is being developed. The programmer writes a section of code (module) then tests it. The module may work fine, but more likely the programmer will amend or fix the code, and test it again. The process repeats (iterates) until the module works as intended.

29
Q

What is final testing?

A

Final (terminal) testing is carried out when all modules are complete and the program is tested as a whole to ensure that it functions as it should.

30
Q

What is normal data?

A

sensible, possible data that the program should accept and be able to process

31
Q

What is boundary data?

A

valid data that falls at the boundary of any possible ranges

32
Q

What is invalid data?

A

Data which is outside the limits of valid data

33
Q

What is erroneous data?

A

Data that is unacceptable e.g the wrong data type

34
Q

What does a trace table do?

A

a trace table, contains all the variables a program contains. Whenever the value of a variable changes, the change is indicated in the trace table.

35
Q

What does a trace table help with?

A

Identifying logic errors