130
The
VIC
20
User
Guide
Data
Entry
(Input)
Data
entry should be programmed in functional units. A mailing list
program, for example, requires names and addresses to be entered as data.
You should treat each entire name and address as a single functional unit
rather than separate
data
items. In other words, your program should ask
for the name and address, allowing the operator to enter all of this informa-
tion and then change any
part
of
it. When the operator is satisfied
that
the
name
and
address are correct, the program should process the entire name
and address. The program should then ask for the next name and address.
It
is
bad programming practice
to
break
data
input into its smallest
parts.
In
a mailing list program, for example, it would be bad programming
practice to ask for just the name, process this data as soon as it
is
entered,
and then ask for each line
of
the address, treating each piece of the name and
address as a separate functional unit. This approach makes programs diffi-
cult to change and also renders them less readable.
The goal of any
data
entry program should be
to
make it easy for
an
operator to spot errors and to give the operator as many chances as possible
to fix them.
PROMPTING
MESSAGES
Any program that requires data entry should prompt the operator by
asking questions. Questions are usually displayed on a single line and
require a simple response such as "yes'"
or
"no."
For
example, a prompt
message such as ANY CHANGES
(Y
OR
N)? would clearly indicate the
question and the available choices.
An operator responds
to
this message by pressing the Y
or
N key. Good
programming practice dictates
that
entries other than Y
or
N not be
accepted.
If
the operator replies Y to the ANY CHANGES prompt, another
prompt will display, such as WHAT ENTRY LINE TO CHANGE (1-6)? In
this case, one of six entry lines could be changed; all the operator needs to do
is
enter the number corresponding to the line that was entered in error. Of
course, with this approach each entry line
on
the display should have
an
identifying number.
This type of
data
entry should be written in subroutines, so the main
program
is
not clogged up with prompting messages. Also, because a limited
number
of
choices
is
allowed, a subroutine could contain the logic necessary
to check the entry against permitted responses.