2.3 Robust Programs
No description yet. This curated deck is ready for daily study.
Card preview (24)
What is Validation ?
Ensuring that any data input is possible and sensible.
What is a range check ?
the input must fall within a specified range.
What is a length check ?
the input must not be too long or too short.
What is a presence check ?
a data value must be entered
What is a format check ?
the data must be in the correct format
What is a type check ?
the data must be of a specified data type
What is a verification check ?
they repeat the entered data to the user and ask them to confirm if this data is correct.`
What is authentication ?
the process of a user confirming that they are who they say they are on a computer system
What are the 3 factors of authentication?
• something you are - username • something you know - password • something you have - swipe card, biometrics
What is the purpose of defensive design ?
that a program runs correctly and continues to run no matter what actions a user takes.
What are the 3 areas of defensive design?
• protection against unexpected user inputs • maintainability • minimising/removing bugs
How are anticipation and protection applied ?
• validation • sanitisation -authentication -maintenance • testing
What is the purpose of maintainability ?
to ensure that, over time, a program can be easily maintained.
How to increase maintainability ?
• Using comments • Using naming conventions • Using indentation
What are comments ?
Lines in programs that provide information about what the different parts of the program do.
What are naming conventions ?
Choosing a variable name that reflects the purpose of the variable.
What is Indentation ?
Code within selections or iterations should be indented
What are subprograms ?
small programs that are written within a larger, main program.
What are the two types of subprograms ?
• procedures • functions
What are the benefits of subprograms ?
• small in size - easier to write, test and debug • can be saved separately as modules - used again in other programs • may be used repeatedly at various points in the main program.
What is a procedure ?
A procedure is a subprogram that performs a specific task
How is a procedure run ?
A procedure is run by calling it.
What is a function ?
works in the same way as a procedure, except that it manipulates data and returns a result back to the main program.
How is a function run ?
A function is run by calling it.