Lesson 3. Stages in programming 


Мы поможем в написании ваших работ!



ЗНАЕТЕ ЛИ ВЫ?

Lesson 3. Stages in programming



I. Read and memorize the following words and word combinations:

precisely — точно

over-all plan — общий план

flow chart — блок-схема

actual coding — текущее кодирование

to detect/ correct errors — выявлять/ исправлять ошибки

to invalidate — сводить на нет

without loosing sight — не упуская из вида

variable connector — переменный соединитель

to eliminate — устранять

statement — высказывание

II. Read and translate the text.

There are five stages in programming. First, the computations to be performed must be clearly and precisely defined. The over-all plan of the computations is diagrammed by means of a so called flow chart. The second stage is the actual coding. It is often best to write a code in terms of a symbolic language first, for then changes are easily made. Numbers are assigned to the symbols, and the final code is prepared. In the third stage some procedure is used to get the code into the memory of the computer. The fourth stage consists in debugging the code, i.e. detecting and correcting any errors. The fifth, and the final stage, involves running the code on the computer and tabulating the results. In fact, it is well known that a single error in one instruction invalidates the entire code. Hence, programming is a technique requiring attention to details without loosing sight of the over-all plan.

Flow chart is a diagram, or picture, of a code that is often helpful for visualizing interrelationship between various parts of a code. Such a diagram is almost always made before the specific instructions are written. There are essentially three kinds of symbols used in a flow chart (see Fig. 1). The first represents function calculations, the second represents decisions and the various associated alternatives, the third, called a variable connector, is simply a way to eliminate too many crossing lines in the picture or to indicate which lines to follow when one has to continue the diagram on another page.

 

 

Figure 1. Flow chart symbols

 

Symbolic Coding Aids. It is another intermediate aid between the statement of the problem and the final code. Symbolic coding consists in writing a code not in terms of specific numerical addresses, but rather in terms of some name description or other symbolism to represent the addresses. Then at a later time, specific addresses can be assigned for these symbols, or names, to produce the actual code. The intermediate code in terms or symbols is called the symbolic code. This technique is extremely useful particularly in those cases where one must write instructions involving addresses of constants or of other instructions that have not yet been specially assigned.

Notes

The over-all plan of computations — общий план вычислений; numbers are assigned to the symbols — цифрам присваиваются символы; various associated alternatives —- различные взаимодействующие альтернативы; symbolic coding aids — вспомогательные средства символьного кодирования; technique is extremely useful — технический прием чрезвычайно эффективен.

IV. Give the Russian equivalents.

Programming, computations, the over-all plan, flow chart, numbers, debugging, running the code, tabulating the results, instruction, interrelationship, calculations, decisions, variable connector, intermediate aid, numerical addresses, to write instructions.

V. Give the English equivalents.

Программирование, вычисления, общий план, блок-схема, числа, отладка (программы), прогон программы, сведение результатов в таблицы, команда, соотнесенность, вычисления, решения, переменный соединитель, промежуточная поддержка, числовые адреса, писать команды.

 

VI. Fill in the blanks the appropriate form of the word-combinations from the box.

To be useful; to represent; to be assigned; to be diagrammed; to be called; to be prepared; to write

 

1. The over-all plan of computations ____ by means of a so called flow chart. 2. Numbers ____ to the symbols, and the final code____. 3. The first _____ calculations, decisions and alternatives. 4. The intermediate code in terms of symbols ____ the symbolic code. 5. The technique ____ extremely ____ particularly in those cases where a person must____ instructions.

 

VII. Answer the following questions.

1. How many stages are there in programming? 2. What are they? Characterize them. 3. What can we see on the diagram? 4. How many symbols are used in the flow chart? Comment on them. What is the purpose of making diagrams? 5. What do we mean by Symbolic Coding Aids? 6. What is the intermediate code? 7. What is in common between symbolic and intermediate coding? 8. In what cases is symbolic code extremely useful?

 

VII. Give a brief summary of the above text.

Lesson 4. Programs

I. Read and memorize the following words and word combinations:

to translate programs — переводить программы

to accomplish — выполнять

to schedule — составлять, намечать

resident — резидентная часть программы

common names — общие названия

supervisor — программа-распределитель

execution — выполнение

to sort data — сортировать данные

linkage editor — программа «Редактор связей»

II. Read and translate the text.

The operating system is a collection of programs provided by the manufacturer of computer that allow us to translate symbolic programs into machine code, to schedule the jobs the computer is to perform, and to use the computer effectively.

All symbolic programs must be translated to machine code before their instructions can be understood by the control unit. This translation is accomplished through the use of a program called a language processor.

A control program is an operating system with the purpose of controlling the computer. It schedules the activities of the computer and watches over other programs as they run. In order to be able to control the computer, the control program is a main-memory resident, i.e. it is always in the main memory. Control programs go by different names. Common names for control program are supervisor, monitor, executive or, simply, control program.

Service programs are programs that are used to prepare object programs for execution, to store programs on a magnetic disk, and to sort data recorded on secondary storage devices. The first function is provided by a service program called the linkage editor.

The area on a magnetic disk that is used to hold program is called a library. The service program that adds and deletes programs from the library is the librarian.

A third set of service programs is utilities. They provide a means of copying data from any input device in the system and an easy means of moving data files from one secondary storage device to another. The utilities also may be used to print the contents of a file on the line printer.

In most computers, individual instructions are stored as machine code with each instruction being given a unique number (its operation code or opcode for short). The command to add two numbers together would have one opcode, the command to multiply them would have a different opcode and so on. The simplest computers are able to perform any of a handful of different instructions; the more complex computers have several hundred to choose from — each with a unique numerical code. Since the computer’s memory is able to store numbers, it can also store the instruction codes. This leads to the important fact that entire programs (which are just lists of instructions) can be represented as lists of numbers and can themselves be manipulated inside the computer just as if they were numeric data. The fundamental concept of storing programs in the computer’s memory alongside the data they operate on is the crux of the von Neumann, or stored program, architecture. In some cases, a computer might store some or its entire program in memory that is kept separate from the data it operates on. This is called the Harvard architecture after the Harvard Mark I computer. Modern von Neumann computers display some traits of the Harvard architecture in their designs, such as in CPU caches.

While it is possible to write computer programs as long lists of numbers (machine language) and this technique was used with many early computers, it is extremely tedious to do so in practice, especially for complicated programs. Instead, each basic instruction can be given a short name that is indicative of its function and easy to remember — a mnemonic such as ADD, SUB, MULT or JUMP. These mnemonics are collectively known as a computer’s assembly language. Converting programs written in assembly language into something the computer can actually understand (machine language) is usually done by a computer program called an assembler. Machine languages and the assembly languages that represent them (collectively termed low-level programming languages) tend to be unique to a particular type of computer. For instance, an ARM architecture computer (such as may be found in a PDA or a hand-held videogame) cannot understand the machine language of an Intel Pentium or the AMD Athlon 64 computer that might be in a PC.

Though considerably easier than in machine language, writing a long program in assembly language is often difficult and error prone. Therefore, most complicated programs are written in more abstract high-level programming languages that are able to express the needs of the computer programmer more conveniently (and thereby help reduce programmer error). High level languages are usually “compiled” into machine language (or sometimes into assembly language and then into machine language) using another computer program called a compiler. Since high level languages are more abstract than assembly language, it is possible to use different compilers to translate the same high level language program into the machine language of many different types of computer. This is part of the means by which software like video games may be made available for different computer architectures such as personal computers and various video game consoles.

Notes

To schedule the jobs the computer is to perform – планировать задания, которые компьютер должен выполнить; object programs – конечные программы; line printer – линейный принтер; crux of the von Neumann - основная проблема фон-неймановской (вычислительной) архитектуры, основанной на концепции хранимой программы и последовательных вычислений

III. Give the Russian equivalents.

The operating system, collection, to translate symbolic programs, to schedule the jobs, machine code, the control unit, language processor, activities of the computer, main-memory resident, supervisor, control program, service programs, object programs, to store the programs, to sort data, secondary storage devices, linkage editor.

IV. Give the English equivalents.

Операционная система, набор, переводить символьные программы, составлять порядок заданий, машинный код, блок управления, языковой процессор, возможности компьютера, резидентная часть программы основной памяти, программа-распределитель, программа управления, сервисные программы, изучаемые программы, хранить программы, сортировать данные, устройства вторичной памяти, программа «Редактор связей».

 

V. Fill in the blanks with the appropriate form from the box.

Is used to schedule is called provide must be translated is

1. The operating system ___a collection of programs. 2. All symbolic programs ___to machine code. 3. A control program ___the activities of the computer. 4. They are on a magnetic disk that ___to hold program ___a library. 5. Utilities ___a means of copying data from any input device to any output device in the system.

VI. Answer the following questions.

1. What is the operating system? 2. Why does it exist? 3. Why must all symbolic programs be translated to machine code? 4. What is a control program? 5. What is the purpose of a control program? 6. What are service programs? 7. What do we call a magnetic disc that is used to hold programs? 8. What are utilities? 9. What is the crux of von Neumann architecture? What do you know about the Harvard architecture? 10. What are mnemonics? 11. Why are complicated programs written in abstract high-level languages? 12. What is the purpose of using a compiler? 13. Is it possible to use different compilers?

 

VII. Speak on the sets of programs comprising the OS..

VIII. Read the text and translate it into Russian without a dictionary. Write a short summary of it.

Program errors

So long as computers are programmed by human beings, computer programs will be subject to errors. It is programmer’s responsibility to find errors and correct them. The process of finding and correcting errors or bugs as they are often referred to is called testing and debugging. Testing and debugging can be difficult and time-consuming, but the ability to detect and correct programming errors is one of the most important capabilities of a good programmer. A program is considered incomplete until the programmer verifies that it performs as required.

Errors in computer programs are called bugs. Bugs may be benign and not affect the usefulness of the program, or have only subtle effects. But in some cases they may cause the program to “hang” — become unresponsive to input such as mouse clicks or keystrokes, or to completely fail or “crash”. Otherwise benign bugs may sometimes be harnessed for malicious intent by an unscrupulous user writing an “exploit” — a code designed to take advantage of a bug and disrupt a program’s proper execution. Bugs are usually not the fault of the computer. Since computers merely execute the instructions they are given, bugs are nearly always the result of programmer error or an oversight made in the program’s design.

There are two main types of bugs in computer programs. These are coding errors and logic errors. Coding errors typically involve incorrect punctuation, incorrect word-order, undefined terms, or misuse of terms. In case of coding errors the language processor is unable to convert the source program to object program and points them out to the programmer by printing error instructions on the source listing, giving thus hints as to the nature of the error. It is a relatively easy task, therefore, to find and correct this type of errors.

The second type of errors, a logic error, is an error in planning the program’s logic. In this case, the language processor successfully translates the source code into machine code, and the computer follows instructions. The problem is that the logic being followed does not produce the results that were desired.

In order to determine whether or not a logic error exists, the program must be run using sample data with known answers. By running the program and comparing the program’s answers to the known answers, the accuracy of the logic plan can be determined.

Logic errors can be avoided through careful planning of the program logic, but it is the programmer’s responsibility to test thoroughly all the program’s functions, in order to verify that the program performs according to specifications.

Notes

Programmer’s responsibility — ответственность программиста; capabilities — потенциальные возможности; benign ― незначительный; subtle ― едва различимый, трудно уловимый; be harnessed ― использоваться; malicious ― злонамеренный; to disrupt ― разрушать, прерывать; undefined terms — неопределенные термины; sample data — образцы (модели) данных, to verify ― проверять.



Поделиться:


Последнее изменение этой страницы: 2021-11-27; просмотров: 43; Нарушение авторского права страницы; Мы поможем в написании вашей работы!

infopedia.su Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Обратная связь - 18.117.72.224 (0.017 с.)