Unit 10 Program Design
Text 1 Computer Languages
Computer languages have undergone dramatic evolution since the first electronic computers were built. Early on, programmers worked with the most primitive computer instructions—machine language. These instructions were represented by long strings of ones and zeroes. Soon, assembly language was invented. It maps machine instructions to human-readable mnemonics, such as ADD and MOV.
In time, higher-level languages evolved, such as PASCAL, BASIC, COBOL, C, C++, and JAVA. These languages let people work with something approximating words and sentences, such as Let I = 100. These instructions were translated back into machine language by interpreters and compilers. An interpreter translates a program as it reads it, turning the program instructions, or code, directly into actions. A compiler translates the code into an intermediary form. This step is called compiling, and produces an object file. The compiler then invokes a linker, which turns the object file into an executable program.
Because interpreters read the code as it is written and execute the code on the spot, interpreters are easy for the programmer to work with. Compilers, however, introduce the extra steps of compiling and linking the code, which is inconvenient. Because the time-consuming task of translating the source code into machine language has already been accomplished, compilers produce a program that is very fast each time it is run.
The problems programmers are asked to solve have been changing. Today's programs use sophisticated "user-friendly interfaces," involving multiple windows, menus, and dialog boxes. The programs written to support this new approach are far more complex than those written just ten years ago. Generally, as programming requirements have changed, both languages and the techniques used for writing programs have evolved.
参考译文
计算机语言
自从第一批电子计算机诞生以来,计算机语言已经发生了戏剧性的变化。在早期,程序员使
用最为原始的计算机指令──机器语言来工作,这些指令由一长串的0和1组成。不久,汇编语言发明了,它是把机器指令变换成易于阅读的助记符,如ADD、MOV等。
往后,又推出了高级语言,如PASCAL、BASIC、COBOL、C、C++、JAVA。这些语言使用的是近似于人们常用的词语或语句,如Let I=100。这些指令由解释器或编译器翻译成机器语言。解释器边读边翻译程序,把程序指令或代码直接变成动作。编译器把代码翻译成中间代码。这一步叫做编译,产生一个目标文件。接着,编译程序调用链接程序,由链接程序把目标文件变为可执行程序。
因为解释程序是读出代码就执行,所以程序员易于使用;但是编译程序却增加了一些额外的步骤来编译和链接代码,相比之下则不方便。可是编译程序产生的程序运行起来非常快,因为把源代码翻译成机器语言这一耗时的任务已经完成了。
程序员要解决的问题一直在变化。今天,程序使用了复杂的“用户友好界面”,包含多重窗口、菜单、对话框。比起10年前的程序来,支持这些新方法的程序要复杂得多。总之,随着程序设计需求的变化,计算机程序设计语言和程序设计技术都已产生了变化。
Text 2 Computer programming
Computer programming is the activity of developing programs, or lists of instructions, that control the operation of a computer. Computer systems consist of hardware and software. Hardware comprises the electronic and physical parts of the computer. In contrast, software comprises the programs that reside and control each hardware component. Without a software program, a computer is as useless as a bus without a driver.
Computer programs are expressed in precise notations called computer languages. The programs for elementary computer processes are written in low-level languages. These languages are difficult for the ordinary user to follow. High-level languages strike a compromise between the precise meanings required by the machine and spoken language of the users. Common high-level languages include BASIC, C, COBOL and PASCAL. A major activity in programming is the expressing of the steps of a program in one or more languages.
The programming of a computer may be broken down into five stages. They are as follows:
∙ requirements definition
∙ design specification
∙ coding
basic语言是谁发明的∙ testing
∙ maintenance
As an example, for a payroll program, requirements specify how many paychecks must be processed, and what calculations need to be performed. In the design specification stage, directions are provided for meeting the requirements by quantifying the processing steps in greater detail. For this, an algorithm is devised. Coding is the stage in which the design is turned into steps expressed in a chosen programming language. In the testing stage, the programs are verified as being correct with respect to the requirements and design specification. The final stage is maintenance in which enhancements and corrections are made. It is the most lengthy and costly stage of programming.
Generally, computer programming is a costly and time-consuming activity. Approaches to i
mproving the programmer’s are being pursued. These include inventing higher-level languages or more powerful languages, inventing utility programs that assist programmers, and inventing new methods of programming.
参考译文
计算机编程
计算机编程就是开发程序或者列出控制计算机运行指令的行为。计算机系统由硬件和软件组成。硬件包含了计算机中的电子的和物理的部件,而软件包含了控制各硬件部件的程序。没有了软件程序,一台计算机就像一辆没有司机的汽车一样是没有用的。
计算机程序由称为计算机语言的精确符号表示。计算机处理的基本程序是由低级语言编写的,这些语言一般人难以掌握。高级语言是要求精确意义的机器语言和使用者自然语言的折中。一般用来设计应用程序的高级语言有:BASIC、C、COBOL和PASCAL。编程的主要工作就是用一种或多种语言表示程序的详细过程。
计算机编程大致可以分为5个阶段,它们是需求设计、设计规格、编码、测试和维护。
以工资管理程序程序为例,需求指定有多少工资必须处理,需要完成什么样的计算。在设计规格阶段,通过更详细地确定处理步骤以提供满足需求的方向。因此,需要设计一个算法。在编码阶段,用某一个选定的程序设计语言将设计表达出来。在测试阶段,检验程序是否符合设计需求。最后是维护阶段,在此阶段要增强软件功能和改正软件错误,这个阶段也是程序中最漫长和花费最大的阶段。
总之,计算机编程是一个昂贵、费时的过程。人们研究了许多方法以提高程序员的生产率,包括发明更高级的或更强大的语言,发明实用程序以辅助程序员和发明新的编程方法。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论