运算机专业文献翻译

上传人:奇异 文档编号:278348766 上传时间:2022-04-17 格式:DOCX 页数:38 大小:91.78KB
返回 下载 相关 举报
运算机专业文献翻译_第1页
第1页 / 共38页
运算机专业文献翻译_第2页
第2页 / 共38页
运算机专业文献翻译_第3页
第3页 / 共38页
运算机专业文献翻译_第4页
第4页 / 共38页
运算机专业文献翻译_第5页
第5页 / 共38页
点击查看更多>>
资源描述

《运算机专业文献翻译》由会员分享,可在线阅读,更多相关《运算机专业文献翻译(38页珍藏版)》请在金锄头文库上搜索。

1、文献翻译ThinkinjavaAllprogramminglanguagesprovideabstractions.Itcanbearguedthatthecomplexityoftheproblemsyoureabletosolveisdirectlyrelatedtothekindandqualityofabstraction.By“kind1mean,“VChatisitthatyouareabstracting?”Assemblylanguageisasmallabstractionoftheunderlyingmachine.Manyso-calledaimperative,lang

2、uagesthatfollowed(suchasFORTRAN,BASIC,andC)wereabstractionsofassemblylanguage.Theselanguagesarcbigimprovementsoverassemblylanguage,buttheirprimaryabstractionstillrequiresyoutothinkintermsofthestructureofthecomputerratherthanthestructureoftheproblemyouarctryingtosolve.Theprogrammermustestablishtheass

3、ociationbetweenthemachinemodel(inthe“solutionspace/whichistheplacewhereyou,remodelingthatproblem,suchasacomputer)andthemodeloftheproblemthatisactuallybeingsolved(intheuproblemspace/whichistheplacewheretheproblemexists).Theeffortrequiredtoperformthismapping,andthefactthatitisextrinsictotheprogramming

4、language,producesprogramsthatarcdifficulttowriteandexpensivetomaintain,andasasideeffectcreatedtheentireprogrammingmethodsindustry.,Thealternativetomodelingthemachineistomodeltheproblemyouretryingtosolve.EarlylanguagessuchasLISPandAPLchoseparticularviewsoftheworld(AllproblemsarcultimatelylistsorAllpr

5、oblemsarcalgorithmic/respectively).PR()L()Gcastsallproblemsintochainsofdecisions.Languageshavebeencreatedforconstraint-basedprogrammingandforprogrammingexclusivelybymanipulatinggraphicalsymbols.(Thelatterprovedtobetoorestrictive.)Eachoftheseapproachesisagoodsolutiontotheparticularclassofproblemtheyr

6、edesignedtosolve,butwhenyoustepoutsideofthatdomainthevbecomeawkward.JTheobject-orientedapproachgoesastepfurtherbyprovidingtoolsfortheprogrammertorepresentelementsintheproblemspaceThisrepresentationisgeneralenoughthattheprogrammerisnotconstrainedtoallyparticulartypeofproblem.Werefertotheelementsinthe

7、problemspaceandtheirrepresentationsinthesolutionspaceas“objects.”(Youwillalsoneedotherobjectsthatdonthaveproblem-spaceanalogs.)Theideaisthattheprogramisallowedtoadaptitselftothelingooftheproblembyaddingnewtypesofobjects,sowhenyoureadthecodedescribingthesolution,yourereadingwordsthatalsoexpressthepro

8、blem.Thisisamoreflexibleandpowerfullanguageabstractionthanwhatwevchadbefore.Thus,OOPallowsyoutodescribetheproblemintermsoftheproblem,ratherthanintermsofthecomputerwherethesolutionwillrun.Theresstillaconnectionbacktothecomputer:eachobjectlooksquiteabitlikealittlecomputer-ithasastate,andithasoperation

9、sthatyoucanaskittoperform.However,thisdocsn,tseemlikesuchabadanalogytoobjectsintherealworld-theyallhavecharacteristicsandbehaviors.AlanKaysummarizedfivebasiccharacteristicsofSmalltalk,thefirstsuccessfulobject-orientedlanguageandoneofthelanguagesuponwhichJavaisbased.Thesecharacteristicsrepresentapure

10、approachtoobject-orientedprogramming:1. Everythingisanobject.Thinkofanobjectasafancyvariable;itstoresdata,butyoucan“makerequests“tothatobject,askingittoperformoperationsonitself.Intheory,youcantakeanyconceptualcomponentintheproblemyouretryingtosolve(dogs,buildings,services,etc.)andrepresentitasanobj

11、ectinyourprogram.2. Aprogramisabunchofobjectstellingeachotherwhattodobysendingmessages.Tomakearequestofanobject,youasendamessagewtothatobject.Moreconcretely,youcanthinkofamessageasarequesttocallamethodthatbelongstoaparticularobject3. Eachobjecthasitsownmemorymadeupofotherobjects.Putanotherway,youcre

12、ateanewkindofobjectbymakingapackagecontainingexistingobjects.Thus,youcanbuildcomplexityintoaprogramwhilehidingitbehindthesimplicityofobjects.4. Even-objecthasatype.Usingtheparlance,eachobjectisaninstanceofaclass,inwhich“classissynonymouswith“type.”Themostimportantdistinguishingcharacteristicofaclass

13、is“Whatmessagescanyousendtoit?”5. Allobjectsofaparticulartypecallreceivethesamemessages.Thisisactuallyaloadedstatement,asyouwillseclater.Becauseanobjectoftype“circle”isalsoanobjectoftypeshape:acircleisguaranteedtoacceptshapemessages.Thismeansyoucanwritecodethattalkstoshapesandautomaticallyhandleanyt

14、hingthatfitsthedescriptionofashape.ThissubscicutbilityisoneofthepowerfulconceptsinOOP.Boochoffersanevenmoresuccinctdescriptionofanobject:Anobjecthasstacc,behaviorandidentityThismeansthatailobjectcanhaveinternaldata(whichgivesitstate),methods(toproducebehavior),andeachobjectcanbeuniquelydistinguished

15、fromevery。由匚object-toputthisinaconcretesense,eachobjecthasauniqueaddressinmemory。AnobjecthasaninterfaceAristotlewasprobablythefirsttobeginacarefulstudyoftheconceptoftype;hespokeof“theclassoffishesandtheclassofbirds.Theideathatallobjects,whilebeingunique,arcalsopartofaclassofobjectsthathavecharacteri

16、sticsandbehaviorsincommonwasuseddirectlyinthefirstobject-orientedlanguage,Simula-67,withitsfundamentalkeywordclassthatintroducesanewtypeintoaprogram.Simula,asitsnameimplies,wascreatedfordevelopingsimulationssuchastheclassic“banktellerproblem.Inthis,youhaveabunchoftellers,customers,accounts,transactions,andunitsofmoneyalotof“objects.”Objectsthatarcidenticalexceptfortheirstateduringaprogramsexecutionarcgroupedtogetherintoaclassesofobjects”an

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 管理学资料

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号