计算机专业英语(第2版)
上QQ阅读APP看书,第一时间看更新

Unit 3

Text Program Design

1.Program

In computing,a program is a specific set of ordered operations for a computer to perform.In the modern computer that John von Neumann outlined in 1945,the program contains a one-at-a-time sequence of instructions that the computer follows.1 Typically,the program is put into a storage area accessible to the computer.The computer gets one instruction and performs it and then gets the next instruction.The storage area or memory can also contain the data that the instruction operates on.(Note that a program is also a special kind of“data”that tells how to operate on“application or us-er data”.)

Programs can be characterized as interactive or batch in terms of what drives them and how con-tinuously they run.An interactive program receives data from an interactive user(or possibly from another program that simulates an interactive user).A batch program runs and does its work,and then stops.Batch programs can be started by interactive users who request their interactive program to run the batch program.A command interpreter or a Web browser is an example of an interactive program.A program that computes and prints out a company payroll is an example of a batch pro-gram.Print jobs are also batch programs.

When you create a program,you write it using some kind of computer language.Your language statements are the source program.You then“compile”the source program(with a special program called a language compiler)and the result is called an object program(not to be confused with ob-ject-oriented programming).There are several synonyms for object program,including object mod-ule and compiled program.The object program contains the string of 0s and 1s called machine lan-guage that the logic processor works with.

The machine language of the computer is constructed by the language compiler with an under-standing of the computer’s logic architecture,including the set of possible computer instructions and the length(number of bits)in an instruction.

2.Structured Programming(Modular Programming)

Structured programming(sometimes known as modular programming)is a subset of procedural programming that enforces a logical structure on the program being written to make it more efficient and easier to understand and modify.Certain languages such as Ada,Pascal and dBASE are de-signed with features that encourage or enforce a logical program structure.

Structured programming frequently employs a top-down design model,in which developers map out the overall program structure into separate subsections.2 A defined function or set of similar func-tions is coded in a separate module or submodule,which means that code can be loaded into memory more efficiently and that modules can be reused in other programs.3 After a module has been tested individually,it is then integrated with other modules into the overall program structure.

Program flow follows a simple hierarchical model that employs looping constructs such as“for”“repeat”and“while”Use of the“Go To”statement is discouraged.

Structured programming was first suggested by Corrado Bohm and Guiseppe Jacopini.The two mathematicians demonstrated that any computer program can be written with just three structures:sequences,decisions,and loops.Edsger Dijkstra’s subsequent article,Go To Statement Considered Harmful,was instrumental in the trend towards structured programming.The most common method-ology employed was developed by Dijkstra.In this model(which is often considered to be synony-mous with structured programming,although other models exist)the developer separates programs into subsections that each have only one point of access and one point of exit.

Almost any language can use structured programming techniques to avoid common pitfalls of un-structured languages.Unstructured programming must rely upon the discipline of the developer to avoid structural problems,and as a consequence may result in poorly organized programs.Most modern procedural languages include features that encourage structured programming.Object-orien-ted programming(OOP)can be thought of as a type of structured programming.It uses structured programming techniques for program flow,and adds more structure for data to the model.

3.Compiler

A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or“code”that a computer’s processor uses.Typi-cally,a programmer writes language statements in a language such as Pascal or C one line at a time using an editor.The file that is created contains what are called the source statements.The program-mer then runs the appropriate language compiler and specifies the name of the file that contains the source statements.

When executing(running),the compiler first parses(or analyzes)all of the language state-ments syntactically one after another and then,in one or more successive stages or“passes”,builds the output code,making sure that statements that refer to other statements are referred to correctly in the final code.Traditionally,the output of the compilation has been called object code or sometimes an object module.(Note that the term“object”here is not related to object-orientedprogramming.)The object code is machine code that the processor can process or“execute”one in-struction at a time.

More recently,the Java programming language,a language used in object-oriented program-ming,has introduced the possibility of compiling output(called bytecode)that can run on any computer system platform for which a Java virtual machine or bytecode interpreter is provided to con-vert the bytecode into instructions that can be executed by the actual hardware processor.4Using this virtual machine,the bytecode can optionally be recompiled at the execution platform by a just-in-time compiler.

Traditionally in some operating systems,an additional step was required after compilation-that of resolving the relative location of instructions and data when more than one object module was to be run at the same time and they cross—referred to each other’s instruction sequences or data.This process was sometimes called linkage editing and the output known as a load module.

A compiler works with what are sometimes called 3GL and higher-level languages.An assemb-ler works on programs written using a processor’s assembler language.

4.Interpreter

An interpreter is a program that executes instructions written in a high-level language.There are two ways to run programs written in a high-level language.The most common is to compile the program;the other method is to pass the program through an interpreter.

An interpreter translates high-level instructions into an intermediate form,which it then exe-cutes.In contrast,a compiler translates high-level instructions directly into machine language.Compiled programs generally run faster than interpreted programs.The advantage of an interpreter,however,is that it does not need to go through the compilation stage during which machine instruc-tions are generated.This process can be time consuming if the program is long.The interpreter,on the other hand,can immediately execute high-level programs.For this reason,interpreters are sometimes used during the development of a program,when a programmer wants to add small sec-tions at a time and test them quickly.In addition,interpreters are often used in education because they allow students to program interactively.

Both interpreters and compilers are available for most high-level languages.However,BASIC and LISP are especially designed to be executed by an interpreter.In addition,page description lan-guages,such as PostScript,use an interpreter.Every PostScript printer,for example,has a built-in interpreter that executes PostScript instructions.

5.High Level Language

A programming language such as C,FORTRAN,or Pascal that enables a programmer to write programs that are more or less independent of a particular type of computer.Such languages are con-sidered high-level because they are closer to human languages and further from machine languages.In contrast,assembly languages are considered low-level because they are very close to machine lan-guages.

The main advantage of high-level languages over low-level languages is that they are easier to read,write,and maintain.Ultimately,programs written in a high-level language must be translated into machine language by a compiler or interpreter.

The first high-level programming languages were designed in the 1950s.Now there are dozens of different languages,including Ada,Algol,BASIC,COBOL,C,C++,FORTRAN,LISP,Pas-cal and Prolog.

6.Scripting Language

A scripting language is a high-level programming language that is interpreted by another pro-gram at runtime rather than compiled by the computer’s processor as other programming languages(such as C and C++)are.5 Scripting languages,which can be embedded within HTML,are commonly used to add functionality to a Web page,such as different menu styles or graphic dis-plays or to serve dynamic advertisements.These types of languages are client-side scripting langua-ges and they affect the data that the end user sees in a browser window.Other scripting languages are server-side scripting languages that manipulate the data,usually in a database,on the server.

Scripting languages came about largely because of the development of the Internet as a com-munications tool.JavaScript,ASP,JSP,PHP,Perl,Tcl and Python are examples of scripting lan-guages.

New Words

Phrases

one at a time 一次一个

storage area 存储区

batch program 批处理程序

print job 打印作业,打印任务

source program 源程序

object program 目标程序

be confused with... 与……混淆

object-oriented programming 面向对象编程

machine language 机器语言

structured programming 结构化程序设计

modular programming 模块化编程

top-down design model 自顶向下的设计模型

map out 描绘出

separate...into... 把……分为……

program flow 程序流程

turn...into... 把……转变为……

object code 目标代码

object module 目标模块

Java virtual machine Java虚拟机

convert...into... 把……转换为……

just-in-time compiler 即时编译器

relative location 相对位置

load module 载入模块

higher-level language 更高级的语言

time consuming 耗费时间的

page description language 页面描述语言

scripting language 脚本语言

Web page 网页

client-side scripting language 客户端脚本语言

server-side scripting language 服务器端脚本语言

Abbreviations

OOP(Object-Oriented Programming) 面向对象编程

3GL(Third-Generation Language) 第三代编程语言

BASIC(Beginners All-purpose Symbolic Instruction Code) 初学者通用指令码

LISP(LISt Processor) 列表处理语言

COBOL(COmmon Business-Oriented Language) 面向商业的通用语言

FORTRAN(FORmula TRANslation) 公式翻译语言

ASP(Active Server Page) 动态服务器主页

JSP(Java Server Pages) Java服务器端页面

Notes

[1]In the modern computer that John von Neumann outlined in 1945,the program contains a one-at-a-time sequence of instructions that the computer follows.

本句中,that John von Neumann outlined in 1945是一个定语从句,修饰和限定the modern computer。that the computer follows也是一个定语从句,修饰和限定instructions。one-at-a-time的意思是“一次一个”。

[2]Structured programming frequently employs a top-down design model,in which developers map out the overall program structure into separate subsections.

本句中,in which developers map out the overall program structure into separate subsections是一个介词前置的非限定性定语从句,对a top-down design model进行补充说明。

[3]A defined function or set of similar functions is coded in a separate module or submodule,which means that code can be loaded into memory more efficiently and that modules can be reused in other programs.

本句中,which means that code can be loaded into memory more efficiently and that mod-ules can be reused in other programs是一个非限定性定语从句,对它前面的整个句子进行补充说明。

[4]More recently,the Java programming language,a language used in object-oriented pro-gramming,has introduced the possibility of compiling output(called bytecode)that can run on any computer system platform for which a Java virtual machine or bytecode interpreter is provided to con-vert the bytecode into instructions that can be executed by the actual hardware processor.

本句中,a language used in object-oriented programming做the Java programming language的同位语,对其进行解释说明。used in object-oriented programming是一个过去分词短语,做a language的定语。that can run on any computer system platform for which a Java virtual machine or bytecode interpreter is provided to convert the bytecode into instructions that can be executed by the actual hardware processor是一个定语从句,修饰和限定compiling output(called bytecode)。在该从句中,for which a Java virtual machine or bytecode interpreter is provided是一个介词前置的定语从句,修饰和限定any computer system platform;that can be executed by the actual hardware processor是一个定语从句,修饰和限定instructions。

[5]A scripting language is a high-level programming language that is interpreted by another program at runtime rather than compiled by the computer’s processor as other programming langua-ges(such as C and C++)are.

本句中,that is interpreted by another program at runtime rather than compiled by thecomputer’s processor as other programming languages(such as C and C++)are是一个定语从句,修饰和限定a high-level programming language。rather than的意思是“而不是”。