计算机专业英语4.docx

上传人:b****8 文档编号:28998330 上传时间:2023-07-20 格式:DOCX 页数:7 大小:20.09KB
下载 相关 举报
计算机专业英语4.docx_第1页
第1页 / 共7页
计算机专业英语4.docx_第2页
第2页 / 共7页
计算机专业英语4.docx_第3页
第3页 / 共7页
计算机专业英语4.docx_第4页
第4页 / 共7页
计算机专业英语4.docx_第5页
第5页 / 共7页
点击查看更多>>
下载资源
资源描述

计算机专业英语4.docx

《计算机专业英语4.docx》由会员分享,可在线阅读,更多相关《计算机专业英语4.docx(7页珍藏版)》请在冰豆网上搜索。

计算机专业英语4.docx

计算机专业英语4

Unit4SoftwareDevelopment

SectionA

ComputerProgram

I.Introduction

Acomputerprogramisasetofinstructionsthatdirectsacomputertoperformsomeprocessingfunctionorcombinationoffunctions.Fortheinstructionstobecarriedout,acomputermustexecuteaprogram,thatis,thecomputerreadstheprogram,andthenfollowsthestepsencodedintheprograminapreciseorderuntilcompletion.Aprogramcanbeexecutedmanydifferenttimes,witheachexecutionyieldingapotentiallydifferentresultdependingupontheoptionsanddatathattheusergivesthecomputer.

Programsfallintotwomajorclasses:

applicationprogramsandoperatingsystems.Anapplicationprogramisonethatcarriesout(执行)somefunctiondirectlyforauser,suchaswordprocessingorgameplaying.Anoperatingsystemisaprogramthatmanagesthecomputerandthevariousresourcesanddevicesconnectedtoit,suchasRAM(randomaccessmemory),harddrives,monitors,keyboards,printers,andmodems,sothattheymaybeusedbyotherprograms.ExamplesofoperatingsystemsareDOS',Windows95,OS/22,andUNIX.

II.ProgramDevelopment

Softwaredesignerscreatenewprogramsbyusingspecialapplicationsprograms,oftencalledutilityprogramsordevelopmentprograms.Aprogrammerusesanothertypeofprogramcalledatexteditortowritethenewprograminaspecialnotationcalledaprogramminglanguage.Withthetexteditor,theprogrammercreatesatextfile,whichisanorderedlistofinstructions,alsocalledtheprogramsourcefile.Theindividualinstructionsthatmakeup(整理,组成)theprogramsourcefilearecalledsourcecode.Atthispoint,aspecialapplicationsprogramtranslatesthesourcecodeintomachinelanguage,orobjectcode—aformatthattheoperatingsystemwillrecognizeasaproperprogramandbeabletoexecute.

Threetypesofapplicationsprogramstranslatefromsourcecodetoobjectcode:

compilers,interpreters(解释程序),andassemblers.Thethreeoperatedifferentlyandondifferenttypesofprogramminglanguages,buttheyservethesamepurposeoftranslatingfromaprogramminglanguageintomachinelanguage.

Acompilertranslatestextfileswritteninahigh-levelprogramminglanguage—suchasFORTRAN,C,orPascal—fromthesourcecodetotheobjectcodeallatonce.ThisdiffersfromtheapproachtakenbyinterpretedlanguagessuchasBASIC,inwhichaprogramistranslatedintoobjectcodestatementbystatementaseachinstructionisexecuted.Theadvantageofinterpretedlanguagesisthattheycanbeginexecutingtheprogramimmediatelyinsteadofhavingtowaitforallofthesourcecodetobecompiled.Changescanalsobemadetotheprogramfairlyquicklywithouthavingtowaitforittobecompiledagain.Thedisadvantageofinterpretedlanguagesisthattheyareslowtoexecute,sincetheentireprogrammustbetranslatedoneinstructionatatime,eachtimetheprogramisrun.Ontheotherhand,compiledlanguagesarecompiledonlyonceandthuscanexecutedbythecomputermuchmorequicklythaninterpretedlanguages.Forthisreason,compiledlanguagesaremorecommonandarealmostalwaysusedinprofessionalandscientificapplications.

Anothertypeoftranslatoristheassembler,whichisusedforprogramsorpartsofprogramswritteninassemblylanguage.Assemblylanguageisanotherprogramminglanguage,butitismuchmoresimilartomachinelanguagethanothertypesofhigh-levellanguages.Inassemblylanguage,asinglestatementcanusuallybetranslatedintoasingleinstructionofmachinelanguage.Today,assemblylanguageisrarelyusedtowriteanentireprogram,butisinsteadmostoftenusedwhentheprogrammerneedstodirectlycontrolsomeaspectofthecomputer'sfunction.

Programsareoftenwrittenasasetofsmallerpieces,witheachpiecerepresentingsomeaspectoftheoverallapplicationprogram.Aftereachpiecehasbeencompiledseparately,aprogramcalledalinkercombinesallofthetranslatedpiecesintoasingleexecutableprogram.

Programsseldomworkcorrectlythefirsttime,soaprogramcalleddebuggerisoftenusedtohelpfindproblemscalledbugs.Debuggingprogramsusuallydetectaneventintheexecutingprogramandpointtheprogrammerbacktotheoriginoftheeventintheprogramcode.

Recentprogrammingsystems,suchasJava,useacombinationofapproachestocreateandexecuteprograms.AcompilertakesaJavasourceprogramandtranslatesitintoanintermediateform.SuchintermediateprogramsarethentransferredovertheInternetintocomputerswhereaninterpreterprogramthenexecutestheintermediateformasanapplicationprogram.

III.ProgramElements

Mostprogramsarebuiltfromjustafewkindsofstepsthatarerepeatedmanytimesindifferentcontextsandindifferentcombinationsthroughouttheprogram.Themostcommonstepperformssomecomputation,andthenproceedsto(向…进发)thenextstepintheprogram,intheorderspecifiedbytheprogrammer.

Programsoftenneedtorepeatashortseriesofstepsmanytimes,forinstanceinlookingthroughalistofgamescoresandfindingthehighestscore.Suchrepetitivesequencesofcodearecalledloops.

Oneofthecapabilitiesthatmakecomputerssousefulistheirabilitytomakeconditionaldecisionsandperformdifferentinstructionsbasedonthevaluesofdatabeingprocessed.If-then-elsestatementsimplementthisfunctionbytestingsomepieceofdataandthenselectingoneoftwosequencesofinstructionsonthebasisoftheresult.Oneoftheinstructionsinthesealternativesmaybeagotostatementthatdirectsthecomputertoselectitsnextinstructionfromadifferentpartoftheprogram.Forexample,aprogrammightcomparetwonumbersandbranchtoadifferentpartoftheprogramdependingontheresultofthecomparison:

Ifxisgreaterthany

thengotoinstruction#10

elsecontinue

Programsoftenuseaspecificsequenceofstepsmorethanonce.Suchasequenceofstepscanbegroupedtogetherintoasubroutine,whichcanthenbecalled,oraccessed,asneededindifferentpartsofthemainprogram.Eachtimeasubroutineiscalled,thecomputerrememberswhereitwasintheprogramwhenthecallwasmade,sothatitcanreturnthereuponcompletionofthesubroutine.Precedingeachcall,aprogramcanspecifythatdifferentdatabeusedbythesubroutine,allowingaverygeneralpieceofcodetobewrittenonceandusedinmultipleways.

Mostprogramsuseseveralvarietiesofsubroutines.Themostcommonofthesearefunctions,procedures,libraryroutines,systemroutines,anddevicedrivers.Functionsareshortsubroutinesthatcomputesomevalue,suchascomputationsofangles,whichthecomputercannotcomputewithasinglebasicinstruction.Proceduresperformamorecomplexfunction,suchassortingasetofnames.Libraryroutinesaresubroutinesthatarewrittenforusebymanydifferentprograms.Systemroutinesaresimilartolibraryroutinesbutareactuallyfoundintheoperatingsystem.Theyprovidesomeservicefortheapplicationprograms,suchasprintingalineoftext.Devicedriversaresystemroutinesthatareaddedtoanoperatingsystemtoallowthecomputertocommunicatewithanewdevice,suchasascanner,modem,orprinter.Devicedriversoftenhavefeaturesthatcanbeexecuteddirectlyasapplicationsprograms.Thisallowstheusertodirectlycontrolthedevice,whichisusefulif,forinstance,acolorprinterneedstoberealignedtoattainthebestprintingqualityafterchanginganinkcartridge

IV.ProgramFunction

Modemcomputersusuallystoreprogramsonsomeformofmagneticstoragemediathatcanbeaccessedrandomlybythecomputer,suchastheharddrivediskpermanentlylocatedinthecomputer,oraportablefloppydisk.Additionalinformationonsuchdisks,calleddirectories,indicatesthenamesofthevariousprogramsonthedisk,whentheywerewrittentothedisk,andwheretheprogrambeginsonthediskmedia.Whenauserdirectsthecomputertoexecuteaparticularapplicationprogram,theoperatingsystemlooksthrough(浏览)thesedirectories,locatestheprogram,andreadsacopyintoRAM.TheoperatingsystemthendirectstheCPU(centralprocessingunit)tostartexecutingtheinstructionsatthebeginningoftheprogram.InstructionsatthebeginningoftheprogrampreparethecomputertoprocessinformationbylocatingfreememorylocationsinRAMtoholdworkingdata,retrievingcopiesofthestandardoptionsanddefaultstheuserhasindicatedfromadisk,anddrawinginitialdisplaysonthemonitor.

Theapplicationprogramrequestsacopyofanyinformationtheuserentersbymakingacalltoasystemroutine.Theoperatingsystemconvertsanydatasoenteredintoastandardinternalform.Theapplicationthenlistthisinformationtodecidewhattodonext—forexample,performsomedesiredprocessingfunctionsuchasreformattingapageoftext,orobtainsomeadditionalinformationfromanotherfileonadisk.Ineithercase,callstoothersystemroutinesareusedtoactuallycarryoutthedisplayofresultsortheaccessingofthefilefromthedisk.

Whentheapplicationreachescompletionorispromptedtoquit,makesfurthersystemcallstomakesurethatalldatathatneedstobesavedhasbeenwrittenbacktodisk.Itthenmakesafinalsystemcalltotheoperatingsystemindicatingthatitisfinished.TheoperatingsystemthenfreesuptheRAMandanydevicesthattheapplicationwasusingandawaitsacommandfromtheusertostartanotherprogram.

V.History

Peoplehavebeenstoringsequencesofinstructionsintheformofprogramforseveralcenturies.Musicboxesofthe18thcenturyandplayerpianosofthelate19thandearly20thcenturiesplayedmusicalprogramsstoredasseriesofmetalpins,orholesinpaper,witheachline(ofpinsholes)representing

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

当前位置:首页 > 医药卫生 > 基础医学

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

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