Apple Basic Data File Programming 1982
From the originals
13 scansMachine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.
These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.
PDF page 12
WRITING BASIC PROGRAM~ FOR CLARITY, READABILITY, AND LOGIC 3
WRITING BASIC PROGRAM~ FOR CLARITY, READABILITY, AND LOGIC 3 This chapter discusses a program format that, in itself, is a conservative programming technique. One reason for conservative programming is that your programs will be more portable or transportable to ·other computers. ''Why should I care about portability?" you ask. Perhaps the most important reason is that you will want to trade programs with friends. But do all of your friends have ·a coinputer IDENTICAL to yours? Unless they do, they will probably be unable to use your programs without modifying them. Conservative programming. techniques will minimize the number of changes required.. Portability is also important for your own c9nvenience. The computer you use or own today may not be the one you will use one year from now; you may replace or enhance your system. In order to use today's programs on tomorrow's computer be conservative in your programming. Use conservative programming to: • Isolate and locate errors more easily. • Avoid software "glitch." • Enhance portability. WRITING READABLE PROGRAMS Look at the sample programs throughout this book and you will see that they are easy to read and understand because the programs and the individual statements are written in simple, straight-line BASIC code without fancy methodology or language syntax. It is as if the statements are written with the READER rather than the computer in mind. Writing readable BASIC programs requires th.inking ahead, planning your program in a logical flow, and using a few special formats that make the program listing easier to the eye. If you plan to program for a living, you may find yourself bound by your employer's programming style. However, if you program for pleasure,. adding readable style to your programs will make them that much easier to debug or change later, not to mention the pride inherent in trading a clean, readable program to someone else . .A readable programming style provides its own documentation. Such self- documentation is not only pleasing to the eye, it provides the reader/user with suffi- cient information to understand exactly how the program works. This style is not as · precise as "structured programming," though we have borrowed features usually promoted by structured programming enthusiasts. Our foniza.t organizes programs in MODULES, each module containing one major fu.nction or program activity. We also include techniques long accepted as good programming, but for some reason forgotten in recent years. Most of our suggestions do NOT save memory space or speed up the program nin. Rather, readability is our primary concern, at the expense of memory space. Later in this chapter, we will present some procedures to shorten and speed up your programs. Modular style programs wiiI usually be better running programs and will effectively communicate your thought processes to a reader.
Reading notes: Possible OCR errors such as '·a coinputer', 'Our foniza', 'nin' and 'wiiI'. Reading order of heading and running text may be uncertain.
- Printed product names
- BASIC
- Languages
- English