毕业设计(论文)外文资料翻译题目MVCDesignPatternMVC设计模型学生姓名储淼专业名称软件工程学科门类工学指导老师储淼提交翻译日期二〇一五年一月1MVCDesignPatternMVC设计模型MVCisawidelypopularsoftwaredesignpattern,asearlyasinthe70's,IBMintroducedtheSanfronscisicoontheproject,infact,istheMVCdesignpatternresearch.Recently,withthematurityofJ2EE,itisbecomingarecommendationintheJ2EEplatform,adesignmodel,themajorityofJavadevelopersarealsoveryinterestedinthedesignmodel.MVCmodelisgraduallydevelopedinPHPandColdFusionareinuse,andgrowthtrends.Withtherapidincreaseinwebapplications,MVCmodelforthedevelopmentofWebapplicationsisaveryadvanceddesignidea,nomatterwhatlanguageyouchoose,nomatterhowcomplicatedtheapplication,itcanbeforyoutounderstandandprovidethemostbasicapplicationmodelanalyticalmethods,structuralproductsforyoutoprovideaclearframeworkforthedesign,foryoursoftwareprojectsinaccordancewithnorms.MVC是一种目前广泛流行的软件设计模式,早在70年代,IBM就推出了Sanfronscisico项目计划,其实就是MVC设计模式的研究。近来,随着J2EE的成熟,它正在成为在J2EE平台上推荐的一种设计模型,也是广大Java开发者非常感兴趣的设计模型。MVC模式也逐渐在PHP和ColdFusion开发者中运用,并有增长趋势。随着网络应用的快速增加,MVC模式对于Web应用的开发无疑是一种非常先进的设计思想,无论你选择哪种语言,无论应用多复杂,它都能为你理解分析应用模型时提供最基本的分析方法,为你构造产品提供清晰的设计框架,为你的软件工程提供规范的依据。2MVCdesignideaMVCinEnglishorModel-View-Controller,anapplicationthatisinput,process,outputprocessinaccordancewiththeModel,View,Controllerisolatedmanner,suchanapplicationisdividedintothreelayers-modellayer,viewlayer,controllayer.View(View)onbehalfoftheuserinterfaceforWebapplicationscanbesummedupasHTMLinterface,buthasthepotentialtoXHTML,XML,andApplet.Withtheapplicationofthecomplexityandscale,theinterfacehasbecomechallengingtodealwith.Anapplicationmayhavedifferentviews,MVCdesignpatterntodealwiththeviewofthelimitedviewofdataacquisitionandprocessing,aswellastheuser'srequest,notincludedintheviewonthehandlingofbusinessprocesses.Thehandlingofbusinessprocessestothemodel(Model)todealwith.Forexample,aviewonlyacceptordersfromtheMVC设计思想MVC英文即Model-View-Controller,即把一个应用的输入、处理、输出流程按照Model、View、Controller的方式进行分离,这样一个应用被分成三个层——模型层、视图层、控制层。视图(View)代表用户交互界面,对于Web应用来说,可以概括为HTML界面,但有可能为XHTML、XML和Applet。随着应用的复杂性和规模性,界面的处理也变得具有挑战性。一个应用可能有很多不同的视图,MVC设计模式对于视图的处理仅限于视图上数据的采集和处理,以及用户的请求,而不包括在视图上的业务流程的处理。业务流程的处理交予模型(Model)处理。比如一个订单的视图只接受来自模型的数据并显示给用户,以及将用户界面的输入数据和请求传递给控制和模型。3modeldataanddisplaytousers,aswellasinputuserinterfacedataandtherequestpassedtothecontrolandmodel.Model(Model):isthebusinessprocess/statusoftheprocessingandbusinessrules.Businessprocesslayeristheotherblack-boxoperation,themodelviewtoaccepttherequestofthedata,andreturntheresultsofthefinal.ThedesignofbusinessmodelscanbesaidtobethemostimportantcoreofMVC.CurrentlypopularmodelofEJBapplicationsisatypicalexampleoftheapplicationoftechnologyfromtheperspectiveofthemodelfurtherdelineationinordertomakefulluseofexistingcomponents,butitcannotbeusedasaframeworkforapplicationdesignmodel.Itonlytellyouthataccordingtothedesignofthismodelwillbeabletousecertaintechnologycomponents,therebyreducingthetechnicaldifficulties.Exampleofadevelper,youcanfocusonbusiness模型(Model):就是业务流程/状态的处理以及业务规则的制定。业务流程的处理过程对其它层来说是黑箱操作,模型接受视图请求的数据,并返回最终的处理结果。业务模型的设计可以说是MVC最主要的核心。目前流行的EJB模型就是一个典型的应用例子,它从应用技术实现的角度对模型做了进一步的划分,以便充分利用现有的组件,但它不能作为应用设计模型的框架。它仅仅告诉你按这种模型设计就可以利用某些技术组件,从而减少了技术上的困难。对一个开发者来说,就可以专注于业务模型的设计。MVC设计模式告诉我们,把应用的模型按一定的规则抽取出来,抽取的层次很重要,这也是判断开发人员是否优秀的设计依据。抽象与具体不能隔得太远,也不能太近。4modeldesign.MVCdesignpatterntellsusthattheapplicationofthemodelaccordingtocertainrulesoftakingawaythelevelofextractionisveryimportant,whichistodeterminewhetherthedevelopmentinaccordancewithgooddesign.Abstractandconcretecannotbeseparatedtoofar,nortooclose.MVCmodeldidnotprovidethedesignmethod,butonlytellyouthatthemanagementofthesemodelsshouldbeorganizedinordertofacilitatereconstructionandimprovethemodelreusability.Wecanmakeananalogywithobjectprogramming,MVCdefinesatop-levelcategory,thesub-classtotellityouhavetodothese,butyoucannotdotheserestrictions.Thisisthedeveloperoftheprogrammingisveryimportant.Thereisalsoabusinessmodelofthemodelisveryimportantthatthedatamodel.Datamodelmainlyreferstotheobjectdataentities(continuedof).Forexample,anorderwillbesavedtothedatabaseMVC并没有提供模型的设计方法,而只告诉你应该组织管理这些模型,以便于模型的重构和提高重用性。我们可以用对象编程来做比喻,MVC定义了一个顶级类,告诉它的子类你只能做这些,但没法限制你能做这些。这点对编程的开发人员非常重要。业务模型还有一个很重要的模型那就是数据模型。数据模型主要指实体对象的数据保存(持续化)。比如将一张订单保存到数据库,从数据库获取订单。我们可以将这个模型单独列出,所有有关数据库的操作只限制在该模型中。5toobtainordersfromthedatabase.Wecanseparatethismodel,alltheoperationofthedatabaseisonly.limitedtothemodelControl(Controller)canbeinterpretedasarequestreceivedfromtheuser,matchingthemodelandviewtogethertocompletetheuser'srequest.Theroleofdivisionofcontrollayerisalsoveryclearthatitclearlytellyouthatitisadistributed,andwhatkindofmodeltochoose,choosewhatkindofview,tocompletewhattheuserrequests.Controllayerdoesnotdoanydataprocessing.Forexample,theuserclicksonalinkandcontrollayertoreceivearequest,doesnotdealwithbusinessinformation,onlytheuser'sinformationtothemodel,totellwhatmodeltochoosetheviewtomeettherequirementstoreturntotheuser.Therefore,amodelmaycorrespondtomultipleviews,oneviewmaycorrespondtoanumberofmodels.局限于模型控制(Controller)可以理解为从用户接收请求,将模型与视图匹配在一起,共同完成用户的请求。划分控制层的作用也很明显,它清楚地告诉你,