- •I. What is a computer?
- •II. Glimpses of history development of the transistor
- •The transistor and the computer. The computer's miniaturization
- •Planar technology
- •Integrated microcircuits come in
- •Microelectronics makes rapid progress
- •Birth of the microprocessor
- •Speedier semiconductor chips
- •III. The computer principles, structure and operation binary system
- •Logic circuits
- •Microelectronic memories
- •Using the computer
- •Data structures
- •Input. Process. Store, output
- •Output — video and printing devices
- •Video Terminals
- •IV. The computer's software programming a computer
- •Programming languages
- •Program development
- •Input Requirements
- •Table 5. Program Containing an Error
- •VI. Microcomputers in industry. Robotics machine tools5
- •Process control
- •Inspection and measurement
- •Robotics
- •The robot's nervous system
- •Robots in industry
- •VI. Educational applications of microelectronics computers on wheels
- •The computer teaches painting
- •A talking abc-book
- •VII. Computers all around us
- •Viewdata6
- •Integrated work station3
- •Multiple-fare meter2
- •Shade for the eyes. Music for the ears
- •Computer in a wristwatch
- •Talking watch
- •The doll talks
- •Pocket-size lie detector
- •Electronic watchman
- •Shock treatment2 for thieves
- •Passport for the electronic age
- •Illustrated copying instructions
- •Plain-speaking home robot
- •Touchy calculator
- •Optical discs: thanks for the memory
- •VIII. Computers at their best data base management systems'
- •Computer languages
- •The computer acquires intelligence
- •5 Whose syntax and structure lend themselves to interactive use — синтаксис и
- •Translation by computer
- •Enter the intelligent computer
- •Computers with intelligence
- •"Aesculapius"2 diagnoses the case
- •A smarter way to fly
- •Computer-controlled irrigation
Program development
. i If a program is written too hastily, valuable time may be
lost subsequently in implementing the necessary changes. Time spent pre-planning is seldom wasted. Commercial systems designers and programmers are expected to conform to2 a specific formal procedure. In developing your own programs, you need to exercise self-discipline.
The first step is to ensure that you understand what you intend or are required to do. Are the terms of reference3 clear? This might mean that you need to check the meaning of any terminology or jargon used. You may also need to ensure you understand the mathematical notation used to specify any relationships involved. Thus, initially, some research or background reading4 may be necessary when you know what you want to do, but are not sure of the method to be used.
Designing Output
The starting point of designing a program should be the output. You need to consider and make decisions on the following aspects.
The output from a program may be printed and/or written to a file.5 Is your output going to be solely printed, written to a file or a mixture of both? This leads on to deciding precisely what is to be printed and what is to be written to the file.
For example, your intention may be to write a program to read a stock data file" and produce a list of items to reorder. Given, for the moment, that7 a program can be written to identify the items to be reordered, you need to consider: should the output be solely a printed list or should a reorder file be produced that
' speed advantages — преимущество в скорости
2 are expected to conform to — ад. должны составлять программы в соответствии с
3 terms of reference—упоминаемые термины
4 some research or background reading—определенный объем предварительного
ш”;жомления и изучения
may be.,, written to a file — может быть внесен в файл '' to read a stock data file —для считывания файла данных (о товарных
клипсах) ' Given, for the moment, that — Скажем, если на данный момент
47
'”
сип be the input to a purchase order program?' If you are going to have a printed list of items to be reordered, what should it contain? Should it list the complete stock record of eaclr item or, the other extreme, should it just be a list of stoci/ code numbers? /
Having decided what is to be output, it is then necessary to consider-the format and general layout. The considerations to be made are:
In which columns are the variables to be printed?
Are column headings necessary?
Are main headings necessary?
What spacing is required between headings?
Should headings be underlined?
Input Requirements
Once the output details have been decided, you can then identify the necessary input. If a large amount of data is to be processed, it may be advisable to read it from a data file. If the data is solely associated with the one program, it can be incorporated in DATA statements, while data that varies from run to run2 is best entered via INPUT statements.
You may not be the only person using the program and this is a factor to be considered. Ample print messages should be provided, giving guidance, if necessary, as to the input required.
A further aspect of the input design is the desirability of providing some form of control over the program during run time.
Flowcharting3
Once you have a broad idea of4 your requirements, the logical sequence of the program statements needs to be developed. This can be done by drawing a flowchart. The more common symbols used in flowcharts are shown in Figure 7.
' that could be the input to a purchase order program — который может служить
в качестве входных данных для программы заказа на покупку . s varies from run to run — изменяется от одного рабочею цикла ЭВМ к другому
3 Flowcharting — Построение блок-схемы (схемы потока информации)
4 Once you have a broad idea of— Теперь, когда у вас Сложилось общее представление о
48
Use
At the start and end of processing
To represent a stage of processing
Conditional test leading to up to
three alternative paths'
Input or output statements
Connector, allowing chart
to be continued at matching connector A2
Figure 7. Some flowchart symbols
The purpose of a flowchart is to ensure the logic is correct before becoming involved with3 the details of individual program statements.
On occasions it becomes apparent from the flowchart or analysis of the problem that a similar calculation will be repeated several times in the program. When a simitar set of program statements is likely to be required in several parts of the program, this may indicate the possibility of writing them once only as a subroutine and using this routine several times over4
Having drawn flowcharts, the next stage is writing the program. When the program has been written, you still have not finished. A very important part of producing useful programs is to ensure
' leading to up to three alternative paths—ведущий не менее чем к трем альтернативным путям доступа
2 allowing chart to be continued at matching connector A — позволяющий продолжить схему в месте подключения соединителя А
3 before becoming involved • with --прежде чем вы перейдете к (he possibility of... using this routine several times over — возможность... многократного использования этой программы
49
Figure
8.
Flowchart lor average of three numbers
to test every instruction in your flowchart).
that they perform as
intended,' antf the next section discusses the testing and
documentation of your programs./
лл
Program Testing
If you make a mistake in
the use of the BASIC language, your computer will detect this and
output a message to tell you that there is a syntax error in your
program. Examples of typical syntax errors are: mistakes in spelling
(e. g- IPUT instead of INPUT), wrong instruction formats3
(e. g-LET X
+ Y
= S instead
of LET S -
X + +Y),
and unacceptable variable names (e. g. 2A instead of A2). You must
, clear all
the syntax errors before you proceed.
Your program may still be
incorrect after the syntax errors have been cleared. You may get an
execution error caused by asking your computer to perform an action
which it cannot do. For example, if values are calculated by your
program which are either too small or too large you will get
arithmetic overflow (this will happen when dividing by zero).
A program which runs
successfully, without an execution error occurring,3
may
still give the wrong results because the logic of the program is
incorrect. You should work through your flowchart and
/ or program
instructions with typical data before running the program on your
computer (this is known as performing a dry-run4).
Then run the program on your computer with this typical data; this
should be designed path in the program (i. e. every branch
' that they perform as intended - чтобы они nriw4,i,iiii пюгму нп:ш;1Ч1.'иию
;' instruction format формат команды
' witlmiit an... error occurring - без ошибок
' tiry-ruii прокрутка (прогин)
Some programming mistakes may still slip through' even if you carry out a dry-run, particularly if the program's logic is complicated. You may find the "bugs"2 in your program by initiating a trace through it3 during execution. The TRON command (entered before RUN) causes each line number in -the program to be displayed as it is executed. The line numbers are shown in square brackets and will indicate the instruction path followed by the program. The trace is turned off by the TROFF command or when NEW is used. For extensive debugging, you can include TRON and TROFF as statements in your program, and remove these once the program has been debugged.