02 Section 6 - Defensive Design Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

How do programmers protect their programs?

A

Through defensive design

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

How do programmers protect their programs through defensive design?

A
  • anticipate how users might misuse the program, then attempt to prevent it from happening
  • ensure their code is well-maintained
  • reduce the number of errors in the code through testing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the easiest way that a user can accidentally or intentionally misuse a program?

A

Inputs

-when entering data into a program

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

What are the two ways you can use to prevent users from entering something you don’t want them to?

A

Input sanitisation

Input validation

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

What is input sanitisation?

A

removing any unwanted characters before passing data through the program

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

What is input validation?

A

checking if data meets certain criteria before passing it into the program
(e.g. checking an email address has an @ symbol and a suitable ending {.com .co.uk …})

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

What are examples of types of validation checks?

A
Range check
Presence check
Check digit
Format check
Look-up table
Length check
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 data is within a specific range

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

What is a presence check?

A

Checks that data has actually been entered

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

What does a check digit do?

A

Checks numerical data has been entered accurately

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

What is a format check?

A

Checks the data has the correct format

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

What does a look-up table do?

A

Checks the data against a table of acceptable values

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

What is a length check?

A

Checks the data is the correct length

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

How can authentication help protect a program?

A

It can confirm the identity of a user before they’re allowed to access certain pieces of data or feature of the program. (commonly done by using usernames and passwords)

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

What are ways to increase the security of a password-based authentication system?

A
  • force users to have strong passwords and get them to change them regularly
  • limit the number of failed authentication attempts before access to account is lost
  • ask for a random selection of characters from the password on each authentication
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What can be the issue with too high of a level of authentication in a program?

A

Too much authentication can affect a program’s functionality and put people off using it

17
Q

How is a well-maintained program an important part of a defensive design?

A

A well-maintained program makes it easy for other programmers to understand what the code does. They should also be able to change parts of the source code without the risk of causing problems elsewhere in the code.

18
Q

What features improve the maintainability of code?

A

Comments
Indentation
Variables and sub programs
Only use global variables when necessary

19
Q

How can comments improve the maintainability of a program?

A

They are useful for explaining what the key features of a program does
-well written, clear comments are essential for helping other programmers understand your program

20
Q

How can indentation improve the maintainability of a program?

A

They can separate different statements in a program

-allows programmers to see the flow of a program easier and pick out different features

21
Q

How can variables and sub programs improve the maintainability of a program?

A

They should be named so that they refer to what they actually are
-helps programmers to keep track and recognise what the variables are through the program

22
Q

Hoe can only using global variables when necessary improve the maintainability of a program?

A

Variables with a local scope will only affect the sub programs that they are declared in
-other programmers will know that changing these variables won’t affect other parts of the program