在线图书管理系统外文文献原文及译文.docx
- 文档编号:29536215
- 上传时间:2023-07-24
- 格式:DOCX
- 页数:11
- 大小:26.32KB
在线图书管理系统外文文献原文及译文.docx
《在线图书管理系统外文文献原文及译文.docx》由会员分享,可在线阅读,更多相关《在线图书管理系统外文文献原文及译文.docx(11页珍藏版)》请在冰豆网上搜索。
在线图书管理系统外文文献原文及译文
毕业设计说明书
英文文献及中文翻译
班级:
学号:
软件学院
姓名:
软件工程
学院:
专业:
指导教师:
2014年6月
AnIntroductiontoJava
ThefirstreleaseofJavain1996generatedanincredibleamountofexcitement,notjustinthecomputerpress,butinmainstreammediasuchasTheNewYorkTimes,TheWashingtonPost,andBusinessWeek.Javahasthedistinctionofbeingthefirstandonlyprogramminglanguagethathadaten-minutestoryonNationalPublicRadio.A$100,000,000venturecapitalfundwassetupsolelyforproductsproducedbyuseofaspecificcomputerlanguage.Itisratheramusingtorevisitthoseheadytimes,andwegiveyouabriefhistoryofJavainthischapter.
Inthefirsteditionofthisbook,wehadthistowriteaboutJava:
“Asacomputerlanguage,Java’shypeisoverdone:
Javaiscertainlyagoodprogram-minglanguage.Thereisnodoubtthatitisoneofthebetterlanguagesavailabletoseriousprogrammers.Wethinkitcouldpotentiallyhavebeenagreatprogramminglanguage,butitisprobablytoolateforthat.Oncealanguageisoutinthefield,theuglyrealityofcompatibilitywithexistingcodesetsin.”
OureditorgotalotofflackforthisparagraphfromsomeoneveryhighupatSunMicro-systemswhoshallremainunnamed.But,inhindsight,ourprognosisseemsaccurate.Javahasalotofnicelanguagefeatures—weexaminethemindetaillaterinthischapter.Ithasitsshareofwarts,andneweradditionstothelanguagearenotaselegantastheoriginalonesbecauseoftheuglyrealityofcompatibility.
But,aswealreadysaidinthefirstedition,Javawasneverjustalanguage.Therearelotsofprogramminglanguagesoutthere,andfewofthemmakemuchofasplash.Javaisawholeplatform,withahugelibrary,containinglotsofreusablecode,andanexecutionenvironmentthatprovidesservicessuchassecurity,portabilityacrossoperatingsys-tems,andautomaticgarbagecollection.
Asaprogrammer,youwillwantalanguagewithapleasantsyntaxandcomprehensiblesemantics(i.e.,notC++).Javafitsthebill,asdodozensofotherfinelanguages.Somelanguagesgiveyouportability,garbagecollection,andthelike,buttheydon’thavemuchofalibrary,forcingyoutorollyourownifyouwantfancygraphicsornetwork-ingordatabaseaccess.Well,Javahaseverything—agoodlanguage,ahigh-qualityexe-cutionenvironment,andavastlibrary.ThatcombinationiswhatmakesJavaanirresistiblepropositiontosomanyprogrammers.
Simple
Wewantedtobuildasystemthatcouldbeprogrammedeasilywithoutalotofeso-terictrainingandwhichleveragedtoday’sstandardpractice.SoeventhoughwefoundthatC++wasunsuitable,wedesignedJavaascloselytoC++aspossibleinordertomakethesystemmorecomprehensible.Javaomitsmanyrarelyused,poorlyunderstood,confusingfeaturesofC++that,inourexperience,bringmoregriefthanbenefit.
ThesyntaxforJavais,indeed,acleaned-upversionofthesyntaxforC++.Thereisnoneedforheaderfiles,pointerarithmetic(orevenapointersyntax),structures,unions,operatoroverloading,virtualbaseclasses,andsoon.(SeetheC++notesinterspersedthroughoutthetextformoreonthedifferencesbetweenJavaandC++.)Thedesignersdidnot,however,attempttofixalloftheclumsyfeaturesofC++.Forexample,thesyn-taxoftheswitchstatementisunchangedinJava.IfyouknowC++,youwillfindthetran-sitiontotheJavasyntaxeasy.Ifyouareusedtoavisualprogrammingenvironment(suchasVisualBasic),youwillnotfindJavasimple.Thereismuchstrangesyntax(thoughitdoesnottakelongtogetthehangofit).Moreimportant,youmustdoalotmoreprogramminginJava.ThebeautyofVisualBasicisthatitsvisualdesignenvironmentalmostautomaticallypro-videsalotoftheinfrastructureforanapplication.Theequivalentfunctionalitymustbeprogrammedmanually,usuallywithafairbitofcode,inJava.Thereare,however,third-partydevelopmentenvironmentsthatprovide“drag-and-drop”-styleprogramdevelopment.
Anotheraspectofbeingsimpleisbeingsmall.OneofthegoalsofJavaistoenabletheconstructionofsoftwarethatcanrunstand-aloneinsmallmachines.Thesizeofthebasicinterpreterandclasssupportisabout40Kbytes;addingthebasicstan-dardlibrariesandthreadsupport(essentiallyaself-containedmicrokernel)addsanadditional175K.
Thiswasagreatachievementatthetime.Ofcourse,thelibraryhassincegrowntohugeproportions.ThereisnowaseparateJavaMicroEditionwithasmallerlibrary,suitableforembeddeddevices.
ObjectOriented
Simplystated,object-orienteddesignisatechniqueforprogrammingthatfocusesonthedata(=objects)andontheinterfacestothatobject.Tomakeananalogywithcarpentry,an“object-oriented”carpenterwouldbemostlyconcernedwiththechairhewasbuilding,andsecondarilywiththetoolsusedtomakeit;a“non-object-oriented”carpenterwouldthinkprimarilyofhistools.Theobject-orientedfacilitiesofJavaareessentiallythoseofC++.
Objectorientationhasprovenitsworthinthelast30years,anditisinconceivablethatamodernprogramminglanguagewouldnotuseit.Indeed,theobject-orientedfeaturesofJavaarecomparabletothoseofC++.ThemajordifferencebetweenJavaandC++liesinmultipleinheritance,whichJavahasreplacedwiththesimplerconceptofinterfaces,andintheJavametaclassmodel(whichwediscussinChapter5).NOTE:
Ifyouhavenoexperiencewithobject-orientedprogramminglanguages,youwillwanttocarefullyreadChapters4through6.Thesechaptersexplainwhatobject-orientedprogrammingisandwhyitismoreusefulforprogrammingsophisticatedprojectsthanaretraditional,procedure-orientedlanguageslikeCorBasic.
Network-Savvy
JavahasanextensivelibraryofroutinesforcopingwithTCP/IPprotocolslikeHTTPandFTP.JavaapplicationscanopenandaccessobjectsacrosstheNetviaURLswiththesameeaseaswhenaccessingalocalfilesystem.
WehavefoundthenetworkingcapabilitiesofJavatobebothstrongandeasytouse.AnyonewhohastriedtodoInternetprogrammingusinganotherlanguagewillrevelinhowsimpleJavamakesoneroustaskslikeopeningasocketconnection.(Wecovernet-workinginVolumeIIofthisbook.)Theremotemethodinvocationmechanismenablescommunicationbetweendistributedobjects(alsocoveredinVolumeII).
Robust
Javaisintendedforwritingprogramsthatmustbereliableinavarietyofways.Javaputsalotofemphasisonearlycheckingforpossibleproblems,laterdynamic(runtime)checking,andeliminatingsituationsthatareerror-prone.ThesinglebiggestdifferencebetweenJavaandC/C++isthatJavahasapointermodelthateliminatesthepossibilityofoverwritingmemoryandcorruptingdata.
Thisfeatureisalsoveryuseful.TheJavacompilerdetectsmanyproblemsthat,inotherlanguages,wouldshowuponlyatruntime.Asforthesecondpoint,anyonewhohasspenthourschasingmemorycorruptioncausedbyapointerbugwillbeveryhappywiththisfeatureofJava.
IfyouarecomingfromalanguagelikeVisualBasicthatdoesn’texplicitlyusepointers,youareprobablywonderingwhythisissoimportant.Cprogrammersarenotsolucky.Theyneedpointerstoaccessstrings,arrays,objects,andevenfiles.InVisualBasic,youdonotusepointersforanyoftheseentities,nordoyouneedtoworryaboutmemoryallocationforthem.Ontheotherhand,manydatastructuresaredifficulttoimplementinapointerlesslanguage.Javagivesyouthebestofbothworlds.Youdonotneedpoint-ersforeverydayconstructslikestringsandarrays.Youhavethepowerofpointersifyouneedit,forexample,forlinkedlists.Andyoualwayshavecompletesafety,becauseyoucanneveraccessabadpointer,makememoryallocationerrors,orhavetoprotectagainstmemoryleakingaway.
ArchitectureNeutral
Thecompilergeneratesanarchitecture-neutralobjectfileformat—thecompiledcodeisexecutableonmanyprocessors,giventhepresenceoftheJavaruntimesys-tem.TheJavacompilerdoesthisbygeneratingbytecodeinstructionswhichhavenothingtodowithaparticularcomputerarchitecture.Rather,theyaredesignedtobebotheasytointerpretonanymachineandeasilytranslatedintonativemachinecodeonthefly.
Thisisnotanewidea.Morethan30yearsago,bothNiklausWirth’soriginalimplemen-tationofPascalandtheUCSDPascalsystemusedthesametechnique.
Ofcourse,interpretingbytecodesisnecessarilyslowerthanrunningmachineinstruc-tionsatfullspeed,soitisn’tclearthatthisisevenagoodidea.However,virtualmachineshavetheoptionoftranslatingthemostfrequentlyexecutedbytecodesequencesintomachinecode,aprocesscalledjust-in-timecompilation.ThisstrategyhasprovensoeffectivethatevenMicrosoft’s.NETplatformreliesonavirtualmachine.Thevirtualmachinehasotheradvantages.Itincreasessecuritybecausethevirtualmachinecancheckthebehaviorofinstructionsequences.Someprogramsevenproducebytecodesonthefly,dynamicallyenhancingthecapabilitiesofarunningprogram.
Portable
UnlikeCandC++,thereareno“implementation-dependent”aspectsofthespecifi-cation.Thesizesoftheprimitivedatatypesarespecified,asisthebehaviorofarith-meticonthem.
Forexample,anintinJavaisalwaysa32-bitinteger.InC/C++,intcanmeana16-bitinteger,a32-bitinteger,oranyothersizethatthecompilervendorlikes.Theonlyrestrictionisthattheinttypemusthaveatleastasmanybytesasashortintandcannothavemorebytesthanalongint.Havingafixedsizefornumbertypeseliminatesamajorportingheadache.Binarydataisstoredandtransmittedinafixedfo
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 在线 图书 管理 系统 外文 文献 原文 译文