java中英文对照Word下载.docx

上传人:b****6 文档编号:16018210 上传时间:2022-11-17 格式:DOCX 页数:8 大小:26.12KB
下载 相关 举报
java中英文对照Word下载.docx_第1页
第1页 / 共8页
java中英文对照Word下载.docx_第2页
第2页 / 共8页
java中英文对照Word下载.docx_第3页
第3页 / 共8页
java中英文对照Word下载.docx_第4页
第4页 / 共8页
java中英文对照Word下载.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

java中英文对照Word下载.docx

《java中英文对照Word下载.docx》由会员分享,可在线阅读,更多相关《java中英文对照Word下载.docx(8页珍藏版)》请在冰豆网上搜索。

java中英文对照Word下载.docx

java中英文对照@#@1.IntroductionToObjects@#@1.1Theprogressofabstraction@#@Allprogramminglanguagesprovideabstractions.Itcanbearguedthatthecomplexityoftheproblemsyou’reabletosolveisdirectlyrelatedtothekindandqualityofabstraction.By“kind”Imean,“Whatisitthatyouareabstracting?

@#@”Assemblylanguageisasmallabstractionoftheunderlyingmachine.Manyso-called“imperative”languagesthatfollowed(suchasFORTRAN,BASIC,andC)wereabstractionsofassemblylanguage.Theselanguagesarebigimprovementsoverassemblylanguage,buttheirprimaryabstractionstillrequiresyoutothinkintermsofthestructureofthecomputerratherthanthestructureoftheproblemyouaretryingtosolve.Theprogrammermustestablishtheassociationbetweenthemachinemodel(inthe“solutionspace,”whichistheplacewhereyou’remodelingthatproblem,suchasacomputer)andthemodeloftheproblemthatisactuallybeingsolved(inthe“problemspace,”whichistheplacewheretheproblemexists).Theeffortrequiredtoperformthismapping,andthefactthatitisextrinsictotheprogramminglanguage,producesprogramsthataredifficulttowriteandexpensivetomaintain,andasasideeffectcreatedtheentire“programmingmethods”industry.@#@Thealternativetomodelingthemachineistomodeltheproblemyou’retryingtosolve.EarlylanguagessuchasLISPandAPLchoseparticularviewsoftheworld(“Allproblemsareultimatelylists”or“Allproblemsarealgorithmic,”respectively).PROLOGcastsallproblemsintochainsofdecisions.Languageshavebeencreatedforconstraint-basedprogrammingandforprogrammingexclusivelybymanipulatinggraphicalsymbols.(Thelatterprovedtobetoorestrictive.)Eachoftheseapproachesisagoodsolutiontotheparticularclassofproblemthey’redesignedtosolve,butwhenyoustepoutsideofthatdomaintheybecomeawkward.@#@Theobject-orientedapproachgoesastepfurtherbyprovidingtoolsfortheprogrammertorepresentelementsintheproblemspace.Thisrepresentationisgeneralenoughthattheprogrammerisnotconstrainedtoanyparticulartypeofproblem.Werefertotheelementsintheproblemspaceandtheirrepresentationsinthesolutionspaceas“objects.”(Youwillalsoneedotherobjectsthatdon’thaveproblem-spaceanalogs.)Theideaisthattheprogramisallowedtoadaptitselftothelingooftheproblembyaddingnewtypesofobjects,sowhenyoureadthecodedescribingthesolution,you’rereadingwordsthatalsoexpresstheproblem.Thisisamoreflexibleandpowerfullanguageabstractionthanwhatwe’vehadbefore.Thus,OOPallowsyoutodescribetheproblemintermsoftheproblem,ratherthanintermsofthecomputerwherethesolutionwillrun.There’sstillaconnectionbacktothecomputer:

@#@eachobjectlooksquiteabitlikealittlecomputer—ithasastate,andithasoperationsthatyoucanaskittoperform.However,thisdoesn’tseemlikesuchabadanalogytoobjectsintherealworld—theyallhavecharacteristicsandbehaviors.@#@AlanKaysummarizedfivebasiccharacteristicsofSmalltalk,thefirstsuccessfulobject-orientedlanguageandoneofthelanguagesuponwhichJavaisbased.Thesecharacteristicsrepresentapureapproachtoobject-orientedprogramming:

@#@@#@1.Everythingisanobject.Thinkofanobjectasafancyvariable;@#@itstoresdata,butyoucan“makerequests”tothatobject,askingittoperformoperationsonitself.Intheory,youcantakeanyconceptualcomponentintheproblemyou’retryingtosolve(dogs,buildings,services,etc.)andrepresentitasanobjectinyourprogram.@#@2.Aprogramisabunchofobjectstellingeachotherwhattodobysendingmessages.Tomakearequestofanobject,you“sendamessage”tothatobject.Moreconcretely,youcanthinkofamessageasarequesttocallamethodthatbelongstoaparticularobject.@#@3.Eachobjecthasitsownmemorymadeupofotherobjects.Putanotherway,youcreateanewkindofobjectbymakingapackagecontainingexistingobjects.Thus,youcanbuildcomplexityintoaprogramwhilehidingitbehindthesimplicityofobjects.@#@4.Everyobjecthasatype.Usingtheparlance,eachobjectisaninstanceofaclass,inwhich“class”issynonymouswith“type.”Themostimportantdistinguishingcharacteristicofaclassis“Whatmessagescanyousendtoit?

@#@”@#@5.Allobjectsofaparticulartypecanreceivethesamemessages.Thisisactuallyaloadedstatement,asyouwillseelater.Becauseanobjectoftype“circle”isalsoanobjectoftype“shape,”acircleisguaranteedtoacceptshapemessages.Thismeansyoucanwritecodethattalkstoshapesandautomaticallyhandleanythingthatfitsthedescriptionofashape.ThissubstitutabilityisoneofthepowerfulconceptsinOOP.@#@Boochoffersanevenmoresuccinctdescriptionofanobject:

@#@@#@Anobjecthasstate,behaviorandidentity.@#@Thismeansthatanobjectca

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

当前位置:首页 > 幼儿教育 > 幼儿读物

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

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