1、毕业设计 论文 -1- 附件 A 编程语言 编写计算机程序有两种常用方法:面向过程的程序设计和面向对象的程序设计。 面向对象的程序设计是面向过程程序设计的一种扩展,在编写程序时采用的方法有一些不同,用面向对象的方法考虑问题,首先把程序元素看成是与现实世界中的具体对象相似的对象,然后对这些对象进行操作以得到期望的结果。编写面向对象的程序包括创建对象和创建使用这些对象的应用程序。 机器语言 能被计算机操作系统直接运行的计算机程序称为可执行程序。可执行程序是以机器码的形势表示的一系列非常简单的指令。这些指令对于不同计算机的 CPU 而言是特定的,它们与硬件有关。例如,英特尔 “奔腾 ”处理器和 Po
2、wer PC 微处理器芯片各自有不同的机器语言,要求用不同的代码集来完成相同的任务。机器码指令是从存储单元取数据,或将两个存储单元的内容相加(通常在 CPU 的寄存器中进行)。机器码指令是二进制的 比特序列( 0 和 1)。由于这些数字令人难以理解,所以计算机指令通常不是用机器码来写的。 汇编语言 与机器语言指令相比,汇 编语言使用的命令较容易为程序员理解。每条机器语言指令在汇编语言中有等价的命令。例如,在汇编语言中,语句 “MOV A,B”命令表示计算机把数据从一个单元复制到另一个单元,而及其代码中同样的指令是有一串 16 位的 0 和 1 组成的。一旦汇编语言程序编写完毕,它就由另一个称之
3、为汇编起的程序转换成机器语言程序。相对于机器语言而言,汇编语言速度快,功能强。可它仍然难以利用,因为汇编语言指令是有一系列抽象代码组成的。另外,不同的 CPU 使用不同的机器语言,因此需要不同的汇编语言(程序)。有时为了执行特殊的硬件任务,或者为了加快高 级语言程序的速度,汇编语言被插入到高级语言程序中。 高级语言 从机器语言进步到汇编语言,是语言达到了更先进的阶段。同样也正是这种进步导致了高级语言的发展。如果计算机能把简便的符号翻译成基本操作,为什么它就不能完成其他文字类型的编码功能呢? 现在让我们来看看所期望的高级语言应有的特点,以及怎样将它们与机器码和汇编语言进行比较。高级程序语言是这样
4、一种编程手段,它用规范化的术语来写出一步步的程序步骤,执行这些步骤时会用唯一确定的方式处理工作。高级语言经常针对某类特殊的处理问题而设计,例如,一些语言设计成适宜处理科 学计算问题,另一些语言则更侧重于文件处理的应用。 面向对象编程语言 像 C+这样的面向对象程序语言( OOP)是以传统的高级语言为基础,但是它们能使程序员按照组合对象集方式而不是指令列表方式来进行思考。对象有许多性质,以圆为例,就有圆的半径以及把圆画到计算机屏幕上的命令。对象的类可以从其他对象类那里继承属性。例如,一个定义正方形的类能从定义长方形的类那里继承诸如直角这样的属性。程序类的这种关系简化了程序员的工作,从而导致更多既
5、可靠又高效的程序产生。 毕业设计 论文 -2- 附件 B Programming Language There are two popular approaches to writing computer programs: procedural programming(面向过程的程序设计) and object-oriented programming(面向对象的程序设计) . Machine Language Computer programs that can be run by a computers operating system are called executables(可执
6、行程序) . An executable program is a sequence(序列) of(一系列的) extremely(非常地) simple instructions known as machine code. These instructions are specific to the individual computers CPU and associated(相关的) hardware; for example, Intel Pentium and Power PC microprocessor chips each have different machine lan
7、guages and require different sets of codes to perform the same task. Machine code instructions are few in number(roughly 概略的 20 to 200,depending on the computer and the CPU).Typical(典型的) instructions are for copying data from a memory location or for adding the contents of two memory locations (usua
8、lly registers in the CPU). Machine code instructions are binary 二进制 _that is, sequences of bits (0s and 1s). Because these numbers are not understood easily by humans, computer instructions usually are not written in machine code. Assembly Language 汇编语言 Assembly language uses commands that are easie
9、r for programmers to understand than machine-language commands. Each machine language instruction has an equivalent(等价的) command in assembly language. For example, in assembly language, the statement “MOV A,B”instructs(命令) the computer to copy data from one location to another. The same instruction
10、in machine code is a string of (一串) 16 0s and 1s. Once an assembly-language program is written, it is converted to a machine-language program by another program called an assembler(汇编器) . Assembly language is fast and powerful because of its correspondence with machine language. It is still difficul
11、t to use, however, because assembly-language instructions are a series of abstract(抽象的) codes. In addition, different CPUs use different machine languages and therefore require different assembly languages. Assembly language is sometimes inserted into a high-level program. High-Level Languages 毕业设计
12、论文 -3- The improvement of machine language to assembly language set the stage for further advances. It was this improvement that led, in turn, to the development of high-level languages. If the computer could translate convenient symbols into basic operations, why couldnt it also perform other cleri
13、cal coding functions? Let us now look at the features we would expect to find in a high-level language and how they compare with machine code and assembly language.3 A high-level programming language is a means of data in a uniquely defined way. It may bear no relation to any given computer but does
14、 assume that a computer is going to be used. The high-level languagees are often oriented toward a particular class of processing problems. For example, a number of languages have been designed to process problems of a scientific_mathematic nature, and other languages have appered that emphasize fil
15、e processing applications. Object-Oriented Programming Languages Object-oriented programming(OOP)languages like C+ are based on traditional high-level languages, but they enable a programmer to think in terms of collections of cooperating objects instead of lists of commands. Objects, such as a circ
16、le, have properties such as the radius of the circle and the command that draws it on the computer screen.4 Classes of objects can inherit features such as right angles from a class edfining rectangles. This set of programming classes simplifies the progammers task, resulting in more reliable and ef
17、ficient programs. The long-term productivity of systems is enhanced by object-oriented program. Because of the modular nature of the code, programs are more malleable. This is particularly beneficial for applications that will be used for many years, during which company needs may change and make so
18、ftware modifications necessary. Software reliability can be improved by object-oriented programming. Since the objectsare repeatedly tested in a variety of applications, bugs are more likely to be found and corrected. Object-oriented programming also has potential benefits in parallel processing. Execution speed under object oriented methods will improve with parallel processing.