MVC设计外文翻译_第1页
MVC设计外文翻译_第2页
MVC设计外文翻译_第3页
MVC设计外文翻译_第4页
MVC设计外文翻译_第5页
已阅读5页,还剩2页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、word中文2070字 附录A中文译文 MVC设计 MVC是一种目前广泛流行的软件设计模式,早在70年代,IBM就推出了 Sanfronscisico工程方案,其实就是MVC设计模式的研究。近来,随着J2EE的成熟,它正在成为在J2EE平台上推荐的一种设计模型,也是广阔Java开发者非常感兴趣的设计模型。MVC模式也逐渐在PHP和ColdFusion开发者中运用,并有增长趋势。随着网络应用的快速增加,MVC模式对于Web应用的开发无疑是一种非常先进的设计思想,无论你选择哪种语言,无论应用多复杂,它都能为你理解分析应用模型时提供最根本的分析方法,为你构造产品提供清晰的设计框架,为你的软件工程提供

2、标准的依据。MVC设计 思想MVC英文即Model-View-Controller,即把一个应用的输入、处理、输出流程按照Model、View、Controller的方式进行别离,这样一个应用被分成三个层模型层、视图层、控制层。视图(View)代表用户交互界面,对于Web应用来说,可以概括为HTML界面,但有可能为XHTML、XML和Applet。随着应用的复杂性和规模性,界面的处理也变得具有挑战性。一个应用可能有很多不同的视图,MVC设计模式对于视图的处理仅限于视图上数据的采集和处理,以及用户的请求,而不包括在视图上的业务流程的处理。业务流程的处理交予模型(Model)处理。比方一个订单的视

3、图只接受来自模型的数据并显示给用户,以及将用户界面的输入数据和请求传递给控制和模型。 模型(Model):就是业务流程/状态的处理以及业务规那么的制定。业务流程的处理过程对其它层来说是黑箱操作,模型接受视图请求的数据,并返回最终的处理结果。业务模型的设计可以说是MVC最主要的核心。目前流行的EJB模型就是一个典型的应用例子,它从应用技术实现的角度对模型做了进一步的划分,以便充分利用现有的组件,但它不能作为应用设计模型的框架。它仅仅告诉你按这种模型设计就可以利用某些技术组件,从而减少了技术上的困难。对一个开发者来说,就可以专注于业务模型的设计。MVC设计模式告诉我们,把应用的模型按一定的规那么抽

4、取出来,抽取的层次很重要,这也是判断开发人员是否优秀的设计依据。抽象与具体不能隔得太远,也不能太近。MVC并没有提供模型的设计方法,而只告诉你应该组织管理这些模型,以便于模型的重构和提高重用性。我们可以用对象编程来做比喻,MVC定义了一个顶级类,告诉它的子类你只能做这些,但没法限制你能做这些。这点对编程的开发人员非常重要。 业务模型还有一个很重要的模型那就是数据模型。数据模型主要指实体对象的数据保存持续化。比方将一张订单保存到数据库,从数据库获取订单。我们可以将这个模型单独列出,所有有关数据库的操作只限制在该模型中。 控制(Controller)可以理解为从用户接收请求, 将模型与视图匹配在一

5、起,共同完成用户的请求。划分控制层的作用也很明显,它清楚地告诉你,它就是一个分发器,选择什么样的模型,选择什么样的视图,可以完成什么样的用户请求。控制层并不做任何的数据处理。例如,用户点击一个连接,控制层接受请求后, 并不处理业务信息,它只把用户的信息传递给模型,告诉模型做什么,选择符合要求的视图返回给用户。因此,一个模型可能对应多个视图,一个视图可能对应多个模型。 MVC的优点 大局部用过程语言比方ASP、PHP开发出来的Web应用,初始的开发模板就是混合层的数据编程。例如,直接向数据库发送请求并用HTML显示,开发速度往往比拟快,但由于数据页面的别离不是很直接,因而很难表达出业务模型的样子

6、或者模型的重用性。产品设计弹性力度很小,很难满足用户的变化性需求。MVC要求对应用分层,虽然要花费额外的工作,但产品的结构清晰,产品的应用通过模型可以得到更好地表达。 首先,最重要的是应该有多个视图对应一个模型的能力。在目前用户需求的快速变化下,可能有多种方式访问应用的要求。例如,订单模型可能有本系统的订单,也有网上订单,或者其他系统的订单,但对于订单的处理都是一样,也就是说订单的处理是一致的。按MVC设计模式,一个订单模型以及多个视图即可解决问题。这样减少了代码的复制,即减少了代码的维护量,一旦模型发生改变,也易于维护。MVC设计模型 其次,由于模型返回的数据不带任何显示格式,因而这些模型也

7、可直接应用于接口的使用。 再次,由于一个应用被别离为三层,因此有时改变其中的一层就能满足应用的改变。一个应用的业务流程或者业务规那么的改变只需改动MVC的模型层。 控制层的概念也很有效,由于它把不同的模型和不同的视图组合在一起完成不同的请求,因此,控制层可以说是包含了用户请求权限的概念。 最后,它还有利于软件工程化管理。由于不同的层各司其职,每一层不同的应用具有某些相同的特征,有利于通过工程化、工具化产生管理程序代码。 MVC的缺点 MVC的设计实现并不十分容易, 理解起来比拟容易,但对开发人员的要求比拟高。MVC只是一种根本的设计思想,还需要详细的设计规划。 模型和视图的严格别离可能使得调试

8、困难一些,但比拟容易发现错误。 经验说明,MVC由于将应用分为三层,意味着代码文件增多,因此,对于文件的管理需要费点心思。 综合上述,MVC是构筑软件非常好的根本模式,至少将业务处理与显示别离,强迫将应用分为模型、视图以及控制层, 使得你会认真考虑应用的额外复杂性,把这些想法融进到架构中,增加了应用的可拓展性。如果能把握到这一点,MVC模式会使得你的应用更加强壮,更加有弹性,更加个性化。 附录B英文原文 MVC Design Pattern MVC is a widely popular software design pattern, as early as in the 70s, IBM

9、introduced the Sanfronscisico on the project, in fact, is the MVC design pattern research. Recently, with the maturity of J2EE, it is becoming a recommendation in the J2EE platform, a design model, the majority of Java developers are also very interested in the design model. MVC model is gradually d

10、eveloped in PHP and ColdFusion are in use, and growth trends. With the rapid increase in web applications, MVC model for the development of Web applications is a very advanced design idea, no matter what language you choose, no matter how complicated the application, it can be for you to understand

11、and provide the most basic application model analytical methods, structural products for you to provide a clear framework for the design, for your software projects in accordance with norms. MVC design idea MVC in English or Model-View-Controller, an application that is input, process, output proces

12、s in accordance with the Model, View, Controller isolated manner, such an application is divided into three layers - model layer, view layer, control layer. View (View) on behalf of the user interface for Web applications can be summed up as HTML interface, but has the potential to XHTML, XML, and A

13、pplet. With the application of the complexity and scale, the interface has become challenging to deal with. An application may have different views, MVC design pattern to deal with the view of the limited view of data acquisition and processing, as well as the users request, not included in the view

14、 on the handling of business processes. The handling of business processes to the model (Model) to deal with. For example, a view only accept orders from the model data and display to users, as well as input user interface data and the request passed to the control and model. Model (Model): is the b

15、usiness process / status of the processing and business rules. Business process layer is the other black-box operation, the model view to accept the request of the data, and return the results of the final. The design of business models can be said to be the most important core of MVC. Currently pop

16、ular model of EJB applications is a typical example of the application of technology from the perspective of the model further delineation in order to make full use of existing components, but it can not be used as a framework for application design model. It only tell you that according to the desi

17、gn of this model will be able to use certain technology components, thereby reducing the technical difficulties. Example of a developer, you can focus on business model design. MVC design pattern tells us that the application of the model according to certain rules of taking away the level of extrac

18、tion is very important, which is to determine whether the development in accordance with good design. Abstract and concrete can not be separated too far, nor too close. MVC model did not provide the design method, but only tell you that the management of these models should be organized in order to

19、facilitate reconstruction and improve the model reusability. We can make an analogy with object programming, MVC defines a top-level category, the sub-class to tell it you have to do these, but you can not do these restrictions. This is the developer of the programming is very important. There is al

20、so a business model of the model is very important that the data model. Data model mainly refers to the object data entities (continued of). Forexample, an order will be saved to the database, to obtain orders from the database. We can separate this model, all the operation of the database is only.

21、limited to the model. Control (Controller) can be interpreted as a request received from the user, matching the model and view together to complete the users request. The role of division of control layer is also very clear that it clearly tell you that it is a distributed, and what kind of model to

22、 choose, choose what kind of view, to complete what the user requests. Control layer does not do any data processing. For example, the user clicks on a link and control layer to receive arequest, does not deal with business information, only the users information to the model, to tell what model to

23、choose the view to meet the requirements to return to the user. Therefore, a model may correspond to multiple views, one view may correspond to a number of models. The benefits of MVC Most of the process of language use such as ASP, PHP developed Web applications, the development of the initial temp

24、late is the mixed layer of the data programming. For example, send the request directly to the database and display HTML, development speed is often faster, but because of the separation of data pages is not very direct, and therefore reflect the business model difficult to look or model reusability

25、. Very flexible product design efforts, it is difficult to meet the changing needs of users. MVC layered on the application of the requirements, although additional work would take, but clearly the structure of products, product application through the model can be better reflected. First of all, th

26、e most important thing is that there should be a number of view corresponds to the ability of a model. In the current rapidly changing user requirements, it may have access to a wide range of applications. For example, orders for the model may be orders of the system as well as online orders, or ord

27、ers for other systems, but the handling of orders is the same, that is to say the handling of orders is the same. MVC design pattern in accordance with a orders for models and multiple views can solve the problem. This reduced the code to copy, that is, a reduction of the maintenance code, once the

28、model changes, but also easy to maintain. MVC Design Model Secondly, the data returned as a result of the model without any display format, so these models can also be directly applied to the use of interfaces. Third, as a result of an application to be separated into three, it is sometimes one of t

29、hem will be able to change to meet changes in the application. An application of business processes or business rules change simply changes the model layer MVC. The concept of control layer is also very effective, because of its different models and different views together to complete various reque

30、sts, the control layer can be said to be included in the concept of a user request for permission. Finally, it is also beneficial to the management of software engineering. Because each different layer, each layer of different applications have some similar characteristics, is conducive to the adoption of engineering and

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论