《计算机通信中英文对照外文翻译文献.docx》由会员分享,可在线阅读,更多相关《计算机通信中英文对照外文翻译文献.docx(16页珍藏版)》请在三一办公上搜索。
1、计算机通信中英文对照外文翻译文献中英文对照外文翻译文献 (文档含英文原文和中文翻译) 译文: Java编程思想 Bruce Eckel Java和因特网 事实上Java 不过另一种类型的程序设计语言,大家可能会问它为什么会如此重要,为什么还有这么多的人认为它是计算机程序设计的一个里程碑呢?。Java 除了可解决传统的程序设计问题以外,还能解决World Wide Web上的编程问题。 什么是wbe? Web 这个词刚开始显得有些神秘,“冲浪”、“网上存在”以及“主页”等都是与之相关的说法。这些对于回顾和看清它的本质是有帮助的,但在这之前,必须理解客户机服务器系统的概念,这是充斥着许多令人迷惑的
2、问题的另一方面。 客户机服务器计算 户机/服务器系统的主要思想是,在一个中央信息存储库存放各种类型的数据,一般情况下在这个数据库中,你可以按照人或机器的需求进行分配。由于客户机/服务器的关键概念是信息集中的存储库,以至于这些信息可以随意更改并将其更改后的信息传递给客户。综上所述,信息存储库,软件分发信息,信息和软件所在的机器(s)被称为服务器。软件安装在远程机器上,与服务器通信,获取信息,处理它,然后将其显示在机器上被称为客户端。一个客户机/服务器的关键概念是信息集中的存储库,可以改变等,这些变化将传播出去的信息消费者。综上所述,信息存储库,软件分发信息,信息和软件所在的机器(s)被称为服务器
3、。驻留在消费机的软件,与服务器通信,获取信息,处理它,然后将其显示在消费机器上被称为客户端。 其实客户机/服务器的基本概念不那么复杂。所面临的问题是一个服务器试图同时向多个用户提供服务。通常,数据库管理系统包含在其中,因此,设计师能平衡数据表的布局优化使用。此外,系统通常允许客户将新信息插入到一个服务器。这意味着您必须确保客户新数据不侵犯另一个客户的新数据,或者添加新数据到数据库时数据不会丢失的过程(这就是所谓的交易过程).客户端软件发生改变后,必须经过创建,调试,并安装在客户端机器上,变得比你想象中的更加复杂和昂贵。存在一个特殊的问题是要支持多种类型的计算机和操作系统。最后,至关重要的是性能
4、问题:在很多时候可能有数百个客户同时向服务器发出请求,所以延迟请求是至关重要的。通常为了减少延迟,程序员将努力处理客户端发出的任务,但有时可以分配给其他机器的网站,那就是所谓的中间件。(中间件也用于提高可维护性。) 分发信息的简单想法有很多层面上的复杂性,整个问题似乎无可救药的神秘。然而它的关键之处在于:客户机/服务器对处理结果做出粗略的解释约占整个编程过程的一半。负责接受所有的订单,信用卡交易数据分布stock市场,科学、*,你的名字。我们想出了在过去是个体解决个人问题,发明了一种新的解决方案。这些都是很难创建和难以使用,和用户必须为每一个学习一个新的接口。整个客户端/服务器的问题需要一个强
5、大的办法去解决。 Web 是一个巨大的服务器 网络实际上是一个巨大的客户机/服务器系统。有点复杂的是,因为所有的服务器和客户端存在单一网络上。但是你不需要全都了解,因为你该关心的是一次建立与一个服务器的连接(即使你可能要在全世界范围内寻找正确的服务器)。 最初它是一个简单的单向过程。你向服务器发出请求,然后它给你一个文件,本机机器的软件(即浏览器,客户端)将解释和格式化并显示到本地机器上。但在开始不久后人们想要做的就不仅仅是从服务器传递网页。他们想要获得完整的客户机/服务器功能,这样客户可以将信息反馈给服务器,例如,在数据库服务器上检索,添加新信息到服务器,或下订单(需要特殊安全措施)。我们已
6、经看到在网络发展上的这些变化。 Web浏览器的发展是一个巨大的进步:它的概念是一条信息可以在任何类型的计算机上显示。然而,原始的浏览器仍然相当原始,在用户要求迅速增多后陷入困境。他们的交互不是特别强,而且会阻塞服务器和因特网,因为每当你发出需要编程的请求是,必须将要处理的信息发送回服务器。可能需要几秒钟或几分钟时间才能找出在发出请求时的许多拼写错误的地方。因为浏览器只是一个查看程序所以无法执行最简单的计算任务。(另一方面,它是安全的,因为它无法在本地机器上执行任何程序,包括细菌或病毒)。 为了解决这个问题,人们采取了不同的方法。首先,对图形标准进行改进,使得浏览器能显示更好的动画和视频。为解决
7、剩下的问题可以通过在浏览器中运行程序。这就是所谓的客户端编程。 客户端编程 Web最初的服务器-浏览器的设计是为了提供交互式内容,但是,交互性是完全由服务器提供。服务器为客户端浏览器生成静态页面,静态网页将简单地解释并显示出来. 基本超文本标记语言(HTML)包含简单的数据收集机制:文字输入框,复选框、单选框、列表和下拉列表,还有一个按钮,只能用于重置表单上的数据以便回传到服务器. 提交的信息通过所有的Web服务器上通用网关接口(CGI)回传。包含在提交中的文本会告诉CGI如何处理它。最常见的操作是位于服务器上运行的一个程序,通常称为“目录。”(如果按下在地址窗口顶部的浏览器网页上看到的按钮时
8、,有时能看到“目录”内所有官样文章。)大多数语言都可以用来编写程序。通常会选择Perl,因为它是为文本处理和解释而设计的,所以它可以安装在任何服务器上,无论是什么处理器和操作系统。 今天许多强大的网站都是严格地建立在CGI的基础上,事实上,你可以用CGI做任何事情 。然而,Web站点建立在CGI程序上维护就突然变得过于复杂,还有响应时间的问题。CGI程序的响应取决于需要发送多少数据,以及服务器和互联网上的负担有多重。(而且开始一个CGI程序往往是缓慢的。)网络的最初设计者没有预见这带宽将会多么迅速地被人们开发出的各种应用程序耗尽。例如,任何形式的动态图形几乎是不可能连贯地显示,因为必须创建一个
9、图形交换格式(GIF)文件并从服务器转移到客户机,再将图形的变化从服务器传递给客户。此外,毫无疑问,大家已经经历过数据验证的过程,你按下页面上的提交按钮,数据被运送回服务器;服务器启动一个CGI程序发现错误,格式化HTML网页,反馈出现的错误,然后将页面发送回去;大家必须备份页面,再试一次。这不仅缓慢而且繁琐。解决的办法就是客户端的程序设计。本节的其余部分,将对这个问题进行概述,介绍在客户端编程的方法。 插件 朝客户端编程迈进的时候,最重要的一个问题就是插件的设计。这是一个为方便程序员将新功能添加到浏览器的方法,用户只要下载一段代码,插入到浏览器中适当的位置。它告诉浏览器,“从现在开始你可以执
10、行这个新活动。”(你只需要下载插件一次。)一些快速和强大的行为是通过插件添加到浏览器的,但是编写一个插件并不是一件容易的事情,也不是我们建立一个特定网站的过程中想要做的事情。对与客户端程序设计来说,插件的价值在于,它允许专业程序设计员开发扩展并将这些扩展添加到浏览器不必经过浏览器制造商的许可。因此,插件提供了一个“后门”,允许创建新的客户端设计语言(尽管不是所有的语言都能做为插件实现) 脚本语言 插件导致了浏览器脚本语言的发展。通过脚本语言,可将客户端程序的源代码直接嵌入到HTML页面,而对那种语言进行解释的插件会在HTML页面显示出来的时候被自动激活。脚本语言往往是相当容易理解的,因为他们只
11、是文本,HTML页面的一部分,只要向服务器发出对那个页面的一次请求就可以非常快的载入.。代价是我们的代码全都暴露出来被所有人都看到了。,然而,通常来说我们不会用脚本语言做非常复杂的事,所以这不是太大的阻碍。 期待中可以支持没有插件的Web浏览器一种脚本语言是JavaScript(这只有一个地方和java有相似之处,我们需要通过其他途径学习使用它。被命名为Java只是一种营销策略) 不幸的是,大多数Web浏览器一开始从另一个Web浏览器以不同的方式实现JavaScript,甚至是来自他们自己的其他版本的。ECMAScript有助于推进JavaScript的标准化形式的形成,但已经与各种浏览器脱轨
12、很长一段时间 了(因为它已经没有用了所以微软推出自己的VBScript格式,也有与JavaScript的模糊相似之处)。一般来说,您必须在JavaScript的一种程序的最小公因子以便能够在所有浏览器上运行。处理错误和调试JavaScript只能被描述为一片混乱。证明是困难的,最近才有人创建一块真正复杂的JavaScript(谷歌GMail),需要强大的奉献精神和专业知识。 内部Web浏览器使用的脚本语言是真真正面向解决特定类型问题的,其中主要是创造更加丰富和更具交互式图形的用户界面(gui)。然而,脚本语言可以解决80%在客户端编程中所遇到的问题。你所遇到的问题完全可能在这80%里,而且脚本
13、语言可以更简单和更快速地发展,所以在考虑其他更复杂的方案之前如Java编程,首先应想一下脚本语言是否可行。 Java 如果一种脚本语言可以解决80%的客户端编程的问题,那其他的20的“高难度的问题”又该怎么办呢?流行的一种解决方案是java。它不仅是一个功能强大而且安全,而且是跨平台的、与国际通用的的编程语言,但是java还在不断地扩展,提供的语言特性和库能够很好地处理在传统的编程语言中不能处理的问题,如多线程操作、数据库访问、网络编程和分布式计算。Java允许通过applet和Java Web Star进行客户端编程。 applet是一种很小的程序,将只运行在一个Web浏览器上。applet
14、自动下载网页的一部分(例如,正如一个图形自动下载)。当applet被激活时,它执行一个程序。它的优点是, 用户需要客户端软件的时候,它就会很快为你提供一种自动分发服务器的客户端软件。用户能很方便获得最新版本成功的重新安装客户端软件。由于Java的设计原理,程序员只需要创建一个项目,那个程序能在所有计算机浏览器以及安装Java解释器的浏览器中运行。 (这包括绝大多数机器的安全。) 由于Java是一种成熟的编程语言,你可以尽可能多的在客户端工作之前和服务器发出请求之后工作。例如,您不需要通过互联网发送一个请求形式由服务器发现你一个日期或其他参数的错误。而且计算机的客户端可以快速的做校验工作替代你在
15、计算机前等待服务器的响应。不仅直接提高了速度和响应能力,而且一般可以减少网络流量和服务器负担,防止整个互联网运行速度变慢。 注:本文摘自JAVA编程思想一书中的第一章 原文: Thinking in Java Java and the Internet If Java is, in fact, yet another computer programming language, you may question why it is so important and why it is being promoted as a revolutionary step in computer prog
16、ramming. The answer isnt immediately obvious if youre coming from a traditional programming perspective. Although Java is very useful for solving traditional standalone programming problems, it is also important because it solves programming problems for the World Wide Web. What is the Web? The Web
17、can seem a bit of a mystery at first, with all this talk of “surfing,” “presence,” and “home pages.” Its helpful to step back and see what it really is, but to do this you must understand client/server systems, another aspect of computing thats full of confusing issues. Client/server computing The p
18、rimary idea of a client/server system is that you have a central repository of information some kind of data, usually in a databasethat you want to distribute on demand to some set of people or machines. A key to the client/server concept is that the repository of information is centrally located so
19、 that it can be changed and so that those changes will propagate out to the information consumers. Taken together, the information repository, the software that distributes the information, and the machine(s) where the information and software reside are called “the server.” The software that reside
20、s on the consumer machine, communicates with the server, fetches the information, processes it, and then displays it on the consumer machine is called the client. The basic concept of client/server computing, then, is not so complicated. The problems arise because you have a single server trying to
21、serve many clients at once. Generally, a database management system is involved, so the designer “balances” the layout of data into tables for optimal use. In addition, systems often allow a client to insert new information into a server. This means you must ensure that one clients new data doesnt w
22、alk over another clients new data, or that data isnt lost in the process of adding it to the database (this is called transaction processing). As client software changes, it must be built, debugged, and installed on the client machines, which turns out to be more complicated and expensive than you m
23、ight think. Its especially problematic to support multiple types of computers and operating systems. Finally, theres the all-important performance issue: You might have hundreds of clients making requests of your server at any moment, so a small delay can be critical. To minimize latency, programmer
24、s work hard to offload processing tasks, often to the client machine, but sometimes to other machines at the server site, using so-called middleware. (Middleware is also used to improve maintainability.) The simple idea of distributing information has so many layers of complexity that the whole prob
25、lem can seem hopelessly enigmatic. And yet its crucial: Client/server computing accounts for roughly half of all programming activities. Its responsible for everything from taking orders and credit-card transactions to the distribution of any kind of datastock market, scientific, government, you nam
26、e it. What weve come up with in the past is individual solutions to individual problems, inventing a new solution each time. These were hard to create and hard to use, and the user had to learn a new interface for each one. The entire client/server problem needed to be solved in a big way. The Web a
27、s a giant server The Web is actually one giant client/server system. Its a bit worse than that, since you have all the servers and clients coexisting on a single network at once. You dont need to know that, because all you care about is connecting to and interacting with one server at a time (even t
28、hough you might be hopping around the world in your search for the correct server). Initially it was a simple one-way process. You made a request of a server and it handed you a file, which your machines browser software (i.e., the client) would interpret by formatting onto your local machine. But i
29、n short order people began wanting to do more than just deliver pages from a server. They wanted full client/server capability so that the client could feed information back to the server, for example, to do database lookups on the server, to add new information to the server, or to place an order (
30、which requires special security measures). These are the changes weve been seeing in the development of the Web. The Web browser was a big step forward: the concept that one piece of information can be displayed on any type of computer without change. However, the original browsers were still rather
31、 primitive and rapidly bogged down by the demands placed on them. They werent particularly interactive, and tended to clog up both the server and the Internet because whenever you needed to do something that required programming you had to send information back to the server to be processed. It coul
32、d take many seconds or minutes to find out you had misspelled something in your request. Since the browser was just a viewer it couldnt perform even the simplest computing tasks. (On the other hand, it was safe, because it couldnt execute any programs on your local machine that might contain bugs or
33、 viruses.) To solve this problem, different approaches have been taken. To begin with, graphics standards have been enhanced to allow better animation and video within browsers. The remainder of the problem can be solved only by incorporating the ability to run programs on the client end, under the
34、browser. This is called client-side programming. Client-side programming The Webs initial server-browser design provided for interactive content, but the interactivity was completely provided by the server. The server produced static pages for the client browser, which would simply interpret and dis
35、play them. Basic HyperText Markup Language (HTML) contains simple mechanisms for data gathering: text-entry boxes, check boxes, radio boxes, lists and dropdown lists, as well as a button that could only be programmed to reset the data on the form or “submit” the data on the form back to the server.
36、This submission passes through the Common Gateway Interface (CGI) provided on all Web servers. The text within the submission tells CGI what to do with it. The most common action is to run a program located on the server in a directory thats typically called “cgi-bin.” (If you watch the address wind
37、ow at the top of your browser when you push a button on a Web page, you can sometimes see “cgi-bin” within all the gobbledygook there.) These programs can be written in most languages. Perl has been a common choice because it is designed for text manipulation and is interpreted, so it can be install
38、ed on any server regardless of processor or operating system. However, Python (www.Python.org) has been making inroads because of its greater power and simplicity. Many powerful Web sites today are built strictly on CGI, and you can in fact do nearly anything with CGI. However, Web sites built on CG
39、I programs can rapidly become overly complicated to maintain, and there is also the problem of response time. The response of a CGI program depends on how much data must be sent, as well as the load on both the server and the Internet. (On top of this, starting a CGI program tends to be slow.) The i
40、nitial designers of the Web did not foresee how rapidly this bandwidth would be exhausted for the kinds of applications people developed. For example, any sort of dynamic graphing is nearly impossible to perform with consistency because a Graphics Interchange Format (GIF) file must be created and mo
41、ved from the server to the client for each version of the graph. In addition, youve no doubt experienced the process of data validation for a Web input form. You press the submit button on a page; the data is shipped back to the server; the server starts a CGI program that discovers an error, format
42、s an HTML page informing you of the error, and then sends the page back to you; you must then back up a page and try again. Not only is this slow, its inelegant. The solution is client-side programming. Most desktop computers that run Web browsers are powerful engines capable of doing vast work, and
43、 with the original static HTML approach they are sitting there, just idly waiting for the server to dish up the next page. Client-side programming means that the Web browser is harnessed to do whatever work it can, and the result for the user is a much speedier and more interactive experience at you
44、r Web site. The problem with discussions of client-side programming is that they arent very different from discussions of programming in general. The parameters are almost the same, but the platform is different; a Web browser is like a limited operating system. In the end, you must still program, a
45、nd this accounts for the dizzying array of problems and solutions produced by client-side programming. The rest of this section provides an overview of the issues and approaches in client-side programming. Plug-ins One of the most significant steps forward in client-side programming is the developme
46、nt of the plug-in. This is a way for a programmer to add new functionality to the browser by downloading a piece of code that plugs itself into the appropriate spot in the browser. It tells the browser, “From now on you can perform this new activity.” (You need to download the plug-in only once.) So
47、me fast and powerful behavior is added to browsers via plug-ins, but writing a plug-in is not a trivial task, and isnt something youd want to do as part of the process of building a particular site. The value of the plug-in for client-side programming is that it allows an expert programmer to develo
48、p extensions and add those extensions to a browser without the permission of the browser manufacturer. Thus, plug-ins provide a “back door” that allows the creation of new client-side programming languages (although not all languages are implemented as plug-ins). Scripting languages Plug-ins resulte
49、d in the development of browser scripting languages. With a scripting language, you embed the source code for your client-side program directly into the HTML page, and the plug-in that interprets that language is automatically activated while the HTML page is being displayed. Scripting languages tend to be reasonably easy to understand and, because they are simply text that is part of an HTML page, they load ver