1/42
defensive design, maintainability, testing, syntax and logic errors and refining
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
input validation (defensive design)
checking data input by user meets criteria before processing
type check
if input is correct data type
range check
if input is in correct range
presence check
data has been entered
format check
if input is in correct format
length check
if input has correct number of characters
look-up table
checks data against table of acceptable values
verification
data entered twice
anticipating misuse:
division by 0
ALU cannot compute this
division by 0 correct code
if num !=0:
average=total/num
else:
print("No score enterred")
communication error
when connection to host server is dropped, unable to be established or server is overloaded
what can happen to program in communication error
program could crash or hang
what programmer should do in communication error
allow user to cancel requests or report connection error
program may be able to resume when connection available again
printer and other peripheral errors
if program outputs hardcopy and printer runs out of paper/ink or jams
what programmer should do in printer error
programmer should have option to reprint
disk errors:
programs that read and write files have to deal with
file/folder not being found
disk being out of space
data in file being corrupt
end of file being reached
disk errors:
how programs deal with this
checking file and data before further processing
authentication
data must be secured
methods of authentication
username and password to access systems
recovering password by clicking link withing email that is sent to registered address
encrypting data files
reCAPTCHA
protects against online bots automatically submitting data to online forms
verifies if user is human
what programmer should be aware of in authentication errors
SQL injection hacks
maintainability
maintaining code to be clear for group work or editing said code in future
using comments for maintainability
explain purpose of program
explain sections of code
explain unusual approaches that were necessary
visually divide sections of program
using white space for maintainability
make sections of programs easier to see
using indentation for maintainability
use it for every selection and iteration branch
using procedures/functions for maintainability
structure code
eliminate duplicating code
using descriptive variable names and constants for maintainability
reasons for testing
ensure there are no errors
check program has acceptable performance and usability
ensure unauthorised access if prevented
check program meets requirements
iterative testing
each module tested as it is written
branches checked for functionality
checks new modules dont introduce new errors
tests to ensure program handles erroneous data and exceptional situations
when iterative testing performed
whilst software is being developed
final/terminal testing
tests all modules work together
tests program produces required results with normal, boundary, invalid and erroneous data
checks program meets requirements with real data
beta test may find more errors
when final/terminal testing performed
when program finished
syntax error
rules of language have been broken and program cannot run
why syntax errors happen
variables not declared before use
incompatibility of variable types
using assignments incorrectly
spelling mistakes
logic error
program runs but does not give expected output
why logic errors happen
conditions and arithmetic operations are wrong
sequence of commands is wrong
division by zero
exceptions
suitable test data
normal
boundary
invalid
erroneous
normal input
accepted data
boundary input
data on edge of accepted value range
invalid input
data outside of range
erroneous input
incorrect data type
no input
ways of refining code
writing code anticipating range of inputs
making sure bad data doesnt crash program
making sure prompts to user are descriptive
making sure only correct data type entered
checking and handling missing data
example of refining code
simple exception handling commands