一种新的网络应用程序开发框架——mvc--毕业论文设计外文翻译.doc

上传人:知****量 文档编号:91611550 上传时间:2023-05-27 格式:DOC 页数:10 大小:161.50KB
返回 下载 相关 举报
一种新的网络应用程序开发框架——mvc--毕业论文设计外文翻译.doc_第1页
第1页 / 共10页
一种新的网络应用程序开发框架——mvc--毕业论文设计外文翻译.doc_第2页
第2页 / 共10页
点击查看更多>>
资源描述

《一种新的网络应用程序开发框架——mvc--毕业论文设计外文翻译.doc》由会员分享,可在线阅读,更多相关《一种新的网络应用程序开发框架——mvc--毕业论文设计外文翻译.doc(10页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、外文资料翻译译文一种新的网络应用程序开发框架MVC摘要: MVC(Model/View/Controller)的设计模式出现在在Smalltalk-80,并在软件的设计中广泛应用。本文介绍一种基于MVC框架的的新网络应用程序。这种框架把实施逻辑与表现形式独立开来。它也提高了系统的可维护性,可扩展性以及使用模块数据库备案、模板数据库,通讯对象和缓冲队列的性能。关键词:MVC、设计模式、网络应用程序1.简介 网络应用系统是一个基于B(rowser)/ S(erver)模型应用系统。它利用多种动态网页开发技术。目前,软件设计的主题之一是网络应用开发模式和工具的。它们直接影响系统的几个关键因素,比如可

2、维护性、可扩展性、稳定性和安全性。本文中,基于MVC1的网络应用程序的设计模式是为解决这两类因素扩展性和可维护性这些不易处理的问题。把MVC设计模式引入网络应用程序开发,执行逻辑可以独立于系统的表现形式。 MVC由三种对象组成。1)模型:是应用对象,2)视图:是它的屏幕的显示,3)控制器:定义用户界面并对输入的信息做出响应。在出现MVC之前,用户界面的设计倾向于把这些东西做在一起。然而,MVC独立了它们,增加系统的灵活性和可重用性。MVC把视图和模型独立开来,在它们之间建立了“subscribe/notify”协议。一个视图必须确保其正确反映模型的状态。每当模型的数据发生改变,视图会得到相应的

3、通知。作为回应,每个视图都会有更新自身的机会。这个方法可以让你附上一个模型的多个视图以便提供不同的报告。你也可以不改变原模型同时创建新的视图。2.背景和存在的问题 虽然MVC的设计模式已经在smalltalk-80中提出了,并广泛应用于软件设计,介绍它到网页应用程序开发却仍很困难的。主要由于以下两个因素:1)首先,很难独立 来自OC的编程语言。早期的CGI程序使用字符串输出创造了HTML内容。默认的,将HTML文本分成几份,然后把他们嵌入到CGI程序中。脚本语言出现后,变成了脚本语言编写的程序嵌入到HTML文本中。然而,这两种方法有一个共同的不足,使他们不能完全独立于HTML文本。因此,这两种

4、方法使采用MVC分离三层模式十分难以实现。2)第二,脚本语言的功能太弱。他们缺乏一些必要的技术支持来采用MVC的设计模式,如消息机制和事件回应机制。直到 Model2版,这种情况并没有受到任何改善。依靠强大的OC语言功能, Model24某种程度上实行MVC设计理念。图 1显示了MVC的机制:模型(数据层):它是封装到企业JavaBean。视图(表示层):view负责的网页方式,如报告的格式,分页等。控制器(控制层):Servlet受到网页上的用户的输入并执行有关的操作(呼叫相应的EJB组件),给出了相关视图,所以会呈现这些结果。 Model2机制主要满足了开发商对要求Web应用逻辑和用户界面

5、独立的需求。但制仍然存在某些限,例如,尽管 Model2已经实施采用MVC设计模式的基本理念,三个层次之间的相互关系(Servlet,Java Bean/ EJB)仍然封闭。特别是,就Servlet当控制器,不仅控制选择同时响应模型的模块,还负责对处理JSP转移数据提供模块。因为这一过程,Servlet本身已实现非常复杂的执行逻辑,对于体系的发展和维护这是正是一个棘手的问题。因此,在下面的网络应用系统框架,我们会进一步划分出功能的控制器。3.解决方案 图2中显示,这一系统框架包含三个内核控制对象/类(UIViewController, Model Center, and LPM(Logical

6、 Page Module) Center)和它们的核心数据库(system description database, model database, and LPM database)。这三个控制对象/类根据原始的控制器划分。通过这些控制对象/类和数据库,下文将解释部分的设计思想和该系统框架的实现机制。 首先,我们考虑UIViewController和系统的描述数据库。他们负责接收用户的要求和根据这些请求搜索有关的执行逻辑。系统描述数据库可以是一个XML2文件或一套XML文件。这个数据库描述了不同的执行逻辑与不同的用户请求。执行逻辑主要包括互动模式、数据来源与异常处理等,这些组织在一个树形结

7、构中。而UIViewController可以搜索系统描述数据库。它结合了用户的要求和来自数据的执行逻辑,然后把它们交给传输器来封装。UIViewController有两种方法搜索数据库。 其一是使用DOM对象(Document Object Model)3。当应用程序系统开机,这样需要DOM解析器分析整个数据库备案后载入内存。数据库将保留在内存中的DOM树结构。另一种是使用SAX(Simple API for XML)接口。两者有各自的优缺点。使用DOM可以实现结构搜索。它可以在大型数据库上使用,但是会暂用更多的系统资源。而SAX接口以高效率和更少的系统资源占用率著称。唯一的缺点是它获得信息比

8、DOM难。 其次,我们考虑模型中心和模型数据库。该层通过调用给定模块完成定义执行逻辑。模型数据库包括大量的对象和模块。这些对象和模块根据特定的执行逻辑封装响应方法。当模式中心接收到的执行消息,它根据封装在信息里的执行逻辑选择合适的对象或模块。然后按照给定的数据格式封装模块,冰传输给LPM中心。此外,每个对象或模块只需要关心如何实现给定的事务的逻辑以及如何获得必要的数据而不提交这些数据。 最后,我们研究一下LPM中心和LPM数据库。LPM是实施描述的某一种数据类型的项目集合,它可以当成是一个或一组磁盘文件。在另一方面,有一个网页可有一个逻辑页或多条逻辑页。一个LPM的功能是很简单的:它只需要在没

9、有被得到执行逻辑和原数据内容的情况下给定数据类型。因此事实上,LPM是作为标签库(JSP)或数据捆绑(.net)而开发的。此外,这种类型的服务器脚本可以很容易由客户开发人员在UI(user interface)设计阶段理解,what-you-see-is-what-you-get(所见即所得)工具也很容易开发。在这部分,LPM中心从模型中心收到数据。它根据给定数据类型和执行逻辑选择适当的逻辑页模块,然后封装逻辑页的输出模块到HTTP响应并将发布到客户端。注意到这3个控制对象,除了UIViewController,另外两个不是直接进入自己的核心数据库。例如,模式中心不直接从模型数据库调用对象或模

10、块。它实现了通过ModelFactory的存取。(过程见图2) 通过分析系统框架,可以看出整个系统完全符合MVC设计模式。在在系统的开发时期各部分的开发者三者冰不具有相互的干涉。当系统框架已确定,各部分惊人的发现开发的相似。在过去这对网络应用程序的开发来说是不可能的。因为我们已经把控制器分为3个部分,MVC三层(模型/视图/控制器)的联系变得更加宽松。所以它可以明显提高整个系统的可扩充性。在下一节,我们将向你展示一个简单的例子去解释如何在三层MVC模式的过程通过增加中间执行步骤扩大系统框架。4.相关问题 检查目前的网络应用程序设计模式(如CGI, Model2等等),我们可以获得初步结果:MV

11、C模式是一个优于其他系统逻辑框架的网站应用系统开发模式,它平衡了合作开发、系统的可扩展性和可维护性。这主要由于旧设计模式对系统逻辑框架的独立性的不足之处。例如,在通过CGI开发的网页系统中,CGI程序不仅需要处理执行逻辑,同时也负责系统报告的格式。因此,它要求开发者有很强的编程能力(他们必须非常熟悉执行规划和界面设计)。此外,它甚至会使系统的逻辑层次混乱。最后,混沌编码会带来一系列的问题。使用服务器脚本语言(如ASP,PHP等等)实现的网页应用系统也不符合要求。其原因是,这些脚本语言都有天生的缺陷(例如,他们却没有有好的对象支持和事件响应机制等);他们不能令人满意地缩短网络应用系统的执行逻辑。

12、由此 Model2的不足已在上文描述过了,所以没有这个必要在这赘述了。5.结论 从上述对系统框图的分析,我们可以做一个结论。改进后的MVC设计模式框架比传统方法有更清楚的结构,每个模块间的联系甚少。框架解决是一个大问题,曾困惑很多网络开发者。它将执行逻辑从表现模式独立出来,实施并行进行发展。此外,利用模型数据库和LPM数据库,这个更系统的灵活性、可维护性和可扩充性得到了显著提高。本篇讨论的框架已经在UEST网络应用系统上得以实施()。 外文原文A Novel Web Application FrameDeveloped by MVCLuo GuangChun WangYanhua Lu Xia

13、nliang Hanhong(Information Center of UEST of China, ChengDu, China 610054)AbstractThe MVC (Model/View/Controller) design pattern was developed in Smalltalk-80 and widely used in software design. This paper introduces a novel Web application frame based on MVC. This frame separates the transaction lo

14、gic from the presentation format. It also improves the system maintainability, scalability and performance by using the module database, template database, messaging object and buffer queue.Key words: MVC, Design Pattern, Web Application1. Introduction Web application system is a transaction system

15、based on B (rowser)/S(erver) model. It exploits many kinds of dynamic Web developing technologies. At present, Web application developing patterns and tools are one of the topics of the software design. They directly influence several key factors such as maintainability, scalability, stability and t

16、he security. In this paper, the purpose of MVC1-based Web application design pattern is to resolve the two factors maintainability and scalability, which are the stubborn problems in the Web application development. By introducing the MVC design pattern into the Web application development, the impl

17、ementation of system transaction logic can be separated from the system presentation.MVC consists of three kinds of objects. 1) the Model: is the application object, 2) the View: is its screen presentation, 3) the Controller: defines the way the user interface reacts to user input. Before MVC, user

18、interface designs tended to lump these objects together. However, MVC decouples them to increase the flexibility and reuse. MVC decouples views and models by establishing a “subscribe/notify” protocol between them. A view must ensure that its appearance reflects the state of the model correctly. Whe

19、never the models data changes, the model notifies views that depend on it. In response, each view gets an opportunity to update itself. This approach lets you attach multiple views to a model to provide different presentations. You can also create new views for a model without rewriting it.2. Backgr

20、ound and Problems Even though the MVC design pattern was already put forward in smalltalk-80 and widely used in software design, it is difficult to introduce it into the Web application development. It was mainly due to the following two factors: 1) First, it was difficult to separate the programmin

21、g language from HTML. Early CGI programs created the HTML content by using character string output. In nature, it divided the HTML content into several portions, and then inserted them into the CGI programs. After the appearance of Script languages, the way changed to insert the programs written by

22、script languages into HTML content. However, these two ways had a common deficiency that they could not separate the programs from the HTML content absolutely. Therefore, it is very difficult to implement the MVC detached three-layer pattern based on these two ways. 2) Second, functions of the scrip

23、t languages are less weak. They lack some necessary technologies to support the MVC design pattern, such as message mechanism and event response mechanism. This situation did not get any improvement until the release of the JSP Model 24. Depending on the powerful functions of OC language, the JSP Mo

24、del 2 implements the MVC design idea to some extent. Figure 1 shows the mechanism: Model (the data layer): it is encapsulated into the Enterprise JavaBean. View (the presentation layer): JSP is responsible for the presentation of pages, such as the presentation format, paging, etc. Controller (the c

25、ontrol layer): Servlet receives the user input in pages and executes the relevant transaction (calling the corresponding EJB modules), then gives the results to the relevant View, so JSP can present these results. This mechanism of JSP Model 2 basically meets the developers requirements to detach th

26、e Web application transaction logic from the user interface. But some limits still exist. For example, although JSP Model 2 has implemented the basic idea of the MVC design pattern, the relationship of these three layers (Servlet, JavaBean/EJB and JSP) is still close. Especially the Servlet, which a

27、cts as the Controller, not only controls the selection and call of Models modules, but also is responsible for transferring data provided by modules to the corresponding JSP to handle. Because of this process, Servlet has to implement very complicated transaction logic by itself, which is a tough pr

28、oblem for the system development and maintenance. Thus, in the following Web application system frame, we will further divide the functions of the Controller.3. Solution As show in Figure 2, this system frame contains three kernel control objects/classes (UIViewController, Model Center, and LPM (Log

29、ical Page Module) Center) and their own kernel database (system description database, model database, and LPM database). These three control objects/classes are divided from the raw Controller. Using these control objects/classes and databases, the following parts of this paper will explain the desi

30、gn idea and implementation mechanism of this system frame. Firstly, we consider the UIViewController and the System Description Database. They are responsible for receiving the user requests and searching the relevant transaction logic according to these requests. The System Description Database can

31、 be a XML2 file or a set of XML files. This database describes the different transaction logic related to different user requests one by one. The transaction logics mainly include the interactive mode, data sources, and error handling, etc. They are organized in a tree structure. The UIViewControlle

32、r searches the System Description Database. It combines the user requests and the transaction logic searched out from the database, and then delivers them to Messenger to encapsulate. There are two ways for UIViewController to search the database. One uses the DOM (Document Object Model) object3. Wh

33、en the application system boots, this way requires the whole database to be loaded into RAM after analyzed by the DOM Parser. The database resides in the RAM in a DOM tree structure. The other one uses SAX (Simple API for XML) interface. Both of them have their own advantages and disadvantages. Usin

34、g DOM can implement structural search. It can achieve the efficiency in the case of larger database, but it also costs more system resources. The SAX interface is famous for its high efficiency and less system resources requirements. The only disadvantage is that it obtains some information less con

35、veniently than the DOM does. Secondly, we consider the Model Center and Model Database.This layer completes the defined transaction logic by calling the given module. Model Database contains a mass of objects and modules. These objects and modules encapsulate the responding methods relative to speci

36、fic transaction logic. When Model Center receives the transaction messages from Messenger, it selects suitable objects or modules according to the different transaction logic encapsulated in the message. Then it encapsulated the handled data in given format and delivers them to the LPM Center. Furth

37、ermore, each object or module only needs to concern how to implement the given transaction logic and how to obtain the necessary data without concerning the presentation of these data. Lastly, we concern the LPM Center and LPM Database. LPM is a set of programs to implement the presentation for a ce

38、rtain data type. It can correspond to a disk file or a set of disk files. On the other hand, a certain Web page can contain one logical page or multiple logical pages. To a LPM, its function is very simple: it only need to present the given data type without being notified any transaction logic and

39、without concerning the source and content of the data. Thus, in the practical development, the LPM is developed by such technologies as label library (JSP) or data binding (.Net). Furthermore, this type of server scripts can be easily understood by the client developers during the UI (user interface

40、) design period and can be developed by some what-you-see-is-what-you-get (WYSIWYG) tools. In this portion, LPM Center receives the data from the Model Center. It selects the suitable logical page module according to the given data type and transaction logic, then it encapsulates the output of logic

41、al page module into HTTP response and sends the response to the client. Note that among these three control objects, except UIViewController ,the other two do not directly access the their own kernel databases. For example, Model Center does not directly call the objects or modules in the Model Data

42、base. It implements the access through the ModelFactory class instead. (Showed in figure 2) According to the analysis of this system frame, we can see that the whole system perfectly conforms to the MVC design pattern. During the system development period, there is no distinct interactive relationsh

43、ip among the developers in each part. As long as the system frame is established, the development of each part can be preceded in parallel. It is impossible for the Web application developers to use this approach in the past. Because we have divided the Controller into three parts, the couplings of

44、MVC three layers (Model/View/Controller) become looser than ever. So it can improve the scalability of the whole system significantly. In the following section, we will show you a simple example to explain how to expand the system frame by adding intermediate transaction processes among the three-la

45、yer MVC pattern.4. Relative problems Examining the present Web application design patterns (such as CGI, JSP MODEL 2, etc.), we can gain an elementary result: Web application system developed by MVC pattern excels the one developed by other patterns at the system logical frame, parallel cooperating

46、development, system scalability and maintainability. It is mainly due to the deficiencies of the old design patterns on system logical frame partition. For example, in Web systems developed by CGI, the CGI programs not only need to process the transaction logic, but also are responsible for the syst

47、em presentation format. Therefore, it requires the developers to have very powerful programming ability (they have to be very familiar both with the transaction programming and the interface designing). In addition, it even makes the system logic and hierarchy chaotic. At last the chaotic codes will

48、 lead into a series of problems. Using the server script languages (such as ASP, PHP, etc.) to implement Web application systems is also not satisfactory. The reason is that the script languages have innate deficiencies (for example, they do not have good object supporting and event response mechanism); they cannot satisfactorily encapsulate the transaction logics of Web application systems. The deficiencies of JSP Model 2 have been described in the above part of this paper, so it has no need to be presented in here again.5. Conclusion From the analysis of the system fr

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

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁