Save
...
compsci
compsci 2024
defensive design
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Dion
Visit profile
Cards (4)
anticipating misuse
a programmer must try to make sure that what a user enter will not crash / give incorrect result
eg. giving the user requirements and 3 tries before it stops
authentication
routines
to make sure user is
who they say they are
eg optical, facial, fingerprint
recognition
assigned to a user ID and
password
the
password
is
encrypted
and
saved
in a
file
when you enter ur user ID the encrypted
password
is
looked up
and
compared
to the one stored
input validation
to make sure program doesn't crash do smth
unexpected
range check
: number / date within sensible range
type check
: data is right type
length check
: text not too long / short
presence check
: checks data has been entered
format check
: checks format of eg postcode / email is appropriate
verification check: eg. re-entering a password to check if user typed in what they intended
maintainability - making program code understandable
subroutines: easier to locate the code so it can be amended if required without affecting the rest of the program
aim for clarity rather than clever code which is difficult for someone else to understand
meaningful variable names
use conventions such as camelCase
indentation so it's clear where statements within an iteration starts and ends
comments: who wrote the program, date, purpose and explanation of code and variables