Producing robust programs Flashcards

1
Q

Producing robust programs

What is Defensive Design?

A

Means that all possible contingencies are planned for including accidental or deliberate incorrect inputs or menu option selection

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

Producing robust programs

What is this?
Means that all possible contingencies are planned for including accidental or deliberate incorrect inputs or menu option selection

A

Defensive Design

It ensures that
 Errors / bugs are kept to a minimum
 Programs behave as expected even if the user does something unexpected
 All possible errors that could occur are identified and catered for

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

Producing robust programs

What does Defensive Design try to ensure?

A

 Errors / bugs are kept to a minimum
 Programs behave as expected even if the user does something unexpected
 All possible errors that could occur are identified and catered for

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

Producing robust programs

Defensive Design

What is Input Sanitisation?

A
  • Removing ‘white space’ from user input

* Converting user input so that it is all one case, e.g. upper case

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

Producing robust programs

Defensive Design

What does this describe?
• Removing ‘white space’ from user input
• Converting user input so that it is all one case, e.g. upper case

A

Input Sanitisation

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

Producing robust programs

Defensive Design
What is Validation?

A
  • Range checks – checks input is between minimum and maximum values
  • Data type checks – checks data, for example, is numeric / alphabetic
  • Length check – checks data is a certain number of characters long
  • Presence check – checks field is not empty, e.g. must enter a name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Producing robust programs

Defensive Design

What is :

  • Range checks – checks input is between minimum and maximum values
  • Data type checks – checks data, for example, is numeric / alphabetic
  • Length check – checks data is a certain number of characters long
  • Presence check – checks field is not empty, e.g. must enter a name
A

Validation

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

Producing robust programs

Defensive Design

What is Authentication?

A
  • Authentication is the process of checking the identity of a user
  • This is done using user names and passwords. Passwords will be stored in encrypted form
  • Authentication checks that the username and password entered exist
  • Using software such as reCaptcha to check that the user is human and not an online bot, automatically entering data in online forms
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Producing robust programs

Defensive Design

What is this?

  • Authentication is the process of checking the identity of a user
  • This is done using user names and passwords. Passwords will be stored in encrypted form
  • Authentication checks that the username and password entered exist
  • Using software such as reCaptcha to check that the user is human and not an online bot, automatically entering data in online forms
A

Authentication

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

Producing robust programs

Defensive Design

How should you plan for contingencies? (4 things)

A
  • Programs should check for potential errors such as division by 0
  • Programs should give users options to Cancel requests / provide error messages
  • Programs should not assume that a request to print has been successful so should always provide an option to reprint
  • Programs accessing files should not assume that the file will be found or that a file has anything in it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Producing robust programs

Defensive Design

What is this called?

  • Programs should check for potential errors such as division by 0
  • Programs should give users options to Cancel requests / provide error messages
  • Programs should not assume that a request to print has been successful so should always provide an option to reprint
  • Programs accessing files should not assume that the file will be found or that a file has anything in it
A

planning for contingencies

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

Producing robust programs

Maintainability

Why do programmes need to be easy to maintain?

A

 So if you return to code to, for example, add more features, you can understand what you did
 So people who you are working with can pick up your code and easily work with and understand what you have done

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

Producing robust programs

What are these?

 So if you return to code to, for example, add more features, you can understand what you did
 So people who you are working with can pick up your code and easily work with and understand what you have done

A

reasons why programmes need to be easy to maintain

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

Producing robust programs

Maintainability

How can programmers ensure the code they write is easy to maintain?

A

 Use comments to:
• Explain the purpose of the program
• Explain sections of code
• Explain unusual approaches
• Visually divide sections of a program
 Use whitespace to make sections of a program easier to see
 Use indentations for every selection and iteration branch
 Use descriptive variable names and explain their purpose with a comment
 Use procedures and functions to:
• Structure the code
• Eliminate duplicate code
 Use constants declared at the top of a program

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

Producing robust programs

Maintainability

What are these?
 Use comments to:
• Explain the purpose of the program
• Explain sections of code
• Explain unusual approaches
• Visually divide sections of a program
 Use whitespace to make sections of a program easier to see
 Use indentations for every selection and iteration branch
 Use descriptive variable names and explain their purpose with a comment
 Use procedures and functions to:
• Structure the code
• Eliminate duplicate code
 Use constants declared at the top of a program

A

ways programmers can ensure the code they write is easy to maintain

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

Producing robust programs

Maintainability
How can the following help programmers ensure the code they write is easy to maintain?
comments (4 things)

A
	Use comments to:
•	Explain the purpose of the program
•	Explain sections of code
•	Explain unusual approaches
•	Visually divide sections of a program
17
Q

Producing robust programs

Maintainability

How can the following help programmers ensure the code they write is easy to maintain?
White space

A

 Use whitespace to make sections of a program easier to see

18
Q

Producing robust programs

Maintainability

How can the following help programmers ensure the code they write is easy to maintain?
Indentations

A

 Use indentations for every selection and iteration branch

19
Q

Producing robust programs

Maintainability

How can the following help programmers ensure the code they write is easy to maintain?
Descriptive variable names

A

 Use descriptive variable names and explain their purpose with a comment

20
Q

Producing robust programs

Maintainability

How can the following help programmers ensure the code they write is easy to maintain?

Procedures and functions

A

 Use procedures and functions to:
• Structure the code
• Eliminate duplicate code

21
Q

Producing robust programs

Maintainability

How can the following help programmers ensure the code they write is easy to maintain?
 constants

A

 Use constants declared at the top of a program

22
Q

Producing robust programs

Maintainability

How can the following help programmers ensure the code they write is easy to maintain?
 constants

A

 Use constants declared at the top of a program

23
Q

Producing robust programs

Testing

Four main reasons why a program should be thoroughly tested before being given to a user

A

1) To ensure there are no bugs or errors in the code

2 To ensure the program has an acceptable performance and usability

3) To ensure that unauthorised access is prevented
4) To ensure that the program meets the requirements

24
Q

Producing robust progroams
What are these?
1) To ensure there are no bugs or errors in the code

2 To ensure the program has an acceptable performance and usability

3) To ensure that unauthorised access is prevented
4) To ensure that the program meets the requirements

A

Four main reasons why a program should be thoroughly tested before being given to a user

25
Q

Producing robust programs

Testing
What is Iterative testing?

A

1) Performed when the software is being developed
2) Each new module is tested as it is added
3) Checking new modules do not introduce new errors into existing code
4) Tests to ensure the program handles erroneous data and exceptional situations

26
Q

Producing robust programs

Testing

What is this?

1) Performed when the software is being developed
2) Each new module is tested as it is added
3) Checking new modules do not introduce new errors into existing code
4) Tests to ensure the program handles erroneous data and exceptional situations

A

Iterative testing

27
Q

Producing robust programs

What is Final / Terminal testing?

A

1) Performed when the program is considered complete
2) Testing that all modules work together (integration testing)
3) Testing the program produces the required results with all data types
4) Checking the program meets the requirements with real data, e.g. with a beta test