MVC设计模式 毕业论文外文翻译

MVC设计模式 毕业论文外文翻译

ID:240338

大小:22.66 KB

页数:4页

时间:2017-07-12

上传者:green wind
MVC设计模式  毕业论文外文翻译_第1页
MVC设计模式  毕业论文外文翻译_第2页
MVC设计模式  毕业论文外文翻译_第3页
MVC设计模式  毕业论文外文翻译_第4页
资源描述:

《MVC设计模式 毕业论文外文翻译》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

MVC设计模式MVC是一种目前广泛流行的软件设计模式,早在70年代,IBM就推出了Sanfronscisico项目计划,其实就是MVC设计模式的研究。MVC设计思想MVC英文即Model-View-Controller,即把一个应用的输入、处理、输出流程按照Model、View、Controller的方式进行分离,这样一个应用被分成三个层——模型层、视图层、控制层。视图(View)代表用户交互界面,对于Web应用来说,可以概括为HTML界面,但有可能为XHTML、XML和Applet。随着应用的复杂性和规模性,界面的处理也变得具有挑战性。一个应用可能有很多不同的视图,MVC设计模式对于视图的处理仅限于视图上数据的采集和处理,以及用户的请求,而不包括在视图上的业务流程的处理。业务流程的处理交予模型(Model)处理。比如一个订单的视图只接受来自模型的数据并显示给用户,以及将用户界面的输入数据和请求传递给控制和模型。视图的实现很简单。可以像开发WINDOWS界面一样直接在集成开发环境下通过拖动控件来完成页面开发。模型(Model):就是业务流程/状态的处理以及业务规则的制定。业务流程的处理过程对其它层来说是黑箱操作,模型接受视图请求的数据,并返回最终的处理结果。业务模型的设计可以说是MVC最主要的核心。目前流行的EJB模型就是一个典型的应用例子,它从应用技术实现的角度对模型做了进一步的划分,以便充分利用现有的组件,但它不能作为应用设计模型的框架。它仅仅告诉你按这种模型设计就可以利用某些技术组件,从而减少了技术上的困难。对一个开发者来说,就可以专注于业务模型的设计。本文为模型提供了业务实体对象和业务处理对象:所有的业务处理对象都是从ProcessBase类派生的子类。业务处理对象封装了具体的处理逻辑,调用业务逻辑模型,并且把响应提交到合适的视图组件以产生响应。业务实体对象可以通过定义属性描述客户端表单数据。控制(Controller)可以理解为从用户接收请求,将模型与视图匹配在一起,共同完成用户的请求。划分控制层的作用也很明显,它就是一个分发器,选择什么样的模型,选择什么样的视图,可以完成什么样的用户请求。控制层并不做任何的数据处理。例如,用户点击一个链接,控制层接受请求后,并不处理业务信息,它只把用户的信息传递给模型,告诉模型做什么,选择符合要求的视图返回给用户。因此,一个模型可能对应多个视图,一个视图可能对应多个模型。模型、视图与控制器的分离,使得一个模型可以具有多个显示视图。如果用户通过某个视图的控制器改变了模型的数据,所有其它依赖于这些数据的视图都应反映到这些变化。因此,无论何时发生了何种数据变化,控制器都会将变化通知所有的视图,导致显示的更新。MVC的优点大部分用过程语言比如ASP、PHP开发出来的Web应用,初始的开发模板就是混合层的数据编程。例如,直接向数据库发送请求并用HTML显示,开发速度往往比较快,但由于数据页面的分离不是很直接,因而很难体现出业务模型的样子或者模型的重用性。产品设计弹性力度很小,很难满足用户的变化性需求。MVC要求对应用分层,虽然要花费额外的工作,但产品的结构清晰,产品的应用通过模型可以得到更好地体现。MVC模式的好处:只需在以前的程序上稍作修改或增加新的类,即可轻松增加许多程序功能。以前开发的许多类可以重用,而程序结构根本不再需要改变,各类之间相互独立,便于团体 开发,提高开发效率。下面讨论如何实现一个模型、两个视图和一个控制器的程序。其中模型类及视图类根本不需要改变,与前面的完全一样,这就是面向对象编程的好处。综合上述,MVC是构筑软件非常好的基本模式,至少将业务处理与显示分离,强迫将应用分为模型、视图以及控制层,使得你会认真考虑应用的额外复杂性,把这些想法融进到架构中,增加了应用的可拓展性。如果能把握到这一点,MVC模式会使得你的应用更加强壮,更加有弹性,更加个性化。 附录2MVCDesignPatternMVCisawidelypopularsoftwaredesignpattern,asearlyasinthe70's,IBMintroducedtheSanfronscisicoontheproject,infact,istheMVCdesignpatternresearch.MVCdesignideaMVCinEnglishorModel-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,aviewonlyacceptordersfromthemodeldataanddisplaytousers,aswellasinputuserinterfacedataandtherequestpassedtothecontrolandmodel.Model(Model):isthebusinessprocess/statusoftheprocessingandbusinessrules.Businessprocesslayeristheotherblack-boxoperation,themodelviewtoaccepttherequestofthedata,andreturntheresultsofthefinal.ThedesignofbusinessmodelscanbesaidtobethemostimportantcoreofMVC.CurrentlypopularmodelofEJBapplicationsisatypicalexampleoftheapplicationoftechnologyfromtheperspectiveofthemodelfurtherdelineationinordertomakefulluseofexistingcomponents,butitcannotbeusedasaframeworkforapplicationdesignmodel.Itonlytellyouthataccordingtothedesignofthismodelwillbeabletousecertaintechnologycomponents,therebyreducingthetechnicaldifficulties.Exampleofadeveloper,youcanfocusonbusinessmodeldesign.Control(Controller)canbeinterpretedasarequestreceivedfromtheuser,matchingthemodelandviewtogethertocompletetheuser'srequest.Theroleofdivisionofcontrollayerisalsoveryclearthatitclearlytellyouthatitisadistributed,andwhatkindofmodeltochoose,choosewhatkindofview,tocompletewhattheuserrequests.Controllayerdoesnotdoanydataprocessing.Forexample,theuserclicksonalinkandcontrollayertoreceivearequest,doesnotdealwithbusinessinformation,onlytheuser'sinformationtothemodel,totellwhatmodeltochoosethe viewtomeettherequirementstoreturntotheuser.Therefore,amodelmaycorrespondtomultipleviews,oneviewmaycorrespondtoanumberofmodels.ThebenefitsofMVCMostoftheprocessoflanguageusesuchasASP,PHPdevelopedWebapplications,thedevelopmentoftheinitialtemplateisthemixedlayerofthedataprogramming.Forexample,sendtherequestdirectlytothedatabaseanddisplayHTML,developmentspeedisoftenfaster,butbecauseoftheseparationofdatapagesisnotverydirect,andthereforereflectthebusinessmodeldifficulttolookormodelreusability.Veryflexibleproductdesignefforts,itisdifficulttomeetthechangingneedsofusers.MVClayeredontheapplicationoftherequirements,althoughadditionalworkwouldtake,butclearlythestructureofproducts,productapplicationthroughthemodelcanbebetterreflected.Firstofall,themostimportantthingisthatthereshouldbeanumberofviewcorrespondstotheabilityofamodel.Inthecurrentrapidlychanginguserrequirements,itmayhaveaccesstoawiderangeofapplications.Forexample,ordersforthemodelmaybeordersofthesystemaswellasonlineorders,orordersforothersystems,butthehandlingofordersisthesame,thatistosaythehandlingofordersisthesame.MVCdesignpatterninaccordancewithaordersformodelsandmultipleviewscansolvetheproblem.Thereisalsoabusinessmodelofthemodelisveryimportantthatthedatamodel.Datamodelmainlyreferstotheobjectdataentities(continuedof).Forexample,anorderwillbesavedtothedatabase,toobtainordersfromthedatabase.Wecanseparatethismodel,alltheoperationofthedatabaseisonly.

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
大家都在看
近期热门
关闭