Save
...
Computer Science Paper 2
Topic 3
Defensive Design
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Evelyn Clarke
Visit profile
Cards (12)
Defensive design considerations:
Anticipating misuse
Authentication
Authentication
The process used to test that a
person
is who they
claim
to be.
Anticipating misuse
Every
possible input, however incorrect or creative should be anticipated.
Input validation
Validation is the
checking
of data, on input, to ensure that it is sensible or reasonable. It cannot guarantee that the data is
correct.
Common methods of input validation:
Range check
Type check
Length check
Presence check
Format check
Range check
checks a number or date is within an allowed
range
Type check
checks data is the right
type
such as integer, character or text string
Length check
checks text entered is not too
long
or too
short-
for example, a password is greater than 8 characters
Presence check
checks that
data
has been entered i.e. that a field has not been left
blank
Format check
checks that the
format
of, for example, a postcode or email address is appropriate
Maintainability
A characteristic of defensive design that helps programmers
modify
and
repair
programs
Things that can improve the maintainability of a program:
Use of
sub programs
- can make it easier for other programmers to see how
different
parts of a program works
Naming
conventions- naming a variables, sub programs and parameters to refer to what they are to makes it easier to keep
track
of them
Indentation
- can be used to
separate
different statements in a program
Commenting
- are used for explaining what the
key
feature of a program do
These all help
other
programmers understand the program
better