The phrase “Error Recovery” refers to features, within a computer program, that allow the user the ability to easily change specific data items that have been errantly keyed in without re-entering all of the data. It is a programming concept that is often ignored, especially when we’ve been raised on the squeeze-everything-into-2K mentality. But, assuming we learn efficient programming techniques from using limited RAM, we need to use the memory that we do have to make our programs accessible and usable. An Error Reovery (E.R.) is one of the most effective (after coherent input/display techniques) methods of achieving the goal of software usability. If an end user knows that what he has keyed-in can always be re-entered or altered, this gives them a greater degree of psychological and actual control over the software.
There are 2 primary components of efficient E.R.:
1. That it be accessible at the appropriate times. The user must be able to use it when he is most likely to need it. After program exection is not an appropriate place for E.R. It would serve a function, but not the intended one.
2. That it require few, if any, additional keystrokes either to access this feature, or bypass it. If it interrups or substantually slows the data entry process, it becomes counterproductive. Ideally, if it is desirable to notice the E.R., it would require a single keystroke to bypass, and if it is desirable to have the E.R. go unnoticed, it would require a single keystroke to access the feature.
The simplest form of E.R. (we’ll look at a more difficult one later) would allow changes to each entry only immediatly after they were keyed-in. This would be helpful for errors made by too-quick hands that are recognized immediatly. In the following short example the two pieces of data can be entered normally, but if the 1st is entered incorrectly, hitting the return (enter) without entering the 2nd piece of data will move the program back to the initial entry. If this technique was used with a long series of data entrys, you could actually step back through all the data.
8000 LET X=1
8005 PRINT AT X+1,0;" "
8010 PRINT AT X,0;"SPAN OF BEAM?"
8015 INPUT S$
8020 PRINT AT X,25;S$;" "
8030 LET X=2
8035 PRINT AT X,0;"UNIFORM LOAD?"
8040 INPUT U$
8045 IF U$="" THEN GOTO 8000
8050 PRINT AT X,25;U$;" "
9799 STOP
If the second entry is null (no data), line 8045 sends the program back a step to 8005 which blanks out the second data inquiry as it returns to the first.
This type of E.R., though, is limited in scope. It serves a useful purpose for a very specific type of error, but as the only E.R. it can be awkward. Its exclusive use would force the user to check his/her overall data after each entry, even if it is entered correctly. This much mental jumping around is annoying and defeats the purpose of the E.R. feature: to facilitate use of your software.
The most natural time to check data for inconsistencies is when the program data (or a subset of the data) has been imput into the computer and is displayed on the screen. At this point the mental tendency is to scan the information for errors. If all of that information is easily accessible, the control that has been gained is enormous. It allows the data entry process to be quick and efficient, with access to all of the information for review and correction.
Access to all screen information presupposes an organized input/display format, because if there is no structure to the way the data are stored/displayed, the programming becomes hopelessly inefficient. In the December ’83 issue of TS Horizons I presented this idea of a structured display under the name Matrix/Cursor Input. Now, at the risk of losing those of you who have not read that article, I’d like to dredge up the programming example that I used and expand it to include a comprehensive E.R. capability.
ROOM:LIVING
GLASS DATA 1 2 3 4
AREA(SQFT) 1024 572 544 750
DEG.HORIZ. 90 90 75 9
DEG.REF.< 10 55 10 -80
OVERHANG 24 24 0 24
WINDOW HT. 72 48 72 72
HEAD TO OH 8 8 0 8
NO.GLAZNGS 2 2 2 2
ERR?
The data in that example is input by columns, with a set of seven data items filling up the column before moving to the second column. When the last item is entered into the data set, the question “ERR?” is printed 2 lines below in order to prompt the user to review for errors. If there are none, hitting the “N” key only (no return) will continue the program. But the “Y” key will place a cursor adjacent (on the left) to the data item at the top of the column. You may then step down the rows of data with the “RETURN” key, entering data only where the mistake was made. The “ERR” will continue to appear after each data correction until you leave that mode with the “N” key.
The first half of the following listing (lines 4000-4195) is from my article MATRIX/CURSOR INPUT which carries a detailed explanation of that section. You can obtain a copy (Dec.’83) by sending the cover price to TS Horizons. The E.R. is nested inside the second (outer) loop (lines 4200-4275), and comes into play at the bottom of each column of the seven-row, four-column matrix.
VARIABLES
I(4,7) - array that stores all glass data.
Y - print position variable that indicates
column
X - print position variable that indicates
row
NO - number of glass areas
N - loop variable, indicating which column is
operating.
B$ - Alphanumeric variable to read-in
single-key entrys.
4000 REM MATRIX/CURSOR
4050 DIM I(4,7)
4060 LET Y=8
4080 PRINT AT 0,0;"ROOM:LIVING"
4090 PRINT AT 2,0;"NO.OF GLASS AREAS?"
4095 LET B$=INKEY$
4097 LET NO=CODE B$
4100 IF NO<29 OR NO>32 THEN GOTO 4095
4105 PRINT AT 2,0;"GLASS DATA "
4110 PRINT AT 4,0;"AREA(SQFT)"
4115 PRINT "DEG.HORIZ."
4120 PRINT "DEG.REF.<"
4125 PRINT "OVERHANG"
4130 PRINT "WINDOW HT."
4135 PRINT "HEAD TO OH"
4140 PRINT "NO.GLAZNGS"
4150 FOR N=1 TO NO
4155 LET Y=Y+5
4160 PRINT AT 2,Y;N
4165 FOR X=1 TO 7
4170 PRINT AT X+3,Y;" "
4175 PRINT AT X+3,Y;"?"
4180 INPUT I(N,X)
4185 IF I(N,X)>=10000 THEN GOTO 4170
4190 PRINT AT X+3,Y;I(N,X)
4195 NEXT X
4200 PRINT AT X+4,Y-1;"ERR?"
4205 LET B$=INKEY$
4207 IF B$="" THEN GOTO 4205
4210 PRINT AT X+4,Y-1;" "
4215 IF B$="N" THEN GOTO 4295
4220 LET X=0
4225 GOTO 4235
4230 PRINT AT X+3,Y-1;" "
4235 IF X=7 THEN GOTO 4270
4240 LET X=X+1
4245 PRINT AT X+3,Y-1;"?"
4250 INPUT B$
4255 IF CODE (B$)=0 THEN GOTO 4230
4260 LET I(N,X)=VAL B$
4265 PRINT AT X+3,Y-1;" ";I(N,X);" "
4270 LET X=8
4275 GOTO 4200
4300 NEXT N
REMARKS on the PROGRAM LISTING
4200: print ERR? message
4205: read in keystroke for
single-key (Y or N) entry
4207: if B$ null, continue scan
4210: blank out ERR? message
4215: if "N" key is depressed,
bypass error recovery
4220: start E.R.loop with X at 0
4225-4230: blank out cursor from
line above, except first
time through. It could in-
terfere with headings on
that line.
4235: bottom of E.R. loop
4240: increment X
4245: print cursor adjacent to
data item to be changed
4250: input new data
4255: if no new data, blank out
cursor and move to next
data item
4260: place new data into array
4265: overwrite cursor and old
data (and any trailing
digits) with new data
4270: reset X to max. for ERR?
message
4275: return to ERR? message
4300: bottom of loop
As an even more complex alternative, you could write an E.R. feature that accesses the whole matrix at the end. The important point to emember is that you’re trying to make the software easy to access, so the E.R. has to be located where it is needed. Location, Location, Location as they say in real estate. This can get us beyoud just elegant programming, into software that’s elegantly easy to use.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.