JAVA外文文献翻译.docx

上传人:b****7 文档编号:8536457 上传时间:2023-01-31 格式:DOCX 页数:11 大小:29.51KB
下载 相关 举报
JAVA外文文献翻译.docx_第1页
第1页 / 共11页
JAVA外文文献翻译.docx_第2页
第2页 / 共11页
JAVA外文文献翻译.docx_第3页
第3页 / 共11页
JAVA外文文献翻译.docx_第4页
第4页 / 共11页
JAVA外文文献翻译.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

JAVA外文文献翻译.docx

《JAVA外文文献翻译.docx》由会员分享,可在线阅读,更多相关《JAVA外文文献翻译.docx(11页珍藏版)》请在冰豆网上搜索。

JAVA外文文献翻译.docx

JAVA外文文献翻译

JAVA外文文献翻译

JavaandtheInternet

IfJavais,infact,yetanothercomputerprogramminglanguage,youmayquestionwhyitissoimportantandwhyitisbeingpromotedasarevolutionarystepincomputerprogramming.Theanswerisn’timmediatelyobviousifyou’recomingfromatraditionalprogrammingperspective.AlthoughJavaisveryusefulforsolvingtraditionalstand-aloneprogrammingproblems,itisalsoimportantbecauseitwillsolveprogrammingproblemsontheWorldWideWeb.1.Client-sideprogramming

TheWeb’sinitialserver-browserdesignprovidedforinteractivecontent,buttheinteractivitywascompletelyprovidedbytheserver.Theserverproducedstaticpagesfortheclientbrowser,whichwouldsimplyinterpretanddisplaythem.BasicHTMLcontainssimplemechanismsfordatagathering:

text-entryboxes,checkboxes,radioboxes,listsanddrop-downlists,aswellasabuttonthatcanonlybeprogrammedtoresetthedataontheformor“submit”thedataontheformbacktotheserver.ThissubmissionpassesthroughtheCommonGatewayInterface(CGI)providedonallWebservers.ThetextwithinthesubmissiontellsCGIwhattodowithit.Themostcommonactionistorunaprogramlocatedontheserverinadirectorythat’stypicallycalled“cgi-bin.”(If

youwatchtheaddresswindowatthetopofyourbrowserwhenyoupushabuttononaWebpage,youcansometimessee“cgi-bin”withinallthe

gobbledygookthere.)Theseprogramscanbewritteninmostlanguages.Perlisacommonchoicebecauseitisdesignedfortextmanipulationandisinterpreted,soitcanbeinstalledonanyserverregardlessofprocessororoperatingsystem.ManypowerfulWebsitestodayarebuiltstrictlyonCGI,andyoucaninfactdonearlyanythingwithit.However,WebsitesbuiltonCGIprogramscanrapidlybecomeoverlycomplicatedtomaintain,andthereisalsotheproblemofresponsetime.TheresponseofaCGIprogramdependsonhowmuchdatamust

1

besent,aswellastheloadonboththeserverandtheInternet.(Ontopofthis,startingaCGIprogramtendstobeslow.)TheinitialdesignersoftheWebdidnotforeseehowrapidlythisbandwidthwouldbeexhaustedforthekindsofapplicationspeopledeveloped.Forexample,anysortofdynamicgraphingisnearlyimpossibletoperformwithconsistencybecauseaGIFfilemustbecreatedandmovedfromtheservertotheclientforeachversionofthegraph.Andyou’venodoubthaddirectexperiencewithsomethingassimpleasvalidatingthedataonaninputform.Youpressthesubmitbuttononapage;thedataisshippedbacktotheserver;theserverstartsaCGIprogramthatdiscoversanerror,formatsanHTMLpageinformingyouoftheerror,andthensendsthepagebacktoyou;youmustthenbackupapageandtryagain.Notonlyisthisslow,it’sinelegant.

Thesolutionisclient-sideprogramming.MostmachinesthatrunWebbrowsersarepowerfulenginescapableofdoingvastwork,andwiththeoriginalstaticHTMLapproachtheyaresittingthere,justidlywaitingfortheservertodishupthenextpage.Client-sideprogrammingmeansthattheWebbrowserisharnessedtodowhateverworkitcan,andtheresultfortheuserisamuchspeedierandmoreinteractiveexperienceatyourWebsite.

Theproblemwithdiscussionsofclient-sideprogrammingisthattheyaren’t

verydifferentfromdiscussionsofprogrammingingeneral.Theparametersarealmostthesame,buttheplatformisdifferent:

aWebbrowserislikealimitedoperatingsystem.Intheend,youmuststillprogram,andthisaccountsforthedizzyingarrayofproblemsandsolutionsproducedbyclient-sideprogramming.Therestofthissectionprovidesanoverviewoftheissuesandapproachesinclient-sideprogramming.

2.Plug-ins

Oneofthemostsignificantstepsforwardinclient-sideprogrammingisthedevelopmentoftheplug-in.Thisisawayforaprogrammertoaddnewfunctionalitytothebrowserbydownloadingapieceofcodethatplugsitselfintotheappropriatespotinthebrowser.Ittellsthebrowser“fromnowonyoucan

2

performthisnewactivity.”(Youneedtodownloadtheplug-inonlyonce.)Some

fastandpowerfulbehaviorisaddedtobrowsersviaplug-ins,butwritingaplug-inisnotatrivialtask,andisn’tsomethingyou’dwanttodoaspartoftheprocessofbuildingaparticularsite.Thevalueoftheplug-inforclient-sideprogrammingisthatitallowsanexpertprogrammertodevelopanewlanguageandaddthatlanguagetoabrowserwithoutthepermissionofthebrowsermanufacturer.Thus,plug-insprovidea“backdoor”thatallowsthecreationofnewclient-sideprogramminglanguages(althoughnotalllanguagesareimplementedasplug-ins).

3.Scriptinglanguages

Plug-insresultedinanexplosionofscriptinglanguages.Withascriptinglanguageyouembedthesourcecodeforyourclient-sideprogramdirectlyintotheHTMLpage,andtheplug-inthatinterpretsthatlanguageisautomaticallyactivatedwhiletheHTMLpageisbeingdisplayed.Scriptinglanguagestendtobereasonablyeasytounderstandand,becausetheyaresimplytextthatispartofanHTMLpage,theyloadveryquicklyaspartofthesingleserverhitrequiredtoprocurethatpage.Thetrade-offisthatyourcodeisexposedforeveryonetosee(andsteal).Generally,however,youaren’tdoingamazinglysophisticatedthings

withscriptinglanguagessothisisnottoomuchofahardship.ThispointsoutthatthescriptinglanguagesusedinsideWebbrowsersarereallyintendedtosolvespecifictypesofproblems,primarilythecreationofricherandmoreinteractivegraphicaluserinterfaces(GUIs).However,ascriptinglanguagemightsolve80percentoftheproblemsencounteredinclient-sideprogramming.Yourproblemsmightverywellfitcompletelywithinthat80percent,andsincescriptinglanguagescanalloweasierandfasterdevelopment,youshouldprobablyconsiderascriptinglanguagebeforelookingatamoreinvolvedsolutionsuchasJavaorActiveXprogramming.ThemostcommonlydiscussedbrowserscriptinglanguagesareJavaScript(whichhasnothingtodowithJava;it’snamedthatwayjusttograbsomeofJava’smarketingmomentum),VBScript(whichlookslikeVisualBasic),and

3

Tcl/Tk,whichcomesfromthepopularcross-platformGUI-buildinglanguage.Thereareothersoutthere,andnodoubtmoreindevelopment.

JavaScriptisprobablythemostcommonlysupported.ItcomesbuiltintobothNetscapeNavigatorandtheMicrosoftInternetExplorer(IE).Inaddition,thereareprobablymoreJavaScriptbooksavailablethantherearefortheotherbrowserlanguages,andsometoolsautomaticallycreatepagesusingJavaScript.However,ifyou’realreadyfluentinVisualBasicorTcl/Tk,you’llbemoreproductiveusingthosescriptinglanguagesratherthanlearninganewone.(You’llhaveyourhandsfulldealingwiththeWebissuesalready.)

4.Java

Ifascriptinglanguagecansolve80percentoftheclient-sideprogrammingproblems,whatabouttheother20percent—the“reallyhardstuff?

”Themost

popularsolutiontodayisJava.Notonlyisitapowerfulprogramminglanguagebuilttobesecure,cross-platform,andinternational,butJavaisbeingcontinuallyextendedtoprovidelanguagefeaturesandlibrariesthatelegantlyhandleproblemsthataredifficultintraditionalprogramminglanguages,suchasmultithreading,databaseaccess,networkprogramming,anddistributedcomputing.Javaallowsclient-sideprogrammingviatheapplet.

Anappletisamini-programthatwillrunonlyunderaWebbrowser.TheappletisdownloadedautomaticallyaspartofaWebpage(justas,forexample,agraphicisautomaticallydownloaded).Whentheappletisactivateditexecutesaprogram.Thisispartofitsbeauty—itprovidesyouwithawayto

automaticallydistributetheclientsoftwarefromtheserveratthetimetheuserneedstheclientsoftware,andnosooner.Theusergetsthelatestversionoftheclientsoftwarewithoutfailandwithoutdifficultreinstallation.BecauseofthewayJavaisdesigned,theprogrammerneedstocreateonlyasingleprogram,andthatprogramautomaticallyworkswithallcomputersthathavebrowserswithbuilt-inJavainterpreters.(Thissafelyincludesthevastmajorityofmachines.)SinceJavaisafull-fledgedprogramminglanguage,youcandoasmuchworkaspossibleontheclientbeforeandaftermakingrequestsofthe

4

server.Forexample,youwon’tneedtosendarequestformacrosstheInternettodiscoverthatyou’vegottenadateorsomeotherparameterwrong,andyourclientcomputercanquicklydotheworkofplottingdatainsteadofwaitingfortheservertomakeaplotandshipagraphicimagebacktoyou.Notonlydoyougettheimmediatewinofspeedandresponsiveness,butthegeneralnetworktrafficandloadonserverscanbereduced,preventingtheentireInternetfromslowingdown.

OneadvantageaJavaapplethasoverascriptedprogramisthatit’sincompiledform,sothesourcecodeisn’tavailabletotheclient.Ontheotherhand,aJavaappletcanbedecompiledwithouttoomuchtrouble,buthidingyourcodeisoftennotanimportantissue.Twootherfactorscanbeimportant.Asyouwillseelaterinthisbook,acompiledJavaappletcancomprisemanymodulesandtakemultipleserver“hits”(accesses)todownload.(InJava1.1andhigherthisisminimizedbyJavaarchives,calledJARfiles,thatallowalltherequiredmodulestobepackagedtogetherandcompressedforasingledownload.)AscriptedprogramwilljustbeintegratedintotheWebpageaspartofitstext(andwillgenerallybesmallerandreduceserverhits).ThiscouldbeimportanttotheresponsivenessofyourWebsite.Anotherfactoristheall-importantlearningcurve.Regardlessofwhatyou’veheard,Javaisnotatriviallanguagetolearn.If

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 工学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1