Robust Programs Flashcards
What is Input Validation?
Checking that data input by the user meets specific criteria/rules before processing.
Input validation ensures that user input is safe and meets predefined standards.
What does Type Check verify?
Whether the input is an integer, real, or string.
Type checking helps prevent errors by ensuring the data type is appropriate for processing.
What is the purpose of a Range Check?
To determine if an input is within the correct range.
Range checks are crucial for numeric inputs to prevent out-of-bounds errors.
What does a Presence Check confirm?
Whether any data has actually been input.
Presence checks are important to ensure that required fields are not left empty.
What is the goal of a Format Check?
To verify if the input is in the correct format.
Format checks can include validating email addresses, phone numbers, and other structured data.
What does a Length Check assess?
Whether the input includes the correct/minimum/maximum number of characters.
Length checks help ensure data integrity and adherence to specifications.
What is meant by Anticipating Misuse in defensive design?
Planning for contingencies, such as preventing division by zero in a calculator.
This approach ensures that programs can handle unexpected user actions gracefully.
What should a program do in case of a Communication error?
Be prepared for the connection to drop, showing an error message or letting the user cancel.
Handling communication errors improves user experience and reliability.
What are Peripheral errors?
Issues where peripherals do not work, prompting an error message.
Programs should account for hardware failures to maintain functionality.
What should a program do to handle Disk errors?
Check files before using them and show an error if they are unusable.
Disk error handling is crucial for data safety and program stability.
What is the purpose of Authentication in programming?
To protect the program from online bots using software like reCAPTCHA.
Authentication mechanisms enhance security and prevent automated misuse.
What are the key aspects of maintainable code?
Comments, white space, indentation, descriptive variable names, and structured procedures/functions.
These practices improve readability and ease of updates.
What should comments in code explain?
The program’s purpose and sections of code (selections, iterations, procedures).
Clear comments help other developers understand the code’s functionality.
Why is white space important in code?
It makes program sections easier to see.
Proper use of white space enhances readability and organization.
What is the role of indentation in programming?
To visually separate selection and iteration branches.
Indentation is crucial for understanding code structure and flow.
What should descriptive variable names do?
Explain each variable’s purpose with a comment when declared.
Meaningful names improve code clarity and maintainability.
What are procedures and functions used for in code?
To structure code and eliminate duplicate code.
They help organize logic and enhance reusability.
What are constants in programming?
Values declared at the top of the program.
Constants provide clarity and prevent magic numbers in the code.
What is Iterative testing?
Testing each new module as it is written and checking program branches for functionality.
This approach helps catch errors early in the development process.
What does Terminal testing involve?
Testing that all modules work together (integration testing).
Integration testing ensures that individual components function as a cohesive whole.
What is checked during Terminal testing?
That the program produces required results with normal, boundary, invalid, and erroneous data.
Comprehensive testing ensures robustness against various data types.
What is the purpose of a beta test?
To find more errors before final release.
Beta testing allows real users to identify issues that may not have been caught during earlier testing phases.