2.3 Producing robust programs Flashcards

1
Q

what are the defensive design considerations

A
  • anticipating misuse
  • authentication
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

one method of authentication

A

usernames and passwords can be entered. if they match previously stored entries for that user then access is granted

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

what is anticipating misuse

A

trying to predict all possible inputs so that it will never crash or give an incorrect result

when validation or verification can’t solve the issue, help messages and careful instruction should be used

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

what is authentication

A

making sure that a person is who they say they are

methods include usernames and passwords, fingerprint ID or facial recognition

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

what is input validation

A

the checking of input data to ensure that it is sensible or reasonable. it cannot guarantee that the data is correct

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

types of input validation

A
  • range check
  • length check
  • type check
  • presence check
  • format check
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is a range check

A

the input is within a specified range

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

what is a type check

A

the input is the right data type

eg string, integer

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

what things are important to the maintainability of a program

A
  • use of sub programs
  • naming conventions
  • indentation
  • commenting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is verification

A

the input of data twice to see if they match

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

advantages of subprograms

A
  • makes debugging the program easier as they are usually quite short
  • they can be tested separately
  • a particular subprogram can be called multiple times in the same program and be saved in a library to be used again in other programs
  • helps to produce structured code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

example of decomposition in programming

A

using subprograms

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

why do we use naming conventions and what does it involve

A

helps to identify variable names within a code
helps with readability

  • having meaningful and consistent format for the naming of variables

eg camelCase

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

why do we use indentation

A

helps the readability as it is then clear where statements within an iteration or other construct start and end. for some programming languages its mandatory

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

why do we use commenting

A

used to document for yourself and others the purpose of the program and each subprogram. it can also indicate who wrote the program and when it was last updated

helps to ensure that the program can still be understood and maintained long after it was written

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

the purpose of testing

A

to ensure that for any input, the program always runs correctly

17
Q

types of testing

A

iterative
final or terminal

18
Q

what is iterative testing

A

carried out using a pre-written test plan, finding and correcting errors in a program and retesting until all tests give the expected output

done during development

19
Q

what is final testing

A

checking that all the required functions have been included, nothing is missing and everything works correctly when data is entered

done when the program is completely finished

20
Q

what are the two types of errors in programming

A

syntax
logic

21
Q

what is a syntax error

A

errors which break the grammatical rules of the programming languages and stop it from being run

22
Q

what is a logic error

A

errors which produce an unexpected output but will still run

23
Q

what are the types of test data

A

normal
boundary
invalid/erroneous

24
Q

what is normal test data

A

data which should be accepted by a program without causing errors

25
Q

what is boundary test data

A

data of the correct type which is on the very edge of being invalid - using both ends of the allowed range

26
Q

what is invalid test data

A

data of the correct data type which should be rejected by the computer system

27
Q

what is erroneous test data

A

data of the incorrect data type which should be rejected by the computer system