计算机通信中英文对照外文翻译文献_第1页
计算机通信中英文对照外文翻译文献_第2页
计算机通信中英文对照外文翻译文献_第3页
计算机通信中英文对照外文翻译文献_第4页
计算机通信中英文对照外文翻译文献_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

中英文对照外文翻译文献(文档含英文原文和中文翻译)译文:Java编程思想BruceEckelJava和因特网事实上Java不过另一种类型的程序设计语言,大家可能会问它为什么会如此重要,为什么还有这么多的人认为它是计算机程序设计的一个里程碑呢?。Java除了可解决传统的程序设计问题以外,还能解决WorldWideWeb(万维网)上的编程问题。什么是wbe?Web这个词刚开始显得有些神秘,“冲浪”、“网上存在”以及“主页”等都是与之相关的说法。这些对于回顾和看清它的本质是有帮助的,但在这之前,必须理解客户机/服务器系统的概念,这是充斥着许多令人迷惑的问题的另一方面。客户机/服务器计算户机/服务器系统的主要思想是,在一个中央信息存储库存放各种类型的数据,一般情况下在这个数据库中,你可以按照人或机器的需求进行分配。由于客户机/服务器的关键概念是信息集中的存储库,以至于这些信息可以随意更改并将其更改后的信息传递给客户。综上所述,信息存储库,软件分发信息,信息和软件所在的机器(s)被称为服务器。软件安装在远程机器上,与服务器通信,获取信息,处理它,然后将其显示在机器上被称为客户端。一个客户机/服务器的关键概念是信息集中的存储库,可以改变等,这些变化将传播出去的信息消费者。综上所述,信息存储库,软件分发信息,信息和软件所在的机器(s)被称为服务器。驻留在消费机的软件,与服务器通信,获取信息,处理它,然后将其显示在消费机器上被称为客户端。其实客户机/服务器的基本概念不那么复杂。所面临的问题是一个服务器试图同时向多个用户提供服务。通常,数据库管理系统包含在其中,因此,设计师能平衡数据表的布局优化使用。此外,系统通常允许客户将新信息插入到一个服务器。这意味着您必须确保客户新数据不侵犯另一个客户的新数据,或者添加新数据到数据库时数据不会丢失的过程(这就是所谓的交易过程).客户端软件发生改变后,必须经过创建,调试,并安装在客户端机器上,变得比你想象中的更加复杂和昂贵。存在一个特殊的问题是要支持多种类型的计算机和操作系统。最后,至关重要的是性能问题:在很多时候可能有数百个客户同时向服务器发出请求,所以延迟请求是至关重要的。通常为了减少延迟,程序员将努力处理客户端发出的任务,但有时可以分配给其他机器的网站,那就是所谓的中间件。(中间件也用于提高可维护性。)分发信息的简单想法有很多层面上的复杂性,整个问题似乎无可救药的神秘。然而它的关键之处在于:客户机/服务器对处理结果做出粗略的解释约占整个编程过程的一半。负责接受所有的订单,信用卡交易数据分布stock市场,科学、政府,你的名字。我们想出了在过去是个体解决个人问题,发明了一种新的解决方案。这些都是很难创建和难以使用,和用户必须为每一个学习一个新的接口。整个客户端/服务器的问题需要一个强大的办法去解决。Web是一个巨大的服务器网络实际上是一个巨大的客户机/服务器系统。有点复杂的是,因为所有的服务器和客户端存在单一网络上。但是你不需要全都了解,因为你该关心的是一次建立与一个服务器的连接(即使你可能要在全世界范围内寻找正确的服务器)。最初它是一个简单的单向过程。你向服务器发出请求,然后它给你一个文件,本机机器的软件(即浏览器,客户端)将解释和格式化并显示到本地机器上。但在开始不久后人们想要做的就不仅仅是从服务器传递网页。他们想要获得完整的客户机/服务器功能,这样客户可以将信息反馈给服务器,例如,在数据库服务器上检索,添加新信息到服务器,或下订单(需要特殊安全措施)。我们已经看到在网络发展上的这些变化。Web浏览器的发展是一个巨大的进步:它的概念是一条信息可以在任何类型的计算机上显示。然而,原始的浏览器仍然相当原始,在用户要求迅速增多后陷入困境。他们的交互不是特别强,而且会阻塞服务器和因特网,因为每当你发出需要编程的请求是,必须将要处理的信息发送回服务器。可能需要几秒钟或几分钟时间才能找出在发出请求时的许多拼写错误的地方。因为浏览器只是一个查看程序所以无法执行最简单的计算任务。(另一方面,它是安全的,因为它无法在本地机器上执行任何程序,包括细菌或病毒)。为了解决这个问题,人们采取了不同的方法。首先,对图形标准进行改进,使得浏览器能显示更好的动画和视频。为解决剩下的问题可以通过在浏览器中运行程序。这就是所谓的客户端编程。客户端编程Web最初的服务器--浏览器的设计是为了提供交互式内容,但是,交互性是完全由服务器提供。服务器为客户端浏览器生成静态页面,静态网页将简单地解释并显示出来.基本超文本标记语言(HTML)包含简单的数据收集机制:文字输入框,复选框、单选框、列表和下拉列表,还有一个按钮,只能用于重置表单上的数据以便回传到服务器.提交的信息通过所有的Web服务器上通用网关接口(CGI)回传。包含在提交中的文本会告诉CGI如何处理它。最常见的操作是位于服务器上运行的一个程序,通常称为“目录。”(如果按下在地址窗口顶部的浏览器网页上看到的按钮时,有时能看到“目录”内所有官样文章。)大多数语言都可以用来编写程序。通常会选择Perl,因为它是为文本处理和解释而设计的,所以它可以安装在任何服务器上,无论是什么处理器和操作系统。今天许多强大的网站都是严格地建立在CGI的基础上,事实上,你可以用CGI做任何事情。然而,Web站点建立在CGI程序上维护就突然变得过于复杂,还有响应时间的问题。CGI程序的响应取决于需要发送多少数据,以及服务器和互联网上的负担有多重。(而且开始一个CGI程序往往是缓慢的。)网络的最初设计者没有预见这带宽将会多么迅速地被人们开发出的各种应用程序耗尽。例如,任何形式的动态图形几乎是不可能连贯地显示,因为必须创建一个图形交换格式(GIF)文件并从服务器转移到客户机,再将图形的变化从服务器传递给客户。此外,毫无疑问,大家已经经历过数据验证的过程,你按下页面上的提交按钮,数据被运送回服务器;服务器启动一个CGI程序发现错误,格式化HTML网页,反馈出现的错误,然后将页面发送回去;大家必须备份页面,再试一次。这不仅缓慢而且繁琐。解决的办法就是客户端的程序设计。本节的其余部分,将对这个问题进行概述,介绍在客户端编程的方法。插件朝客户端编程迈进的时候,最重要的一个问题就是插件的设计。这是一个为方便程序员将新功能添加到浏览器的方法,用户只要下载一段代码,插入到浏览器中适当的位置。它告诉浏览器,“从现在开始你可以执行这个新活动。”(你只需要下载插件一次。)一些快速和强大的行为是通过插件添加到浏览器的,但是编写一个插件并不是一件容易的事情,也不是我们建立一个特定网站的过程中想要做的事情。对与客户端程序设计来说,插件的价值在于,它允许专业程序设计员开发扩展并将这些扩展添加到浏览器不必经过浏览器制造商的许可。因此,插件提供了一个“后门”,允许创建新的客户端设计语言(尽管不是所有的语言都能做为插件实现)脚本语言插件导致了浏览器脚本语言的发展。通过脚本语言,可将客户端程序的源代码直接嵌入到HTML页面,而对那种语言进行解释的插件会在HTML页面显示出来的时候被自动激活。脚本语言往往是相当容易理解的,因为他们只是文本,HTML页面的一部分,只要向服务器发出对那个页面的一次请求就可以非常快的载入.。代价是我们的代码全都暴露出来被所有人都看到了。,然而,通常来说我们不会用脚本语言做非常复杂的事,所以这不是太大的阻碍。期待中可以支持没有插件的Web浏览器一种脚本语言是JavaScript(这只有一个地方和java有相似之处,我们需要通过其他途径学习使用它。被命名为Java只是一种营销策略)不幸的是,大多数Web浏览器一开始从另一个Web浏览器以不同的方式实现JavaScript,甚至是来自他们自己的其他版本的。ECMAScript有助于推进JavaScript的标准化形式的形成,但已经与各种浏览器脱轨很长一段时间了(因为它已经没有用了所以微软推出自己的VBScript格式,也有与JavaScript的模糊相似之处)。一般来说,您必须在JavaScript的一种程序的最小公因子以便能够在所有浏览器上运行。处理错误和调试JavaScript只能被描述为一片混乱。证明是困难的,最近才有人创建一块真正复杂的JavaScript(谷歌GMail),需要强大的奉献精神和专业知识。内部Web浏览器使用的脚本语言是真真正面向解决特定类型问题的,其中主要是创造更加丰富和更具交互式图形的用户界面(gui)。然而,脚本语言可以解决80%在客户端编程中所遇到的问题。你所遇到的问题完全可能在这80%里,而且脚本语言可以更简单和更快速地发展,所以在考虑其他更复杂的方案之前如Java编程,首先应想一下脚本语言是否可行。Java如果一种脚本语言可以解决80%的客户端编程的问题,那其他的20的“高难度的问题”又该怎么办呢?流行的一种解决方案是java。它不仅是一个功能强大而且安全,而且是跨平台的、与国际通用的的编程语言,但是java还在不断地扩展,提供的语言特性和库能够很好地处理在传统的编程语言中不能处理的问题,如多线程操作、数据库访问、网络编程和分布式计算。Java允许通过applet和JavaWebStar进行客户端编程。applet是一种很小的程序,将只运行在一个Web浏览器上。applet自动下载网页的一部分(例如,正如一个图形自动下载)。当applet被激活时,它执行一个程序。它的优点是,用户需要客户端软件的时候,它就会很快为你提供一种自动分发服务器的客户端软件。用户能很方便获得最新版本成功的重新安装客户端软件。由于Java的设计原理,程序员只需要创建一个项目,那个程序能在所有计算机浏览器以及安装Java解释器的浏览器中运行。(这包括绝大多数机器的安全。)由于Java是一种成熟的编程语言,你可以尽可能多的在客户端工作之前和服务器发出请求之后工作。例如,您不需要通过互联网发送一个请求形式由服务器发现你一个日期或其他参数的错误。而且计算机的客户端可以快速的做校验工作替代你在计算机前等待服务器的响应。不仅直接提高了速度和响应能力,而且一般可以减少网络流量和服务器负担,防止整个互联网运行速度变慢。注:本文摘自《JAVA编程思想》一书中的第一章原文:ThinkinginJavaJavaandtheInternetIfJavais,infact,yetanothercomputerprogramminglanguage,youmayquestionwhyitissoimportantandwhyitisbeingpromotedasarevolutionarystepincomputerprogramming.Theanswerisn’timmediatelyobviousifyou’recomingfromatraditionalprogrammingperspective.AlthoughJavaisveryusefulforsolvingtraditionalstandaloneprogrammingproblems,itisalsoimportantbecauseitsolvesprogrammingproblemsfortheWorldWideWeb.WhatistheWeb?TheWebcanseemabitofamysteryatfirst,withallthistalkof“surfing,”“presence,”and“homepages.”It’shelpfultostepbackandseewhatitreallyis,buttodothisyoumustunderstandclient/serversystems,anotheraspectofcomputingthat’sfullofconfusingissues.Client/servercomputingTheprimaryideaofaclient/serversystemisthatyouhaveacentralrepositoryofinformation—somekindofdata,usuallyinadatabase—thatyouwanttodistributeondemandtosomesetofpeopleormachines.Akeytotheclient/serverconceptisthattherepositoryofinformationiscentrallylocatedsothatitcanbechangedandsothatthosechangeswillpropagateouttotheinformationconsumers.Takentogether,theinformationrepository,thesoftwarethatdistributestheinformation,andthemachine(s)wheretheinformationandsoftwareresidearecalled“theserver.”Thesoftwarethatresidesontheconsumermachine,communicateswiththeserver,fetchestheinformation,processesit,andthendisplaysitontheconsumermachineiscalledtheclient.Thebasicconceptofclient/servercomputing,then,isnotsocomplicated.Theproblemsarisebecauseyouhaveasingleservertryingtoservemanyclientsatonce.Generally,adatabasemanagementsystemisinvolved,sothedesigner“balances”thelayoutofdataintotablesforoptimaluse.Inaddition,systemsoftenallowaclienttoinsertnewinformationintoaserver.Thismeansyoumustensurethatoneclient’snewdatadoesn’twalkoveranotherclient’snewdata,orthatdataisn’tlostintheprocessofaddingittothedatabase(thisiscalledtransactionprocessing).Asclientsoftwarechanges,itmustbebuilt,debugged,andinstalledontheclientmachines,whichturnsouttobemorecomplicatedandexpensivethanyoumightthink.It’sespeciallyproblematictosupportmultipletypesofcomputersandoperatingsystems.Finally,there’stheall-importantperformanceissue:Youmighthavehundredsofclientsmakingrequestsofyourserveratanymoment,soasmalldelaycanbecritical.Tominimizelatency,programmersworkhardtooffloadprocessingtasks,oftentotheclientmachine,butsometimestoothermachinesattheserversite,usingso-calledmiddleware.(Middlewareisalsousedtoimprovemaintainability.)Thesimpleideaofdistributinginformationhassomanylayersofcomplexitythatthewholeproblemcanseemhopelesslyenigmatic.Andyetit’scrucial:Client/servercomputingaccountsforroughlyhalfofallprogrammingactivities.It’sresponsibleforeverythingfromtakingordersandcredit-cardtransactionstothedistributionofanykindofdata—stockmarket,scientific,government,younameit.Whatwe’vecomeupwithinthepastisindividualsolutionstoindividualproblems,inventinganewsolutioneachtime.Thesewerehardtocreateandhardtouse,andtheuserhadtolearnanewinterfaceforeachone.Theentireclient/serverproblemneededtobesolvedinabigway.TheWebasagiantserverTheWebisactuallyonegiantclient/serversystem.It’sabitworsethanthat,sinceyouhavealltheserversandclientscoexistingonasinglenetworkatonce.Youdon’tneedtoknowthat,becauseallyoucareaboutisconnectingtoandinteractingwithoneserveratatime(eventhoughyoumightbehoppingaroundtheworldinyoursearchforthecorrectserver).Initiallyitwasasimpleone-wayprocess.Youmadearequestofaserverandithandedyouafile,whichyourmachine’sbrowsersoftware(i.e.,theclient)wouldinterpretbyformattingontoyourlocalmachine.Butinshortorderpeoplebeganwantingtodomorethanjustdeliverpagesfromaserver.Theywantedfullclient/servercapabilitysothattheclientcouldfeedinformationbacktotheserver,forexample,tododatabaselookupsontheserver,toaddnewinformationtotheserver,ortoplaceanorder(whichrequiresspecialsecuritymeasures).Thesearethechangeswe’vebeenseeinginthedevelopmentoftheWeb.TheWebbrowserwasabigstepforward:theconceptthatonepieceofinformationcanbedisplayedonanytypeofcomputerwithoutchange.However,theoriginalbrowserswerestillratherprimitiveandrapidlyboggeddownbythedemandsplacedonthem.Theyweren’tparticularlyinteractive,andtendedtoclogupboththeserverandtheInternetbecausewheneveryouneededtodosomethingthatrequiredprogrammingyouhadtosendinformationbacktotheservertobeprocessed.Itcouldtakemanysecondsorminutestofindoutyouhadmisspelledsomethinginyourrequest.Sincethebrowserwasjustavieweritcouldn’tperformeventhesimplestcomputingtasks.(Ontheotherhand,itwassafe,becauseitcouldn’texecuteanyprogramsonyourlocalmachinethatmightcontainbugsorviruses.)Tosolvethisproblem,differentapproacheshavebeentaken.Tobeginwith,graphicsstandardshavebeenenhancedtoallowbetteranimationandvideowithinbrowsers.Theremainderoftheproblemcanbesolvedonlybyincorporatingtheabilitytorunprogramsontheclientend,underthebrowser.Thisiscalledclient-sideprogramming.Client-sideprogrammingTheWeb’sinitialserver-browserdesignprovidedforinteractivecontent,buttheinteractivitywascompletelyprovidedbytheserver.Theserverproducedstaticpagesfortheclientbrowser,whichwouldsimplyinterpretanddisplaythem.BasicHyperTextMarkupLanguage(HTML)containssimplemechanismsfordatagathering:text-entryboxes,checkboxes,radioboxes,listsanddropdownlists,aswellasabuttonthatcouldonlybeprogrammedtoresetthedataontheformor“submit”thedataontheformbacktotheserver.ThissubmissionpassesthroughtheCommonGatewayInterface(CGI)providedonallWebservers.ThetextwithinthesubmissiontellsCGIwhattodowithit.Themostcommonactionistorunaprogramlocatedontheserverinadirectorythat’stypicallycalled“cgi-bin.”(IfyouwatchtheaddresswindowatthetopofyourbrowserwhenyoupushabuttononaWebpage,youcansometimessee“cgi-bin”withinallthegobbledygookthere.)Theseprogramscanbewritteninmostlanguages.Perlhasbeenacommonchoicebecauseitisdesignedfortextmanipulationandisinterpreted,soitcanbeinstalledonanyserverregardlessofprocessororoperatingsystem.However,Python(www.P)hasbeenmakinginroadsbecauseofitsgreaterpowerandsimplicity.ManypowerfulWebsitestodayarebuiltstrictlyonCGI,andyoucaninfactdonearlyanythingwithCGI.However,WebsitesbuiltonCGIprogramscanrapidlybecomeoverlycomplicatedtomaintain,andthereisalsotheproblemofresponsetime.TheresponseofaCGIprogramdependsonhowmuchdatamustbesent,aswellastheloadonboththeserverandtheInternet.(Ontopofthis,startingaCGIprogramtendstobeslow.)TheinitialdesignersoftheWebdidnotforeseehowrapidlythisbandwidthwouldbeexhaustedforthekindsofapplicationspeopledeveloped.Forexample,anysortofdynamicgraphingisnearlyimpossibletoperformwithconsistencybecauseaGraphicsInterchangeFormat(GIF)filemustbecreatedandmovedfromtheservertotheclientforeachversionofthegraph.Inaddition,you’venodoubtexperiencedtheprocessofdatavalidationforaWebinputform.Youpressthesubmitbuttononapage;thedataisshippedbacktotheserver;theserverstartsaCGIprogramthatdiscoversanerror,formatsanHTMLpageinformingyouoftheerror,andthensendsthepagebacktoyou;youmustthenbackupapageandtryagain.Notonlyisthisslow,it’sinelegant.Thesolutionisclient-sideprogramming.MostdesktopcomputersthatrunWebbrowsersarepowerfulenginescapableofdoingvastwork,andwiththeoriginalstaticHTMLapproachtheyaresittingthere,justidlywaitingfortheservertodishupthenextpage.Client-sideprogrammingmeansthattheWebbrowserisharnessedtodowhateverworkitcan,andtheresultfortheuserisamuchspeedierandmoreinteractiveexperienceatyourWebsite.Theproblemwithdiscussionsofclient-sideprogrammingisthattheyaren’tverydifferentfromdiscussionsofprogrammingingeneral.Theparametersarealmostthesame,buttheplatformisdifferent;aWebbrowserislikealimitedoperatingsystem.Intheend,youmuststillprogram,andthisaccountsforthedizzyingarrayofproblemsandsolutionsproducedbyclient-sideprogramming.Therestofthissectionprovidesanoverviewoftheissuesandapproachesinclient-sideprogramming.Plug-insOneofthemostsignificantstepsforwardinclient-sideprogrammingisthedevelopmentoftheplug-in.Thisisawayforaprogrammertoaddnewfunctionalitytothebrowserbydownloadingapieceofcodethatplugsitselfintotheappropriatespotinthebrowser.Ittellsthebrowser,“Fromnowonyoucanperformthisnewactivity.”(Youneedtodownloadtheplug-inonlyonce.)Somefastandpowerfulbehaviorisaddedtobrowsersviaplug-ins,butwritingaplug-inisnotatrivialtask,andisn’tsomethingyou’dwanttodoaspartoftheprocessofbuildingaparticularsite.Thevalueoftheplug-inforclient-sideprogrammingisthatitallowsanexpertprogrammertodevelopextensionsandaddthoseextensionstoabrowserwithoutthepermissionofthebrowsermanufacturer.Thus,plug-insprovidea“backdoor”thatallowsthecreationofnewclient-sideprogramminglanguages(althoughnotalllanguagesareimplementedasplug-ins).ScriptinglanguagesPlug-insresultedinthedevelopmentofbrowserscriptinglanguages.Withascriptinglanguage,youembedthesourcecodeforyourclient-sideprogramdirectlyintotheHTMLpage,andtheplug-inthatinterpretsthatlanguageisautomaticallyactivatedwhiletheHTMLpageisbeingdisplayed.Scriptinglanguagestendtobereasonablyeasytounderstandand,becausetheyaresimplytextthatispartofanHTMLpage,theyloadveryquicklyaspartofthesingleserverhitrequiredtoprocurethatpage.Thetrade-offisthatyourcodeisexposedforeveryonetosee(andsteal).Generally,however,youaren’tdoingamazinglysophisticatedthingswithscriptinglanguages,sothisisnottoomuchofahardship.OnescriptinglanguagethatyoucanexpectaWebbrowsertosupportwithoutaplug-inisJavaScript(thishasonlyapassingresemblancetoJavaandyou’llhavetoclimbanadditionallearningcurvetouseit.ItwasnamedthatwayjusttograbsomeofJava’smarketingmomentum).Unfortunately,mostWebbrowsersoriginallyimplementedJavaScriptinadifferentwayfromtheotherWebbrowsers,andevenfromotherversionsofthemselves.ThestandardizationofJavaScriptintheformofECMAScripthashelped,butithastakenalongtimeforthevariousbrowserstocatchup(anditdidn’thelpthatMicrosoftwaspushingitsownagendaintheformofVBScript,whichalsohadvaguesimilaritiestoJavaScript).Ingeneral,youmustprograminakindofleast-common-denominatorformofJavaScriptinordertobeabletorunonallbrowsers.DealingwitherrorsanddebuggingJavaScriptcanonlybedescribedasamess.Asproofofitsdifficulty,onlyrecentlyhasanyonecreatedatrulycomplexpieceofJavaScript(Google,inGMail),andthatrequiredexcessivededicationandexpertise.ThispointsoutthatthescriptinglanguagesusedinsideWebbrowsersarereallyintendedtosolvespecifictypesofproblems,primarilythecreationofricherandmoreinteractivegraphicaluserinterfaces(GUIs).However,ascriptinglanguagemightsolve80percentoftheproblemsencounteredinclient-sideprogramming.Yourproblemsmightverywellfitcompletelywithinthat80percent,andsincescriptinglanguagescanalloweasierandfasterdevelopment,youshouldprobablyconsiderascriptinglanguagebeforelookingatamoreinvolvedsolutionsuchasJavaprogramming.JavaIfascriptinglanguagecansolve80percentoftheclient-sideprogrammingproblems,whatabouttheother20percent—the“reallyhardstuff”?Java

温馨提示

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

评论

0/150

提交评论