BBC Basic debugging
We look at debugging your programs and set a number of debugging tasks.
The aim of the debugging tasks is to acquaint the programmer with common (and not so common) errors.
This will enable you to develop and streamline your own debugging processes and to adopt a logical approach to error tracking.
Most common bugs are either small typographical errors or logical oversights.
Some bugs break the logical flow of a program and lead to undesired results
or unpredictable behaviour.
A pre deployment testing phase should track and highlight these errors before code is declared finished.
Other bugs are more serious and prevent the program from running.
A logical approach to debugging BBC basic will save lots of time and frustration and help to prevent errors cropping up in future programs.
The examples given will help you to avoid making some of these errors in the first place and thereby make for less debugging in the long term. But remember – bugs WILL occur.
Programming is sometimes referred to as the art of removing bugs.
A$=”The end”
PRINT MID$(A$) Missing ,
PRINT MID$(A$,5 Missing )
F=OPENIN(“Stock”)
PRINT#F,”Envelopes” Access denied
PRINT Price No such variable
A=5:B=5
X=487/(A-B) Division by zero
The red error messages above are very helpful.
However, there are many cases when there aren’t any error messages
but the program keeps producing the wrong output.
This is because the logic of the program is wrong (even though the syntax is correct) and these errors are much harder to find.
You will be given plenty of practice at finding them!!
