2.3.1 - Defensive Design Flashcards

1
Q

What is anticipating misuse

A
  • Ensuring a program caters for all possible inputs no matter how far fetched they are
  • This is done by sending messages to correct user inputs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is authentication and how is it proved

A
  • A process used to verify the identity of the user so only the correct user can access data
  • It can be proved by a PIN, username and password, biometrics or personal information e.g. mothers maiden name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is verification

A

Asking a user to input some information such as a password twice to ensure it is them
This is a part of authentication

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

What is input validation and why is it needed

A
  • Ensures data entered is reasonable and sensible and in the right format
  • Reduces the risk of incorrect data crashing a program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Types of validation checks

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

What is a presence check

A
  • Makes sure a value is inputted and the user doesn’t accidentally leave something blank
  • Example code: if answer != “ “ then
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a data type check

A
  • Makes sure the data entered is of the correct type e.g, only integers are entered as an input
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a range check

A
  • Checks the upper and lower boundaries to make sure the users input is inbetween sensible values e.g. age for a game is inbetween 7-99
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a length check

A
  • Limits the data entered to make sure it is not too short or too long
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is maintainability and methods of doing it

A
  • Making sure a program is easy to undersand or to modify
  • Indentation
  • NAming conventions
  • Using subprograms
  • Commenting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is indentation

A
  • Where some lines of code are forward a few spaces
  • This is used in selections and iterations
  • They make it easier for the programmer to see where these loops are

Python auto indents but some other programming languages don’t

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

What are naming conventions

A
  • Giving variables sensible names that reflects the purpose of the variable and the data it stores
  • This allows other programmers to understand what the variables are used for
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is commenting

A
  • # or //
  • Allows for English communication of what certain parts of the code does
  • Documents the creator and who edits as well
  • this allows it to be maintained long after it was created
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are subprograms and the different types of subprograms

A
  • Breaking the code into smaller parts with each subprogram having a set role to produce structure code
  • Functions - used to read data, manipulate it and send it back to the main program (return)
  • Procedures - performs a task but doesn’t return a value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Advantages of subprograms

A
  • Saves time - can be saved as separate modules and used in other programs
  • Small so easy to write, test and debug
  • Shorter programs - can be called multiple times and only has to be written once
How well did you know this?
1
Not at all
2
3
4
5
Perfectly