計(jì)算機(jī)論文資料1.doc_第1頁
計(jì)算機(jī)論文資料1.doc_第2頁
計(jì)算機(jī)論文資料1.doc_第3頁
計(jì)算機(jī)論文資料1.doc_第4頁
計(jì)算機(jī)論文資料1.doc_第5頁
已閱讀5頁,還剩2頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

論文資料-計(jì)算機(jī)應(yīng)用軟件外文翻譯資料 1 什么是軟件 讀者知道了操作系統(tǒng)是一些軟件模塊的集合,這些模塊完成支持功能,有效地把用戶和硬件隔開。本文轉(zhuǎn)入對軟件較一般的討論。本文不期望教會(huì)讀者如何編程序,讀者也不要打算通過讀一本入門書中的一章就學(xué)會(huì)編程序。本文的意圖是通過向讀者展示在機(jī)器級上程序究竟是什么,然后簡單地討論當(dāng)開發(fā)一個(gè)程序時(shí)程序員應(yīng)該遵循的過程,從而力求揭示那些常常與軟件有關(guān)的奧妙。 讓我們從定義開始,程序是引導(dǎo)計(jì)算機(jī)通過一個(gè)過程的一組指令。每條指令都告訴機(jī)器完成它的基本功能中的一個(gè)。如加、減、乘、除、比較、復(fù)制、請求輸入或請求輸出等。讀者知道了在每個(gè)機(jī)器周期內(nèi)處理器取出并執(zhí)行一條指令。一條典型的指令包含一個(gè)操作碼和一組操作數(shù),操作碼規(guī)定了要完成的功能,操作數(shù)規(guī)定了存放要被處理的數(shù)據(jù)的存儲(chǔ)單元地址或寄存器編號。 例如:指令A(yù)DD 3,4 告訴一臺假想的計(jì)算機(jī)把寄存器R3 和R4 的內(nèi)容相加。 由于計(jì)算機(jī)指令組的功能如此有限,甚至一個(gè)簡單的邏輯操作也需要若干條指令。例如,假設(shè)二個(gè)數(shù)據(jù)的值存放在主存中,在很多機(jī)器上為了把它們相加,首先要把兩個(gè)數(shù)值加載到寄存器中,然后把寄存器的內(nèi)容相加,結(jié)果再送回到主存中。這樣就要用四條指令LOAD, LOAD、ADD 和STORE。如果為兩個(gè)數(shù)相加就需要四條指令的話,可以想象在一個(gè)完整的程序中指令的數(shù)目。 計(jì)算機(jī)是由存放在自己主存中的程序控制的。因?yàn)橹鞔娲娣艛?shù)位,所以程序必須以二進(jìn)制代碼形式存在。圖1 所示的是二進(jìn)制機(jī)器級指令、就是上例所需要的四條指令:把兩個(gè)數(shù)值加載到寄存器中,再把它們相加及結(jié)果放在主存中等。如果程序員必須用機(jī)器語言編程序的話,那么就幾乎沒有人能做程序員了。 2 編程語言 2.1 匯編語言 用匯編語言編程是一種選擇。例如,圖2 展示用IBM主機(jī)的匯編程序如何把兩個(gè)數(shù)相加。程序員為每一條機(jī)器指令寫一條助記符指令。AR(把寄存器的內(nèi)容相加)比等效的二進(jìn)制操作數(shù)000110101 容易記憶;字母L(用做裝入)也比01011000 容易記憶。操作數(shù)用標(biāo)志符A, B 和C,取代了主存的地址編號,這樣也簡化了代碼。 遺憾的是沒有能直接執(zhí)行匯編語言指令的計(jì)算機(jī)寫助記符代碼可以簡化程序員的工作,但是計(jì)算機(jī)是二進(jìn)制的機(jī)器,要求二進(jìn)制指令,因此需要翻譯。匯編程序讀入程序的源代碼,把源語句翻譯成二進(jìn)制數(shù),產(chǎn)生目標(biāo)模塊。因?yàn)槟繕?biāo)模塊是程序源代碼的機(jī)器級的版本。所以它能被裝入主存中并加以執(zhí)行。 匯編語言程序設(shè)計(jì)員為每條機(jī)器指令寫一條助記符指令。因?yàn)閰R編指令和機(jī)器指令之間存在一一對應(yīng)的關(guān)系,匯編語言和機(jī)器語言都是依賴于機(jī)器的,所以為一種型號計(jì)算機(jī)編寫的程序不能在另一種型號的機(jī)器上執(zhí)行。在一臺給定的機(jī)器上,匯編語言盡可能產(chǎn)生最直接有效的程序,因此經(jīng)常用它寫操作系統(tǒng)或其它系統(tǒng)軟件。然而,當(dāng)它應(yīng)用于應(yīng)用程序時(shí),依賴于機(jī)器的屬性是要為效率付出高代價(jià)的,所以應(yīng)用程序很少用匯編語言來寫。 2.2 編譯程序和解釋程序 為了把兩個(gè)數(shù)相加,計(jì)算機(jī)需要四條機(jī)器指令。因?yàn)檫@是計(jì)算機(jī)工作的方法。人類不必象計(jì)算機(jī)一樣地思維,程序員只簡單地指明做加法,采用另一些指令就行了,例如,一種方法就是把加法看成一個(gè)代數(shù)表達(dá)式: c=AB 為什么不允許程序員用類似于代數(shù)表達(dá)式的形式去寫語句呢?又為什么不能把這些源語句編在程序中,并讓程序產(chǎn)生所需的機(jī)器碼呢?肯定這就是編譯程序所要完成的。 許多編程語言,包括FORTRAN, BASIC, PASCAL, PL/1 和ALGOL 都是基于代數(shù)表達(dá)的。面向商業(yè)的最常用的COBOL 語言要求語句類似于簡短的英語句子。然而必須提醒注意的是,采用什么語言沒關(guān)系,目標(biāo) 是相同的。程序員編源碼程序,匯編程序接受助記符源碼程序,并產(chǎn)生機(jī)器目標(biāo)模塊;FORTRAN 編譯程序接受FORTRAN 源碼,也產(chǎn)生機(jī)器目標(biāo)模塊;COBOL 編譯程序接受COBOL 源碼,產(chǎn)生同上的目標(biāo)模塊。 匯編程序和編譯程序之間有何差別呢?對于匯編程序,每一個(gè)源語句都轉(zhuǎn)換成一條機(jī)器指令。但對于編譯程序,一個(gè)源語句可以轉(zhuǎn)換任意數(shù)目的機(jī)器指令。 還有一種選擇是采用解釋程序。匯編程序和編譯程序都讀入一個(gè)完整的源程序,并產(chǎn)生一個(gè)完整的目標(biāo)模塊。另一方面,解釋程序每次只對一個(gè)源語句操作,讀入它,把它轉(zhuǎn)換成機(jī)器指令,執(zhí)行被轉(zhuǎn)換成的二進(jìn)制指令,然后繼續(xù)下一條源語句。編譯程序和解釋程序兩者都產(chǎn)生機(jī)器指令,但過程是不同的。 每種語言都有它自己的語法、標(biāo)點(diǎn)和拼寫規(guī)則。例如PASCAL 源程序?qū)OBOL 編譯程序或者 BASIC 解釋程序是無意義的。然而,所有的這些語言都支持編寫程序。無論用什么語言,程序員的目標(biāo)是相同的。都是要確定一系列步驟,引導(dǎo)計(jì)算機(jī)通過某個(gè)過程。 2.3 非過程語言 用傳統(tǒng)的匯編語言、編譯語言和解釋語言,程序員確定了一個(gè)確切地告訴計(jì)算機(jī)如何去解決問題的過程。然而,用現(xiàn)代非過程語言,有時(shí)稱第四代語言或說明語言,程序員只須簡單地確定問題的邏輯關(guān)系,而讓語言變換程序推算出如何解決問題。商業(yè)上使用的非過程語言的例子有:Prolog, Focus, Lonusl-2-3 和其它等。它們正變得越來越流行。 3 程序庫 設(shè)想程序員編寫一個(gè)龐大程序,當(dāng)源語句被鍵入時(shí),可用編輯程序處理它,并存放在磁盤上。因?yàn)辇嫶蟮某绦虿豢赡苡靡淮晤A(yù)約的時(shí)間就全部寫入,所以程序員最終要停止鍵入,并把已鍵入的程序通過驅(qū)動(dòng)器送到磁盤上。以后當(dāng)工作恢復(fù)時(shí),軟磁盤重新插入,新的源語句接在后面鍵入。同一磁盤可以保存其它一些源程序甚至其他程序員所寫的一些程序。源語句庫的例子就是一個(gè)很好的說明。 最終,完成了源程序的鍵入和編譯,得到的目標(biāo)模塊可以直接裝入到主存,但更多的時(shí)候它存放在目標(biāo)模塊庫中。因?yàn)槟繕?biāo)模塊是二進(jìn)制的機(jī)器級的子程序,所以一個(gè)目標(biāo)模塊由匯編程序產(chǎn)生和FORTRAN 編譯 程序(或任何其它編譯程序)產(chǎn)生沒有根本差別。因此,用不同的源語言產(chǎn)生的目標(biāo)模塊可存放在同一個(gè)程序庫內(nèi)。 有些目標(biāo)模塊能裝入到主存中,并被執(zhí)行。而另一些模塊,包括了對一些子程序的調(diào)用,這些子程序不屬于目標(biāo)模塊的一部分。例如,一個(gè)計(jì)算機(jī)仿真撲克牌的程序,如果以前有人編寫了一段很優(yōu)秀的發(fā)牌子程序,那么重新用那個(gè)子程序是有意義的。4 程序開發(fā)過程 程序如何修改軟件包呢?更普遍地講,職業(yè)的程序員如何編寫原始程序呢?編程序不完全是科學(xué),還涉及到一點(diǎn)藝術(shù)。因此,不同的程序員用不同的方法編程序是沒什么奇怪的。然而,大多數(shù)程序員都從仔細(xì)地定義問題開始,然后,在寫編碼前詳細(xì)地設(shè)計(jì)出解決辦法。讓我們簡單地研究一下程序的開發(fā)過程。 4.1 問題的定義 程序開發(fā)的第一步是問題定義,這一點(diǎn)看起來是常識,但常常有些程序還不清為什么需要就編出來了,對一個(gè)未能正確定義的問題所得到的結(jié)果,即使是一個(gè)偉大的結(jié)果,也是無用的。 因?yàn)槿藗冃枰畔?,才寫程序,因此程序員應(yīng)在明確了所期望的信息后才能開始寫。接著,要確定產(chǎn)生那個(gè)信息的算法或規(guī)則。給出了所要求的輸出信息和算法,要輸入的數(shù)據(jù)也就確定了結(jié)果是,一個(gè)清晰的問題定義,給了程序員一個(gè)好思想,明確了這個(gè)程序必須完成的事情。 4. 2 編排 算法確定了必須做的事情,接下來的任務(wù)是決定如何去做目的是要用計(jì)算機(jī)能理解的術(shù)語去陳述問題的解。由于計(jì)算機(jī)只能完成算術(shù)運(yùn)算、比較、復(fù)制和請求I/0 等操作,因此程序員受到這些基本操作的限制。一個(gè)良好的起點(diǎn)總是首先確定求解問題的一個(gè)小型方案通過實(shí)際求解的這一算法,甚至是在規(guī)模上有限的一個(gè)算法。使程序員獲得編程問題所需的步驟。 4.3 編寫程序 在實(shí)施階段,程序員把問題的解法轉(zhuǎn)換成用某種編程語言寫成的一系列源語句,而每一種編程語言都有它自己的語法、標(biāo)點(diǎn)和拼寫規(guī)則。學(xué)習(xí)一種新語言要花時(shí)間,寫指令基本上是機(jī)械性工作。編程的真正秘密不是簡單地編寫指令,而是要思考接下來該寫什么指令,這就需要邏輯性。有幸的是知道如何編程序并不是使用計(jì)算機(jī)的先決條件。 4.4 調(diào)試和文檔編寫 程序一旦編成,程序員就必須調(diào)試它。首先要糾正它的一些無意識的錯(cuò)誤,譬如錯(cuò)誤的標(biāo)點(diǎn)或拼寫等。編譯程序或解釋程序通常能發(fā)現(xiàn)這些錯(cuò)誤,較困難的是發(fā)現(xiàn)并糾正邏輯錯(cuò)誤,這類錯(cuò)誤是由于采用錯(cuò)誤的指令而引起的。僅僅指令正確是不夠的,程序還必須是順序正確的指令組。再重復(fù)一次,精心的編程設(shè)計(jì)是關(guān)鍵,優(yōu)良的設(shè)計(jì)可簡化程序的調(diào)試。 程序的文檔由段落、注釋和其它解釋或闡明編程的說明材料組成,在程序調(diào)試階段,文檔是極寶貴的,也是有效的維護(hù)程序的基礎(chǔ)。最有用的是出現(xiàn)在程序中的注釋,這些注釋列舉出并解釋了邏輯關(guān)系。4.5 維護(hù) 程序一調(diào)好,維護(hù)就開始了。由于不可能徹底地測試許多大程序。在調(diào)試階段中、一些缺欠可能滑過去了,幾個(gè)月甚至幾年以后才暴露出來,測定出這些缺欠是非常重要的維護(hù)任務(wù)。更為重要的維護(hù)是為了適應(yīng)現(xiàn)時(shí)應(yīng)用的需要而修改程序。例如,由于所得稅經(jīng)常變化,工資程序必須經(jīng)常修改。維護(hù)的關(guān)鍵是認(rèn)真的計(jì)劃,完整的文檔資料和優(yōu)良的程序設(shè)計(jì)。 5 編寫用戶程序 能演奏一種樂器并不是欣賞音樂的基礎(chǔ)。同樣,知道如何編程序也不是使用計(jì)算機(jī)的先決條件。大多數(shù)計(jì)算機(jī)用戶不能編程序。 正如一種樂器的初步知識能增長你對音樂的欣賞水平一樣,知道了如何編程序能使你成為一個(gè)比較有效率的計(jì)算機(jī)用戶。當(dāng)然,如果你希望以計(jì)算機(jī)職業(yè)謀生的話,編程序的知識是基礎(chǔ),這就不用說了。有些人發(fā)現(xiàn)編程容易,還有些人發(fā)現(xiàn)編程序極困難。關(guān)鍵是要實(shí)踐,學(xué)習(xí)編程序的唯一方法就是實(shí)際地去編程序。 Application software 1 What is the software Readers know that the operating system is a collection of software modules, these modules complete support functions, effectively separating the users and hardware. In this paper, the software into more general discussion. In this paper, readers do not expect the church how the procedures, the reader should not intend to read an entry through a chapter book for the Institute procedures. The intent of this paper to readers through machine-level display in what is the procedure, and then briefly discuss the development of a procedure when programmers should follow the process so as to those who often seek to reveal the secret of the software. Let us start from the definition, the process is a process guided by computer for a group of instructions. Instructions tell each machine to complete its basic functions in one. If adds, subtracts, multiplies, in addition, comparison, replication, importation request or request output. Readers know that the cycle in each processor machines removed and the implementation of a directive. A typical directive contains an operation code and a group of several operations, the operation code provides for the functions to be completed, the operation of several provisions of the stored data to be dealt with the memory cell address or register numbers. For example: 3,4 directive ADD Tell a hypothetical computer to register R3 and R4 sum of the contents. As computer instruction set such a limited function, or even a simple logic operations also need some instructions. For example, suppose two data values stored in the main memory, in many machines to put them together, we must first two numerical loaded in the register, then add the contents of the register, before sending it back to the main results of depositors. This will use four instructions LOAD, LOAD, ADD and STORE. If the two numbers add up to four instructions on the needs of the imagination in a complete process of the number of instructions. The computer is stored in main memory in their program. Because a number of main memory storage, procedures must be in the form of binary code. Figure 1 shows the binary machine-level instructions, is needed on the cases of four instructions: Numerical loaded to the two registers, then put them together and the results of the middle. If programmers must use procedures for the machine language, then there would be almost no one can do the programmers. 2 programming language 2.1 assembly language Using assembly language programming is an option. For example, Figure 2 display IBM mainframe assembler how to add two numbers. A machine for each programmer to write a directive x87 instructions. AR (the contents of the register together) than the equivalent of the binary number 000110101 easy operation memory; Letter L (used as load) than 01011000 easy memory. Operate with few signs at A, B and C, replacing the main memory address number, this also simplifies the code. Unfortunately there is no direct implementation of the computer assembly language instructions. Write x87 code programmers can simplify the work, but the computer is a binary machine for binary instructions, requiring translation. Read procedures assembler source code, the source statement translated into binary, a target module. Because the module is the goal of the program source code machine-class version. Therefore, it can be installed in the main memory and to implement them. Members of assembly language programming instructions for each machine to write a x87 instructions. Because compilation machinery orders and instructions between 一一對應(yīng)relations, assembly language and machine language are dependent on machines, as a computer model prepared by the procedure can not be another type of machine implementation. In a given machine, the assembly language as far as possible, have the most direct and effective process, often using it to write the operating system or other system software. However, when it applied to applications, rely on machines attributes is to pay a high price for efficiency, so applications rarely use assembly language to write. 2.2 compiler and interpreter In order to add two numbers, the computer needs 104 machine instructions. Because this is the work of the computer method. Human beings do not have the same manner as computers, programmers simply specified boosting using other instructions on the roll, for example, is a way of the addition as an algebraic expression: C = A + B Why do they not allow programmers using algebraic expressions similar to the form of written statements? And why not the source of these statements made in the proceedings, and procedures necessary for native? This is the compiler sure to be completed. Many programming languages, including Fortran, BASIC, PASCAL, PL / 1 and ALGOL are based on the algebraic expression. Business-oriented COBOL language most commonly used language similar to the requirements of the short English phrases. However, it must be recalled that, It does not matter what language, the target is the same. Programmers for source, assembler accept x87 source procedures, and produce machines goals module; FORTRAN compiler accept FORTRAN source, also produced machines goals module; COBOL compiler accept COBOL source code, the goals have ibid. module. The compilation process and the difference between the compiler? For assembler, every source query has been converted into a machine instructions. But compiler, a source statements can be converted arbitrary number of machine instructions. Another option is to adopt the interpretation of the procedures. The compilation process and procedures are compiled into a complete reading of the source files, and produce a complete module targets. On the other hand, only the interpretation of the procedures each operation of a source statement, read it, put it into machine instructions, implementation is converted into binary instructions, and then proceed to the next source of a statement. Compiler procedures and the interpretation of the procedures both produce machine instructions, but the process is different. Each language has its own grammar, punctuation and spelling rules. PASCAL source such as the COBOL compiler or BASIC interpreter is meaningless. However, all these languages are in support of the preparation procedures. No matter what language, programmers goal is the same. A series of steps are to determine, through a computer to guide the process. 2.3 Non-Process Language Using traditional assembly language, compiler language and interpretation of language, programmers determined to tell a computer exactly how to solve the problem of process. However, the use of modern non-process language, and sometimes said that the fourth-generation language or languages, programmers need only simple logic to determine the relationship, so the language transform procedures calculated how to solve the problem. The non-commercial use of language examples are: Prolog, Focus, Lonusl-2 - 3 and other, and so on. They are becoming increasingly popular.3 libraries Programmers envisaged to prepare a huge procedure, when the type of statement, it may be editing procedures, both on the disk. Because the procedure can not be used huge booking a write all the time, so programmers eventually have to stop typing, and the type of procedure has been adopted to the disk drives. When work resumed later, the floppy disk re-inserted, the new source statement by typing in the back. The same can be preserved for some other disk source code written by programmers and even some of the other procedures. The source of the statement is a good example of that. Finally, the completion of the type and source compiler, the target modules can be directly loaded into main memory, but more often it deposited in the target module library. Because the target module is binary machine-class subroutine, a target module generated by the compilation process and FORTRAN compiler (or any other compiler) have no fundamental differences. Therefore, the language used different source modules and that the objective can be stored in the same stored procedure. Some of modules can be loaded to the main deposit, and was implementation. While other modules, including some of the subroutine call, the goal of these subroutine modules are not part of. For example, a computer simulation poker the procedure, if someone previously prepared for a very good brand of procedures, then re-use that subroutine is meaningful. 4 program development process Procedures how to amend the package? More generally speaking, professional programmers how to prepare the original procedure? Part procedure is not entirely a scientific, but also to point arts. Therefore, different programmers use different methods for procedures is nothing strange. However, most programmers are careful definition of problems from the start, and then write code in detail before design solutions. Let us briefly examine the procedures for the development process. 4.1 the definition of the problem Program development is the first step in problem definition, which appears to be common sense, but it often is not clear why certain procedures need to come out for the definition of a failure to correct the problem by the results, even if the result is a great, but also useless. Because people need information before writing process, the programmer should be clear after the desired information can start writing. Then, have that information to determine the algorithms or rules. Given the requested information and the output method, the data will have to import identified a result, a clear definition of the problem to the programmer a good idea, a clear procedure must be completed this thing. 4.2 Schedule The algorithm for determining what must be done, the next task is to decide what to do purpose is to use the computer to understand the terminology solution to the problem statement. The computer can only be completed arithmetic operations, compare, replication and requests I / 0, and other operations, so programmers are the basic operation of these restrictions. A good starting point is always the first to identify a small problem solving program. Through practical solution of this algorithm, even in a limited scale algorithm. Programming problems programmers access to the necessary steps.4.3 preparation procedures In the implementation phase, programmers solution to the problem into some kind of programming language with a series of statements, each programming language has its own grammar, punctuation and spelling rules. Learning a new language takes time, writing instruction is basically mechanical work. Programming the real secret is not a simple preparation instructions, but to think what was then the directive, which requires logic. Honor is aware of how the process is not a prerequisite for the use of computers. 4.4 debug and document preparation Once the composition process, the programmer must set it up. First to rectify some of its Unconscious errors, such as incorrect punctuation or spelling, and other. Compiler or interpretation of the procedures are usually able to detect these errors, more difficult to detect and correct the logic is wrong, because this type of error is the wrong direction ca

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論