计算机专业毕业设计论文外文文献中英文翻译——java对象.doc
《计算机专业毕业设计论文外文文献中英文翻译——java对象.doc》由会员分享,可在线阅读,更多相关《计算机专业毕业设计论文外文文献中英文翻译——java对象.doc(12页珍藏版)》请在沃文网上搜索。
1、1 . Introduction To Objects1.1 The progress of abstractionAll programming languages provide abstractions. It can be argued that the complexity of the problems youre able to solve is directly related to the kind and quality of abstraction. By “kind” I mean, “What is it that you are abstracting?” Asse
2、mbly language is a small abstraction of the underlying machine. Many so-called “imperative” languages that followed (such as FORTRAN, BASIC, and C) were abstractions of assembly language. These languages are big improvements over assembly language, but their primary abstraction still requires you to
3、 think in terms of the structure of the computer rather than the structure of the problem you are trying to solve. The programmer must establish the association between the machine model (in the “solution space,” which is the place where youre modeling that problem, such as a computer) and the model
4、 of the problem that is actually being solved (in the “problem space,” which is the place where the problem exists). The effort required to perform this mapping, and the fact that it is extrinsic to the programming language, produces programs that are difficult to write and expensive to maintain, an
5、d as a side effect created the entire “programming methods” industry. The alternative to modeling the machine is to model the problem youre trying to solve. Early languages such as LISP and APL chose particular views of the world (“All problems are ultimately lists” or “All problems are algorithmic,
6、” respectively). PROLOG casts all problems into chains of decisions. Languages have been created for constraint-based programming and for programming exclusively by manipulating graphical symbols. (The latter proved to be too restrictive.) Each of these approaches is a good solution to the particula
7、r class of problem theyre designed to solve, but when you step outside of that domain they become awkward. The object-oriented approach goes a step further by providing tools for the programmer to represent elements in the problem space. This representation is general enough that the programmer is n
8、ot constrained to any particular type of problem. We refer to the elements in the problem space and their representations in the solution space as “objects.” (You will also need other objects that dont have problem-space analogs.) The idea is that the program is allowed to adapt itself to the lingo
9、of the problem by adding new types of objects, so when you read the code describing the solution, youre reading words that also express the problem. This is a more flexible and powerful language abstraction than what weve had before. Thus, OOP allows you to describe the problem in terms of the probl
10、em, rather than in terms of the computer where the solution will run. Theres still a connection back to the computer: each object looks quite a bit like a little computerit has a state, and it has operations that you can ask it to perform. However, this doesnt seem like such a bad analogy to objects
11、 in the real worldthey all have characteristics and behaviors. Alan Kay summarized five basic characteristics of Smalltalk, the first successful object-oriented language and one of the languages upon which Java is based. These characteristics represent a pure approach to object-oriented programming:
12、 1. Everything is an object. Think of an object as a fancy variable; it stores data, but you can “make requests” to that object, asking it to perform operations on itself. In theory, you can take any conceptual component in the problem youre trying to solve (dogs, buildings, services, etc.) and repr
13、esent it as an object in your program. 2. A program is a bunch of objects telling each other what to do by sending messages. To make a request of an object, you “send a message” to that object. More concretely, you can think of a message as a request to call a method that belongs to a particular obj
14、ect. 3. Each object has its own memory made up of other objects. Put another way, you create a new kind of object by making a package containing existing objects. Thus, you can build complexity into a program while hiding it behind the simplicity of objects. 4. Every object has a type. Using the par
15、lance, each object is an instance of a class, in which “class” is synonymous with “type.” The most important distinguishing characteristic of a class is “What messages can you send to it?” 5. All objects of a particular type can receive the same messages. This is actually a loaded statement, as you
16、will see later. Because an object of type “circle” is also an object of type “shape,” a circle is guaranteed to accept shape messages. This means you can write code that talks to shapes and automatically handle anything that fits the description of a shape. This substitutability is one of the powerf
17、ul concepts in OOP. Booch offers an even more succinct description of an object:An object has state, behavior and identity.This means that an object can have internal data (which gives it state), methods (to produce behavior), and each object can be uniquely distinguished from every other objectto p
18、ut this in a concrete sense, each object has a unique address in memory.1.2 An object has an interfaceAristotle was probably the first to begin a careful study of the concept of type; he spoke of “the class of fishes and the class of birds.” The idea that all objects, while being unique, are also pa
19、rt of a class of objects that have characteristics and behaviors in common was used directly in the first object-oriented language, Simula-67, with its fundamental keyword class that introduces a new type into a program. Simula, as its name implies, was created for developing simulations such as the
20、 classic “bank teller problem.” In this, you have a bunch of tellers, customers, accounts, transactions, and units of moneya lot of “objects.” Objects that are identical except for their state during a programs execution are grouped together into “classes of objects” and thats where the keyword clas
21、s came from. Creating abstract data types (classes) is a fundamental concept in object-oriented programming. Abstract data types work almost exactly like built-in types: You can create variables of a type (called objects or instances in object-oriented parlance) and manipulate those variables (calle
22、d sending messages or requests; you send a message and the object figures out what to do with it). The members (elements) of each class share some commonality: every account has a balance, every teller can accept a deposit, etc. At the same time, each member has its own state: each account has a dif
23、ferent balance, each teller has a name. Thus, the tellers, customers, accounts, transactions, etc., can each be represented with a unique entity in the computer program. This entity is the object, and each object belongs to a particular class that defines its characteristics and behaviors. So, altho
24、ugh what we really do in object-oriented programming is create new data types, virtually all object-oriented programming languages use the “class” keyword. When you see the word “type” think “class” and vice versa.Since a class describes a set of objects that have identical characteristics (data ele
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
20 积分
下载 | 加入VIP,下载更划算! |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机专业 毕业设计 论文 外文 文献 中英文 翻译 java 对象