Defensive Design (Robust Programs) Flashcards
What is meant by defensive design?
Making programs more robust/stronger using maintainability features such as verification, validation and error handling.
What is meant by “maintainability”?
The ease with which the source code can be understood, modified, and extended over time by developers.
How easy it is to read the code
What is verification?
Verification refers to the process of confirming whether something is true.
What is validation?
Checking that the data entered is valid/as expected.
What is data validation?
Ensuring that user-provided data is in the correct format or falls within acceptable ranges
What is input validation?
Verifying that the input provided by the user or from external sources is valid and safe to use.
What is file validation?
Checking if a file exists, is accessible, or has specific properties before performing operations on it.
What is password verification?
Checking if a password meets specific criteria, like length, containing certain characters, or fulfilling complexity requirements. (CW: 8 characters - capital letter, number (not consecutive numbers).
What is error handling?
Handling and logging errors helps to identify and resolve issues more efficiently.
What is the purpose of testing?
Maintainable code often comes with comprehensive testing (iterative - during and terminal - at end).
What is modularity?
Code should be organised into small, independent modules or functions to make development easier.
What is the purpose of comments?
Well-documented code includes clear explanations of the purpose, describes what the code does.
What is exception handling?
Exception handling in Python allows you to handle errors and unexpected situations that may occur during the execution of a program.
What syntax is used for exception handling in Python?
The basic syntax for exception handling in Python uses the ‘try’, ‘except’, ‘else’, and ‘finally’ blocks.