英语文献翻译网上商城JAVA.docx
《英语文献翻译网上商城JAVA.docx》由会员分享,可在线阅读,更多相关《英语文献翻译网上商城JAVA.docx(16页珍藏版)》请在冰豆网上搜索。
![英语文献翻译网上商城JAVA.docx](https://file1.bdocx.com/fileroot1/2023-1/31/048f2f9a-4d1e-43e1-9a14-fa1c3e0ba3c7/048f2f9a-4d1e-43e1-9a14-fa1c3e0ba3c71.gif)
英语文献翻译网上商城JAVA
毕业设计(论文)外文翻译
题目:
基于Java的网上商城系统的设计与实现
院(系):
计算机科学与工程
专业:
网络工程
班级:
070607
学生:
冯宁
学号:
*********
******
2011年05月09日
EnglishOnly
JavaandtheInternet
IfJavais,infact,yetanothercomputerprogramminglanguage,youmayquestionwhyitissoimportantandwhyitisbeingpromotedasarevolutionarystepincomputerprogramming.Theanswerisn’timmediatelyobviousifyou’recomingfromatraditionalprogrammingperspective.AlthoughJavaisveryusefulforsolvingtraditionalstandaloneprogrammingproblems,itisalsoimportantbecauseitwillsolveprogrammingproblemsontheWorldWideWeb.
WhatistheWeb?
TheWebcanseemabitofamysteryatfirst,withallthistalkof“surfing,”“presence,”and“homepages.”It’shelpfultostepbackandseewhatitreallyis,buttodothisyoumustunderstandclient/serversystems,anotheraspectofcomputingthat’sfullofconfusingissues.
1.Client/Servercomputing
Theprimaryideaofaclient/serversystemisthatyouhaveacentralrepositoryofinformation—somekindofdata,ofteninadatabase—thatyouwanttodistributeondemandtosomesetofpeopleormachines.Akeytotheclient/serverconceptisthattherepositoryofinformationiscentrallylocatedsothatitcanbechangedandsothatthosechangeswillpropagateouttotheinformationconsumers.Takentogether,theinformationrepository,thesoftwarethatdistributestheinformation,andthemachine(s)wheretheinformationandsoftwareresideiscalledtheserver.Thesoftwarethatresidesontheremotemachine,communicateswiththeserver,fetchestheinformation,processesit,andthendisplaysitontheremotemachineiscalledtheclient.
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:
Youmighthavehundredsofclientsmakingrequestsofyourserveratanyonetime,soanysmalldelayiscrucial.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/serverproblemneedstobesolvedinabigway.
2.TheWebasagiantserver
TheWebisactuallyonegiantclient/serversystem.It’sabitworsethanthat,sinceyouhavealltheserversandclientscoexistingonasinglenetworkatonce.Youdon’tneedtoknowthat,becauseallyoucareaboutisconnectingtoandinteractingwithoneserveratatime(eventhoughyoumightbehoppingaroundtheworldinyoursearchforthecorrectserver).
Initiallyitwasasimpleone-wayprocess.Youmadearequestofaserverandithandedyouafile,whichyourmachine’sbrowsersoftware(i.e.,theclient)wouldinterpretbyformattingontoyourlocalmachine.Butinshortorderpeoplebeganwantingtodomorethanjustdeliverpagesfromaserver.Theywantedfullclient/servercapabilitysothattheclientcouldfeedinformationbacktotheserver,forexample,tododatabaselookupsontheserver,toaddnewinformationtotheserver,ortoplaceanorder(whichrequiredmoresecuritythantheoriginalsystemsoffered).Thesearethechangeswe’vebeenseeinginthedevelopmentoftheWeb.
TheWebbrowserwasabigstepforward:
theconceptthatonepieceofinformationcouldbedisplayedonanytypeofcomputerwithoutchange.However,browserswerestillratherprimitiveandrapidlyboggeddownbythedemandsplacedonthem.Theyweren’tparticularlyinteractive,andtendedtoclogupboththeserverandtheInternetbecauseanytimeyouneededtodosomethingthatrequiredprogrammingyouhadtosendinformationbacktotheservertobeprocessed.Itcouldtakemanysecondsorminutestofindoutyouhadmisspelledsomethinginyourrequest.Sincethebrowserwasjustavieweritcouldn’tperformeventhesimplestcomputingtasks.(Ontheotherhand,itwassafe,becauseitcouldn’texecuteanyprogramsonyourlocalmachinethatmightcontainbugsorviruses.)
Tosolvethisproblem,differentapproacheshavebeentaken.Tobeginwith,graphicsstandardshavebeenenhancedtoallowbetteranimationandvideowithinbrowsers.Theremainderoftheproblemcanbesolvedonlybyincorporatingtheabilitytorunprogramsontheclientend,underthebrowser.Thisiscalledclient-sideprogramming.
Client-sideprogramming
TheWeb’sinitialserver-browserdesignprovidedforinteractivecontent,buttheinteractivitywascompletelyprovidedbytheserver.Theserverproducedstaticpagesfortheclientbrowser,whichwouldsimplyinterpretanddisplaythem.BasicHyperTextMarkupLanguage(HTML)containssimplemechanismsfordatagathering:
text-entryboxes,checkboxes,radioboxes,listsanddrop-downlists,aswellasabuttonthatcanonlybeprogrammedtoresetthedataontheformor“submit”thedataontheformbacktotheserver.ThissubmissionpassesthroughtheCommonGatewayInterface(CGI)providedonallWebservers.ThetextwithinthesubmissiontellsCGIwhattodowithit.Themostcommonactionistorunaprogramlocatedontheserverinadirectorythat’stypicallycalled“cgi-bin.”(IfyouwatchtheaddresswindowatthetopofyourbrowserwhenyoupushabuttononaWebpage,youcansometimessee“cgi-bin”withinallthegobbledygookthere.)Theseprogramscanbewritteninmostlanguages.Perlhasbeenacommonchoicebecauseitisdesignedfortextmanipulationandisinterpreted,soitcanbeinstalledonanyserverregardlessofprocessororoperatingsystem.However,Python(myfavorite—seewww.Python.org)hasbeenmakinginroadsbecauseofitsgreaterpowerandsimplicity.
ManypowerfulWebsitestodayarebuiltstrictlyonCGI,andyoucaninfactdonearlyanythingwithCGI.However,WebsitesbuiltonCGIprogramscanrapidlybecomeoverlycomplicatedtomaintain,andthereisalsotheproblemofresponsetime.TheresponseofaCGIprogramdependsonhowmuchdatamustbesent,aswellastheloadonboththeserverandtheInternet.(Ontopofthis,startingaCGIprogramtendstobeslow.)TheinitialdesignersoftheWebdidnotforeseehowrapidlythisbandwidthwouldbeexhaustedforthekindsofapplicationspeopledeveloped.Forexample,anysortofdynamicgraphingisnearlyimpossibletoperformwithconsistencybecauseaGraphicsInterchangeFormat(GIF)filemustbecreatedandmovedfromtheservertotheclientforeachversionofthegraph.Andyou’venodoubthaddirectexperiencewithsomethingassimpleasvalidatingthedataonaninputform.Youpressthesubmitbuttononapage;thedataisshippedbacktotheserver;theserverstartsaCGIprogramthatdiscoversanerror,formatsanHTMLpageinformingyouoftheerror,andthensendsthepagebacktoyou;youmustthenbackupapageandtryagain.Notonlyisthisslow,it’sinelegant.
Thesolutionisclient-sideprogramming.MostmachinesthatrunWebbrowsersarepowerfulenginescapableofdoingvastwork,andwiththeoriginalstaticHTMLapproachtheyaresittingthere,justidlywaitingfortheservertodishupthenextpage.Client-sideprogrammingmeansthattheWebbrowserisharnessedtodowhateverworkitcan,andtheresultfortheuserisamuchspeedierandmoreinteractiveexperienceatyourWebsite.
Theproblemwithdiscussionsofclient-sideprogrammingisthattheyaren’tverydifferentfromdiscussionsofprogrammingingeneral.Theparametersarealmostthesame,buttheplatformisdifferent;aWebbrowserislikealimitedoperatingsystem.Intheend,youmuststillprogram,andthisaccountsforthedizzyingarrayofproblemsandsolutionsproducedbyclient-sideprogramming.Therestofthissectionprovidesanoverviewoftheissuesandapproachesinclient-sideprogramming.
1.Plug-ins
Oneofthemostsignificantstepsforwardinclient-sideprogrammingisthedevelopmentoftheplug-in.Thisisawayforaprogrammertoaddnewfunctionalitytothebrowserbydownloadingapieceofcodethatplugsitselfintotheappropriatespotinthebrowser.Ittellsthebrowser“fromnowonyoucanperformthisnewactivity.”(Youneedtodownloadtheplug-inonlyonce.)Somefastandpowerfulbehaviorisaddedtobrowsersviaplug-ins,butwritingaplug-inisnotatrivialtask,andisn’tsomethingyou’dwanttodoaspartoftheprocessofbuildingaparticularsite.Thevalueoftheplug-info