T8 - Defensive design Flashcards

1
Q

Data validation use

A

-ensures that data entered is of the right type
-conforms to a set of rules
-only check that the data entered
is reasonable

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

Data validation cannot ensure

A

hat the user has not entered a wrong value, or made a spelling mistake in a name

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

Range check

A

-number or date is within correct/sensible range

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

length check

A

checks that text entered is of correct length
-not too short/long

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

type check

A

check data is correct type (interger/boolean)

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

Presence check

A

ensures data has been entered
-detects blank regions

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

eg of length check

A

password must be between 5 and 12 characters

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

Verification

A

is used to double-check that the data has been typed in correctly

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

Verification eg

A

a user setting a new password may be asked to type it in twice

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

Double-entry verification:

A

If the two passwords don’t match, they will be asked to enter the password again

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

Authentication routines

A

are used to make sure a person is who they claim to be

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

Brute-force attack:

A

software programs try out every combination of letters, numbers and special characters

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

ways to prevent brute force attack

A

Use a password of 8 characters or more to make it more difficult to hack!

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

maintaining code meaning

A

improve the code, fix bugs or add new features to the program

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

factors that make maintenance easier

A
  • The use of sub programs
  • Using appropriate naming conventions
  • Indentation
  • Commenting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Sub programs:

A

can take inputs (through parameters) and if necessary return a value

17
Q

eg of sub programs

A

include functions and procedures

18
Q

pros of sub programs

A

reused multiple times in the program or by other programs

19
Q

pros of using meaningful names for variables

A

= easy to understand

20
Q

Indentation:

A

makes it possible to easily see which lines of code are part of different structures

21
Q

Comments in code pros:

A
  • help other programmers to understand your code
    -help you understand your code when you go back to it at a later time
22
Q

Comments should mention:

A

-Parts of a program/algorithm that are difficult to understand
-At the start of a function or procedure to explain what it does

23
Q

Input validation

A

– checking input meets certain rules, e.g. the type of data

24
Q

Anticipating misuse

A

– preventing too many entries of a password to make it harder for hackers to guess

25
Q

Authentication

A

– entering data twice or checking from an alternative source

26
Q

Use of sub programs

A

– creates reusable code where bugs can easily be fixed

27
Q

Naming conventions

A

– good use of variables and sub program names makes programs easier to read

28
Q

Indentation

A

– makes programs easier to read

29
Q

Commenting

A

– helps programmers understand what a program does and how it does it