在线图书管理系统外文文献原文及译文

上传人:da****ge 文档编号:75529839 上传时间:2022-04-15 格式:DOC 页数:11 大小:51.50KB
收藏 版权申诉 举报 下载
在线图书管理系统外文文献原文及译文_第1页
第1页 / 共11页
在线图书管理系统外文文献原文及译文_第2页
第2页 / 共11页
在线图书管理系统外文文献原文及译文_第3页
第3页 / 共11页
资源描述:

《在线图书管理系统外文文献原文及译文》由会员分享,可在线阅读,更多相关《在线图书管理系统外文文献原文及译文(11页珍藏版)》请在装配图网上搜索。

1、 毕业设计说明书英文文献及中文翻译 班 级: 学号: 软件学院姓 名: 软件工程学 院: 专 业: 指导教师: 2014 年 6 月An Introduction to JavaThe first release of Java in 1996 generated an incredible amount of excitement, not just in the computer press, but in mainstream media such as The New York Times, The Washington Post, and Business Week. Java ha

2、s the distinction of being the first and only programming language that had a ten-minute story on National Public Radio. A $100,000,000 venture capital fund was set up solely for products produced by use of a specific computer language. It is rather amusing to revisit those heady times, and we give

3、you a brief history of Java in this chapter. In the first edition of this book, we had this to write about Java: “As a computer language, Javas hype is overdone: Java is certainly a good program-ming language. There is no doubt that it is one of the better languages available to serious programmers.

4、 We think it could potentially have been a great programming language, but it is probably too late for that. Once a language is out in the field, the ugly reality of compatibility with existing code sets in.” Our editor got a lot of flack for this paragraph from someone very high up at Sun Micro- sy

5、stems who shall remain unnamed. But, in hindsight, our prognosis seems accurate. Java has a lot of nice language featureswe examine them in detail later in this chapter. It has its share of warts, and newer additions to the language are not as elegant as the original ones because of the ugly reality

6、 of compatibility. But, as we already said in the first edition, Java was never just a language. There are lots of programming languages out there, and few of them make much of a splash. Java is a whole platform, with a huge library, containing lots of reusable code, and an execution environment tha

7、t provides services such as security, portability across operating sys-tems, and automatic garbage collection. As a programmer, you will want a language with a pleasant syntax and comprehensible semantics (i.e., not C+). Java fits the bill, as do dozens of other fine languages. Some languages give y

8、ou portability, garbage collection, and the like, but they dont have much of a library, forcing you to roll your own if you want fancy graphics or network- ing or database access. Well, Java has everythinga good language, a high-quality exe- cution environment, and a vast library. That combination i

9、s what makes Java an irresistible proposition to so many programmers.Simple We wanted to build a system that could be programmed easily without a lot of eso- teric training and which leveraged todays standard practice. So even though we found that C+ was unsuitable, we designed Java as closely to C+

10、 as possible in order to make the system more comprehensible. Java omits many rarely used, poorly understood, confusing features of C+ that, in our experience, bring more grief than benefit. The syntax for Java is, indeed, a cleaned-up version of the syntax for C+. There is no need for header files,

11、 pointer arithmetic (or even a pointer syntax), structures, unions, operator overloading, virtual base classes, and so on. (See the C+ notes interspersed throughout the text for more on the differences between Java and C+.) The designers did not, however, attempt to fix all of the clumsy features of

12、 C+. For example, the syn- tax of the switch statement is unchanged in Java. If you know C+, you will find the tran- sition to the Java syntax easy. If you are used to a visual programming environment (such as Visual Basic), you will not find Java simple. There is much strange syntax (though it does

13、 not take long to get the hang of it). More important, you must do a lot more programming in Java. The beauty of Visual Basic is that its visual design environment almost automatically pro- vides a lot of the infrastructure for an application. The equivalent functionality must be programmed manually

14、, usually with a fair bit of code, in Java. There are, however, third-party development environments that provide “drag-and-drop”-style program development. Another aspect of being simple is being small. One of the goals of Java is to enable the construction of software that can run stand-alone in s

15、mall machines. The size of the basic interpreter and class support is about 40K bytes; adding the basic stan- dard libraries and thread support (essentially a self-contained microkernel) adds an additional 175K. This was a great achievement at the time. Of course, the library has since grown to huge

16、 proportions. There is now a separate Java Micro Edition with a smaller library, suitable for embedded devices. Object Oriented Simply stated, object-oriented design is a technique for programming that focuses on the data (= objects) and on the interfaces to that object. To make an analogy with carp

17、entry, an “object-oriented” carpenter would be mostly concerned with the chair he was building, and secondarily with the tools used to make it; a “non-object- oriented” carpenter would think primarily of his tools. The object-oriented facilities of Java are essentially those of C+.Object orientation

18、 has proven its worth in the last 30 years, and it is inconceivable that a modern programming language would not use it. Indeed, the object-oriented features of Java are comparable to those of C+. The major difference between Java and C+ lies in multiple inheritance, which Java has replaced with the

19、 simpler concept of interfaces, and in the Java metaclass model (which we discuss in Chapter 5). NOTE: If you have no experience with object-oriented programming languages, you will want to carefully read Chapters 4 through 6. These chapters explain what object-oriented programming is and why it is

20、more useful for programming sophisticated projects than are traditional, procedure-oriented languages like C or Basic. Network-Savvy Java has an extensive library of routines for coping with TCP/IP protocols like HTTP and FTP. Java applications can open and access objects across the Net via URLs wit

21、h the same ease as when accessing a local file system. We have found the networking capabilities of Java to be both strong and easy to use. Anyone who has tried to do Internet programming using another language will revel in how simple Java makes onerous tasks like opening a socket connection. (We c

22、over net- working in Volume II of this book.) The remote method invocation mechanism enables communication between distributed objects (also covered in Volume II).Robust Java is intended for writing programs that must be reliable in a variety of ways. Java puts a lot of emphasis on early checking fo

23、r possible problems, later dynamic (runtime) checking, and eliminating situations that are error-prone. The single biggest difference between Java and C/C+ is that Java has a pointer model that eliminates the possibility of overwriting memory and corrupting data. This feature is also very useful. Th

24、e Java compiler detects many problems that, in other languages, would show up only at runtime. As for the second point, anyone who has spent hours chasing memory corruption caused by a pointer bug will be very happy with this feature of Java. If you are coming from a language like Visual Basic that

25、doesnt explicitly use pointers, you are probably wondering why this is so important. C programmers are not so lucky. They need pointers to access strings, arrays, objects, and even files. In Visual Basic, you do not use pointers for any of these entities, nor do you need to worry about memory alloca

26、tion for them. On the other hand, many data structures are difficult to implement in a pointerless language. Java gives you the best of both worlds. You do not need point- ers for everyday constructs like strings and arrays. You have the power of pointers if you need it, for example, for linked list

27、s. And you always have complete safety, because you can never access a bad pointer, make memory allocation errors, or have to protect against memory leaking away.Architecture Neutral The compiler generates an architecture-neutral object file formatthe compiled code is executable on many processors,

28、given the presence of the Java runtime sys- tem. The Java compiler does this by generating bytecode instructions which have nothing to do with a particular computer architecture. Rather, they are designed to be both easy to interpret on any machine and easily translated into native machine code on t

29、he fly. This is not a new idea. More than 30 years ago, both Niklaus Wirths original implemen- tation of Pascal and the UCSD Pascal system used the same technique. Of course, interpreting bytecodes is necessarily slower than running machine instruc- tions at full speed, so it isnt clear that this is

30、 even a good idea. However, virtual machines have the option of translating the most frequently executed bytecode sequences into machine code, a process called just-in-time compilation. This strategy has proven so effective that even Microsofts .NET platform relies on a virtual machine. The virtual

31、machine has other advantages. It increases security because the virtual machine can check the behavior of instruction sequences. Some programs even produce bytecodes on the fly, dynamically enhancing the capabilities of a running program.Portable Unlike C and C+, there are no “implementation-depende

32、nt” aspects of the specifi- cation. The sizes of the primitive data types are specified, as is the behavior of arith- metic on them. For example, an int in Java is always a 32-bit integer. In C/C+, int can mean a 16-bit integer, a 32-bit integer, or any other size that the compiler vendor likes. The

33、 only restriction is that the int type must have at least as many bytes as a short int and cannot have more bytes than a long int. Having a fixed size for number types eliminates a major porting headache. Binary data is stored and transmitted in a fixed format, eliminating confusion about byte order

34、ing. Strings are saved in a standard Unicode format. The libraries that are a part of the system define portable interfaces. For example, there is an abstract Window class and implementations of it for UNIX, Windows, and the Macintosh. As anyone who has ever tried knows, it is an effort of heroic pr

35、oportions to write a pro- gram that looks good on Windows, the Macintosh, and ten flavors of UNIX. Java 1.0 made the heroic effort, delivering a simple toolkit that mapped common user interface elements to a number of platforms. Unfortunately, the result was a library that, with a lot of work, could

36、 give barely acceptable results on different systems. (And there were often different bugs on the different platform graphics implementations.) But it was a start. There are many applications in which portability is more important than user interface slickness, and these applications did benefit fro

37、m early versions of Java. By now, the user interface toolkit has been completely rewritten so that it no longer relies on the host user interface. The result is far more consistent and, we think, more attrac- tive than in earlier versions of Java. Interpreted The Java interpreter can execute Java by

38、tecodes directly on any machine to which the interpreter has been ported. Since linking is a more incremental and lightweight process, the development process can be much more rapid and exploratory. Incremental linking has advantages, but its benefit for the development process is clearly overstated

39、. Early Java development tools were, in fact, quite slow. Today, the bytecodes are translated into machine code by the just-in-time compiler.Multithreaded The benefits of multithreading are better interactive responsiveness and real-time behavior. If you have ever tried to do multithreading in anoth

40、er language, you will be pleasantly surprised at how easy it is in Java. Threads in Java also can take advantage of multi- processor systems if the base operating system does so. On the downside, thread imple- mentations on the major platforms differ widely, and Java makes no effort to be platform i

41、ndependent in this regard. Only the code for calling multithreading remains the same across machines; Java offloads the implementation of multithreading to the underlying operating system or a thread library. Nonetheless, the ease of multithread- ing is one of the main reasons why Java is such an ap

42、pealing language for server-side development.Java程序设计概述1996年Java第一次发布就引起了人们的极大兴趣。关注Java的人士不仅限于计算机出版界,还有诸如纽约时报、华盛顿邮报、商业周刊这样的主流媒体。Java是第一种也是唯一的一种在national Public Radio上占用了十分钟时间进行介绍的程序设计语言,并且还得到了$100000000的风险投资基金。这些基金全部用来支持用这种特别的计算机语言开发的产品,重温那些令人兴奋的日子是很有意思的。本章将简要的介绍一下Java语言的发展历史。本书的第一版是这样描写Java的:“作为一种计

43、算机语言,Java的广告词确实有点儿夸大其词,然而,Java的确是一种优秀的的程序设计语言。作为一个名副其实的程序设计人员,使用Java无疑是一个好的选择,有人认为:Java有望成为一种最优秀的程序设计语言,但还需要一个相当长的发展时期。一旦一种语言应用于某个领域,与现存代码的相容性问题就摆在了人们的面前。”我们的编辑手中有很多这样的广告词,这是sun公司高层的某位不愿透露姓名提供的。然而,现在看起来,当初的这些预测还是有一定的准确性的。Java有许多非常优秀的程序语言特性,本章稍后会详细地讨论这些特性。由于相容性这个严峻的问题确实存在于现实中,所以,或多或少的还是有一些“累赘”被加到语言中,

44、这就导致Java并不如想象的中的那么完美无瑕。但是,正像我们在第一版中已经指出的那样,Java并不只是一种语言。在此之前出现的那么多种语言也没有能够引起那么大的轰动。Java是一个完整的平台,有一个庞大的库,其中包含了很多可重用的代码和一个提供诸如安全性、跨操作系统的可移植性以及自动垃圾收集等服务的执行环境。作为一名程序设计人员,常常希望能够有一种语言,它具有令人赏心悦目的语法和易于理解的语义(C+不是这样的)。与许多其他的优秀语言一样,Java恰恰满足了这些要求。有些语言提供了可移植性,垃圾收集器等等,但是,没有提供一个大型的库,如果想要有奇特的绘图功能,网络连接功能和数据库存取功能就必须自

45、己动手编写代码。Java这种功能齐全的出色语言,具有高质量的执行环境以及庞大的库。正是因为它集多种优势于一身,所以对广大的程序设计人员有着不可抗拒的吸引力。简单性 人们希望构建一个无需深奥的专业训练就可以进行编程的系统,并且要符合当今的标准惯例。因此,尽管人们发现C+不太适用,但在设计Java的时候还是尽可能地接近C+,以便系统更易于理解。Java剔除了C+中许多很少使用、难以理解、易混淆的特性。在目前看来,这些特性带来的麻烦远远多于其带来的好处。的确,Java语法是C+语法的一个“纯净版本。这里没有头文件、指针运算(甚至指针语法)、结构、联合、操作符重载、虚基类等等(请参阅本书各个章节给出的

46、C+注释,那里比较详细地解释了Java与C+之间的区别)然而,设计者并没有试图清除C+中所有不适当的特性。例如,switch语句的语法在Java中就没有改变。如果知道C+就会发现可以轻而易举地将其转换成Java。 如果已经习惯于使用可视化的编程环境(例如Visual Basic),你就不会觉得Java简单了。Java有许多奇怪的语法(尽管掌握其要领并不需要很长时间),更重要的是,使用Java需要自己编写大量的程序o Visual Basic的魅力在于它的可视化设计环境几乎自动地为应用程序提供了大量的基础结构。而使用Java实现同样的功能却需要手工地编制代码,通常代码量还相当大。然而,已经有一些

47、支持“拖放”风格程序开发的第三方开发环境。 简单的另一个方面是小。Java的目标之一是支持开发能够在小型机器上独立运行 的软件。基本的解释器以及类支持大约仅为40KB;再加上基础的标准类库和对线程的支持(基本上是一个白包含的微内核)大约需要增加175KB。在当时,这是一个了不起的成就。当然,由于不断的扩展,类库已经相当庞大了。现在有一个独立的具有较小类库的Java微型版(Java Micro Edition)用于嵌入式设备。面向对象 简单地讲,面向对象设计是一种程序设计技术。它将重点放在数据(即对象)和对象的接口上。用木匠打一个比方,一个“面向对象的”木匠始终关注的是所制作的 椅子,第二位才是

48、所使用的工具;一个非面向对象的”木匠首先考虑的是所用的工 具。在本质上,Java的面向对象能力与C+是一样的。 在过去的30年里,面向对象已经证明了自身的价值,一种现代的程序设计语言不使用面向对象技术简直让人难以置信。的确,Java的面向对象特性与C+旗鼓相当。 Java与C+的主要不同点在于多继承,在Java,取而代之的是简单的接口概念,以及Java的元类(metaclass)模型(有关这部分内容将在第5章中讨论)。如果没有使用面向对象程序设计语言的经验,你一定要仔细阅读第4章第6章。这些章节解释了什么是面向对象程序设计以及在煽程实现复杂的项目时为什么比传统的像C或Basic这样的面向过程的

49、语言更加有效。网络技能 Java有一个扩展的例程库,用于处理像HTTP和FTP这类的TCP/IP协议。Java应用程序能够通过URL打开和访问网络上的对象,其便捷程度就好像访问本地文件一样。 人们已经看到Java的网络能力强大且易于使用。任何曾经试图使用其他语言进行网络编程的人都会惊呼Java竟然把类似打开socket连接这类繁重的任务都变得如此简单(在本书的卷II中介绍网络连接)。另外,远程方法调用机制使得分布式对象之间可以进行通信(也将在卷II中介绍)。健壮性Java的设计目标之一在于使得Java编写的程序具有多方面的可靠性。Java投入了大量的精力进行早期的问题检测、后期动态的(运行时)

50、检测,并消除了有出错倾向的状态。Java和C+最大的不同在于Java采用的指针模型可以消除重写内存和损坏数据的可能性。这个特性非常有用。Java编译器能够检测许多在其他语言中仅在运行时刻才能够检测出来的问题。至于第二点,对于曾经花费几个小时来检查由于指针bug而引起内存冲突的人来说,一定很喜欢Java的这一特性。如果曾经只使用过Visual Basic这类没有显式指针的语言,你就会感觉这么说似乎有些小题大做了。然而,C程序员就没有这样幸运了。他们需要利用指针存取字符串、数组、对象、甚至文件。在Visual Basic中,根本不必使用指针访问这些实体,也不必关心宥关内存分配的问题另一方面,在没有

51、指针的语言中,许多数据结构很难实现o Java具有双方的优势。它不需要使用指针构造诸如字符串,数组这样的结构。如果必要的话,它也能够具有指针的能力,如链表。Java绝对是安全的,其原因是永远不会存取一个“坏的”指针,造成内存分配的错误,也不必防范内存泄漏。体系结构中立 编译器生成一个体系结构中立的目标文件格式,这是一种缡译过的代码,只要有Java运行系统,就可以在许多处理器上运行。JaVa编译器通过生成与特定的计算机 体系结构无关的字节码指令来实现这一特性。精心设计的字节码不仅可以很容易地在 任何机器上解释执行,而且还可以迅速地翻译成本地机器的代码。这并不是什么新的思路。30多年以前Nikla

52、us Wirth实现的原始Pascal以及UCSD Pascal系统都使用了这种技术。当然,解释字节码肯定会比全速地运行机器指令慢很多。所以说,这是不是一个好的思路还很难讲!然而,虚拟机有一个选项,可以将使用最频繁的字节码序列翻译成机器码,这一过程被称为即时编译。这一策略已经证明十分有效,致使微软的NET平台也依赖于虚拟机。虚拟机还有一些其他的优点。虚拟机可以检测指令序到的行为,以增强其安全性。有些程序还可以快速地生成字节码,并动态地增强所运行程序的处理能力。可移植性 与C和C+不同,Java规范中没有“依赖具体实现的地方。基本数据类型的大小以及有关算法都做了明确的说明。例如,Java中的in

53、t永远为32位的整数,而在C/C+中,int可能是16位整数、32位整数,也可能是编译器提供商指定的其他大小。惟一的限制只是int类型的大小不能低于short int,并且不能高于long int.在Java中,数据类型具有固定的大小,这消除了代码移植时令人头痛的主要问题。二进制数据以固定的格式进行的存储和传输,消除了字节顺序的困扰。字符串是用标准的Unicodc格式存储的。 作为系统组成部分的类库,定义了可移植的接口。例如,有一个抽象的Window类给出了在UNIX、Windows和Macintosh环境下的不同实现。凡是尝试过的人都知道,要编写一个在WindowS、Macintosh和lO

54、种不同风格的、在UNIX上看起来都不错的程序有多么困难。 Java l.0就尝试着做了这么一个壮举,发布了一个将常用的用户界面元素映射到不同平台上的简单工具箱。遗憾的是,花费了大量的心血,却构建了一个在各个平台上都难以让人接受的库(面且,在不同平台的图形实现中有不同的bug)。不过,这毕竟是个开端。对于许多应用问题来说,可移植性比华而不实的用户界面更加重要而且这些应用程序从Java的早期版本中获益匪浅。现在,用户界面工具箱已经完全重写了,不再依赖于主机的用户接口。现在的Java版本比早期版本更加稳定,更加吸引人。解释型 Java解释器可以在任何移植了解释器的机器上执行Java字节码。由于链接是

55、一个增值且简便的过程,所以,开发过程也变得更加快捷,更加具有探索性。增值链接有其优势,但给开发过程带来的好处显然是言过其实了。事实上,早期的Java开发工具的速度相当慢。现在,使用即时编译器将字节码翻译成机器码大大提高速度。多线程 多线程可以带来更好的交互响应和实时行为。如果曾经使用过其他语言编写多线程的应用程序,就会对Java多线程处理的便捷性惊叹不已。只要操作系统支持,Java中的线程就可以利用多个处理器。在底层,主流平台的线程实现机制各不相同,Java并没有花费太大的力气对此实现平台无关性。在不同的机器上,只是调用多线程的代码完全相同Java把多线程的实现交给了底层的操作系统或线程库来完成。尽管如此,多线程编译的简单性是Java成为颇具魅力的服务器端开发语言的主要原因之一。第 5 页 共 5 页

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!