



下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、杭州電子科技大學(xué)畢業(yè)設(shè)計(jì)(論文)外文文獻(xiàn)翻譯 業(yè) 計(jì) 論 ) 目畢 設(shè) ( 文 題 中小型企業(yè)員工工作信息管理系統(tǒng)翻譯(1)題目 一種新的網(wǎng)絡(luò)應(yīng)用程序開發(fā)框架mvc翻譯(2)題目 網(wǎng)站建設(shè)技術(shù) 學(xué) 院 計(jì)算機(jī)學(xué)院 專 業(yè) 軟件工程 姓 名 黃品瑾 班 級(jí) 07052713 學(xué) 號(hào) 07057314 指導(dǎo)教師 閆飛譯文一: 一種新的網(wǎng)絡(luò)應(yīng)用程序開發(fā)框架mvc摘要 mvcmodel/view/controller的設(shè)計(jì)模式出現(xiàn)在在smalltalk-80并在軟件的設(shè)計(jì)中廣泛應(yīng)用。本文介紹一種基于mvc框架的的新網(wǎng)絡(luò)應(yīng)用程序。這種框架把實(shí)施邏輯與表現(xiàn)形式獨(dú)立開來(lái)。它也提高了系統(tǒng)的可維護(hù)性可擴(kuò)展性以及
2、使用模塊數(shù)據(jù)庫(kù)備案、模板數(shù)據(jù)庫(kù)通訊對(duì)象和緩沖隊(duì)列的性能。關(guān)鍵詞:mvc、設(shè)計(jì)模式、網(wǎng)絡(luò)應(yīng)用程序1.簡(jiǎn)介 網(wǎng)絡(luò)應(yīng)用系統(tǒng)是一個(gè)基于browser/ server模型應(yīng)用系統(tǒng)。它利用多種動(dòng)態(tài)網(wǎng)頁(yè)開發(fā)技術(shù)。目前軟件設(shè)計(jì)的主題之一是網(wǎng)絡(luò)應(yīng)用開發(fā)模式和工具的。它們直接影響系統(tǒng)的幾個(gè)關(guān)鍵因素比如可維護(hù)性、可擴(kuò)展性、穩(wěn)定性和安全性。本文中,基于mvc1的網(wǎng)絡(luò)應(yīng)用程序的設(shè)計(jì)模式是為解決這兩類因素?cái)U(kuò)展性和可維護(hù)性這些不易處理的問(wèn)題。把mvc設(shè)計(jì)模式引入網(wǎng)絡(luò)應(yīng)用程序開發(fā),執(zhí)行邏輯可以獨(dú)立于系統(tǒng)的表現(xiàn)形式。 mvc由三種對(duì)象組成。1模型:是應(yīng)用對(duì)象,2視圖:是它的屏幕的顯示3控制器:定義用戶界面并對(duì)輸入的信息做出響應(yīng)
3、。在出現(xiàn)mvc之前用戶界面的設(shè)計(jì)傾向于把這些東西做在一起。然而mvc獨(dú)立了它們,增加系統(tǒng)的靈活性和可重用性。mvc把視圖和模型獨(dú)立開來(lái)在它們之間建立了“subscribe/notify”協(xié)議。一個(gè)視圖必須確保其正確反映模型的狀態(tài)。每當(dāng)模型的數(shù)據(jù)發(fā)生改變視圖會(huì)得到相應(yīng)的通知。作為回應(yīng)每個(gè)視圖都會(huì)有更新自身的機(jī)會(huì)。這個(gè)方法可以讓你附上一個(gè)模型的多個(gè)視圖以便提供不同的報(bào)告。你也可以不改變?cè)P屯瑫r(shí)創(chuàng)建新的視圖。2.背景和存在的問(wèn)題 雖然mvc的設(shè)計(jì)模式已經(jīng)在smalltalk-80中提出了并廣泛應(yīng)用于軟件設(shè)計(jì)介紹它到網(wǎng)頁(yè)應(yīng)用程序開發(fā)卻仍很困難的。主要由于以下兩個(gè)因素:1首先很難獨(dú)立 來(lái)自html的編
4、程語(yǔ)言。早期的cgi程序使用字符串輸出創(chuàng)造了html內(nèi)容。默認(rèn)的將html文本分成幾份然后把他們嵌入到cgi程序中。腳本語(yǔ)言出現(xiàn)后變成了腳本語(yǔ)言編寫的程序嵌入到html文本中。然而這兩種方法有一個(gè)共同的不足使他們不能完全獨(dú)立于html文本。因此這兩種方法使采用mvc分離三層模式十分難以實(shí)現(xiàn)。2第二 luo guangchun the ph.d. of uest of china wang yanhua the master of the uest of china lu xianliang theprofessor of uest of china advisor of ph.d. han h
5、ong the ph.d. of uest of china腳本語(yǔ)言的功能太弱。他們?nèi)狈σ恍┍匾募夹g(shù)支持來(lái)采用mvc的設(shè)計(jì)模式如消息機(jī)制和事件回應(yīng)機(jī)制。直到j(luò)sp model2版這種情況并沒(méi)有受到任何改善。依靠強(qiáng)大的java語(yǔ)言功能jsp model24某種程度上實(shí)行mvc設(shè)計(jì)理念。圖 1顯示了mvc的機(jī)制:模型數(shù)據(jù)層:它是封裝到企業(yè)javabean。視圖表示層:jsp負(fù)責(zé)的網(wǎng)頁(yè)方式如報(bào)告的格式分頁(yè)等??刂破骺刂茖?servlet受到網(wǎng)頁(yè)上的用戶的輸入并執(zhí)行有關(guān)的操作呼叫相應(yīng)的ejb組件給出了相關(guān)視圖所以jsp會(huì)呈現(xiàn)這些結(jié)果。 jsp model2 機(jī)制主要 滿足了開發(fā)商對(duì)要求 web 應(yīng)用
6、邏輯和用戶界面獨(dú)立 的需求。但制仍然存在某 些 限 , 例 如 盡 管 jsp model2 已經(jīng)實(shí)施采用 mvc 設(shè)計(jì)模式的基本理念,三 個(gè)層次之間的相互關(guān)系servletjava bean/ ejb 和 jsp仍然封閉。特別是就 servlet 當(dāng)控制器不僅控制選擇同時(shí)響應(yīng)模型的模塊還負(fù)責(zé)對(duì)處理 jsp 轉(zhuǎn)移數(shù)據(jù)提供模塊。因?yàn)檫@一過(guò)程servlet 本身已實(shí)現(xiàn)非常復(fù)雜的執(zhí)行邏輯,對(duì)于體系的發(fā)展和維護(hù)這是正是一個(gè)棘手的問(wèn)題。因此在下面的網(wǎng)絡(luò)應(yīng)用系統(tǒng)框架我們會(huì)進(jìn)一步劃分出功能的控制器。3.解決方案 圖2中顯示這一系統(tǒng)框架包含三個(gè)內(nèi)核控制對(duì)象/類syscontroller modelcenter
7、 and lpmlogical page module center 和 它 們 的 核 心 數(shù) 據(jù) 庫(kù) systemdescription database model database and lpm database。這三個(gè)控制對(duì)象/類根據(jù)原始的控制器劃分。通過(guò)這些控制對(duì)象/類和數(shù)據(jù)庫(kù)下文將解釋部分的設(shè)計(jì)思想和該系統(tǒng)框架的實(shí)現(xiàn)機(jī)制。 首先我們考慮syscontroller和系統(tǒng)的描述數(shù)據(jù)庫(kù)。他們負(fù)責(zé)接收用戶的要求和根據(jù)這些請(qǐng)求搜索有關(guān)的執(zhí)行邏輯。系統(tǒng)描述數(shù)據(jù)庫(kù)可以是一個(gè)xml2文件或一套xml文件。這個(gè)數(shù)據(jù)庫(kù)描述了不同的執(zhí)行邏輯與不同的用戶請(qǐng)求。執(zhí)行邏輯主要包括互動(dòng)模式、數(shù)據(jù)來(lái)源與異常處
8、理等,這些組織在一個(gè)樹形結(jié)構(gòu)中。而syscontroller可以搜索系統(tǒng)描述數(shù)據(jù)庫(kù)。它結(jié)合了用戶的要求和來(lái)自數(shù)據(jù)的執(zhí)行邏輯然后把它們交給傳輸器來(lái)封裝。syscontroller有兩種方法搜索數(shù)據(jù)庫(kù)。 其一是使用dom對(duì)象document object model3。當(dāng)應(yīng)用程序系統(tǒng)開機(jī)這樣需要dom解析器分析整個(gè)數(shù)據(jù)庫(kù)備案后載入內(nèi)存。數(shù)據(jù)庫(kù)將保留在內(nèi)存中的dom樹結(jié)構(gòu)。另一種是使用saxsimpleapi for xml接口。兩者有各自的優(yōu)缺點(diǎn)。使用dom可以實(shí)現(xiàn)結(jié)構(gòu)搜索。它可以在大型數(shù)據(jù)庫(kù)上使用但是會(huì)暫用更多的系統(tǒng)資源。而sax接口以高效率和更少的系統(tǒng)資源占用率著稱。唯一的缺點(diǎn)是它獲得信息比d
9、om難。 其次我們考慮模型中心和模型數(shù)據(jù)庫(kù)。該層通過(guò)調(diào)用給定模塊完成定義執(zhí)行邏輯。模型數(shù)據(jù)庫(kù)包括大量的對(duì)象和模塊。這些對(duì)象和模塊根據(jù)特定的執(zhí)行邏輯封裝響應(yīng)方法。當(dāng)模式中心接收到的執(zhí)行消息它根據(jù)封裝在信息里的執(zhí)行邏輯選擇合適的對(duì)象或模塊。然后按照給定的數(shù)據(jù)格式封裝模塊冰傳輸給lpm中心。此外每個(gè)對(duì)象或模塊只需要關(guān)心如何實(shí)現(xiàn)給定的事務(wù)的邏輯以及如何獲得必要的數(shù)據(jù)而不提交這些數(shù)據(jù)。 最后我們研究一下lpm中心和lpm數(shù)據(jù)庫(kù)。lpm是實(shí)施描述的某一種數(shù)據(jù)類型的項(xiàng)目集合,它可以當(dāng)成是一個(gè)或一組磁盤文件。在另一方面有一個(gè)網(wǎng)頁(yè)可有一個(gè)邏輯頁(yè)或多條邏輯頁(yè)。一個(gè)lpm的功能是很簡(jiǎn)單的:它只需要在沒(méi)有被得到執(zhí)行邏
10、輯和原數(shù)據(jù)內(nèi)容的情況下給定數(shù)據(jù)類型。因此事實(shí)上lpm是作為標(biāo)簽庫(kù)jsp或數(shù)據(jù)捆綁.net而開發(fā)的。此外這種類型的服務(wù)器腳本可以很容易由客戶開發(fā)人員在uiuserinterface設(shè)計(jì)階段理解,what-you-see-is-what-you-get所見(jiàn)即所得工具也很容易開發(fā)。在這部分lpm中心從模型中心收到數(shù)據(jù)。它根據(jù)給定數(shù)據(jù)類型和執(zhí)行邏輯選擇適當(dāng)?shù)倪壿嬳?yè)模塊然后封裝邏輯頁(yè)的輸出模塊到http響應(yīng)并將發(fā)布到客戶端。注意到這3個(gè)控制對(duì)象除了syscontroller另外兩個(gè)不是直接進(jìn)入自己的核心數(shù)據(jù)庫(kù)。例如模式中心不直接從模型數(shù)據(jù)庫(kù)調(diào)用對(duì)象或模塊。它實(shí)現(xiàn)了通過(guò)modelfactory的存取。(過(guò)
11、程見(jiàn)圖2) 通過(guò)分析系統(tǒng)框架可以看出整個(gè)系統(tǒng)完全符合mvc設(shè)計(jì)模式。在在系統(tǒng)的開發(fā)時(shí)期各部分的開發(fā)者三者冰不具有相互的干涉。當(dāng)系統(tǒng)框架已確定,各部分驚人的發(fā)現(xiàn)開發(fā)的相似。在過(guò)去這對(duì)網(wǎng)絡(luò)應(yīng)用程序的開發(fā)來(lái)說(shuō)是不可能的。因?yàn)槲覀円呀?jīng)把控制器分為3個(gè)部分,mvc三層模型/視圖/控制器的聯(lián)系變得更加寬松。所以它可以明顯提高整個(gè)系統(tǒng)的可擴(kuò)充性。在下一節(jié)我們將向你展示一個(gè)簡(jiǎn)單的例子去解釋如何在三層mvc模式的過(guò)程通過(guò)增加中間執(zhí)行步驟擴(kuò)大系統(tǒng)框架。4.相關(guān)問(wèn)題 檢查目前的網(wǎng)絡(luò)應(yīng)用程序設(shè)計(jì)模式如cgijsp model2等等,我們可以獲得初步結(jié)果:mvc模式是一個(gè)優(yōu)于其他系統(tǒng)邏輯框架的網(wǎng)站應(yīng)用系統(tǒng)開發(fā)模式,它平
12、衡了合作開發(fā)、系統(tǒng)的可擴(kuò)展性和可維護(hù)性。這主要由于舊設(shè)計(jì)模式對(duì)系統(tǒng)邏輯框架的獨(dú)立性的不足之處。例如,在通過(guò)cgi開發(fā)的網(wǎng)頁(yè)系統(tǒng)中,cgi程序不僅需要處理執(zhí)行邏輯同時(shí)也負(fù)責(zé)系統(tǒng)報(bào)告的格式。因此,它要求開發(fā)者有很強(qiáng)的編程能力他們必須非常熟悉執(zhí)行規(guī)劃和界面設(shè)計(jì)。此外,它甚至?xí)瓜到y(tǒng)的邏輯層次混亂。最后混沌編碼會(huì)帶來(lái)一系列的問(wèn)題。使用服務(wù)器腳本語(yǔ)言如aspphp等等實(shí)現(xiàn)的網(wǎng)頁(yè)應(yīng)用系統(tǒng)也不符合要求。其原因是這些腳本語(yǔ)言都有天生的缺陷例如他們卻沒(méi)有有好的對(duì)象支持和事件響應(yīng)機(jī)制等;他們不能令人滿意地縮短網(wǎng)絡(luò)應(yīng)用系統(tǒng)的執(zhí)行邏輯。由此jsp model2的不足已在上文描述過(guò)了所以沒(méi)有這個(gè)必要在這贅述了。5.結(jié)論
13、 從上述對(duì)系統(tǒng)框圖的分析我們可以做一個(gè)結(jié)論。改進(jìn)后的mvc設(shè)計(jì)模式框架比傳統(tǒng)方法有更清楚的結(jié)構(gòu),每個(gè)模塊間的聯(lián)系甚少。框架解決是一個(gè)大問(wèn)題曾困惑很多網(wǎng)絡(luò)開發(fā)者。它將執(zhí)行邏輯從表現(xiàn)模式獨(dú)立出來(lái),實(shí)施并行進(jìn)行發(fā)展。此外利用模型數(shù)據(jù)庫(kù)和lpm數(shù)據(jù)庫(kù),這個(gè)更系統(tǒng)的靈活性、可維護(hù)性和可擴(kuò)充性得到了顯著提高 。 本 篇 討 論 的 框 架 已 經(jīng) 在 uest 網(wǎng) 絡(luò) 應(yīng) 用 系 統(tǒng) 上 得 以 實(shí) 施。參考文獻(xiàn)1 erich gamma. design patterns. u.s. addison-wesley pub co.2 didier martin. professional xml. u.k.
14、 wrox press.3 stephen t. mohr. designing distributed applications with xml asp ie5ldap amp msmq. u.k. wrox press.4 sun microsystems inc. javatm servlet 2.3 and javaserver pagestm 1.2 specfications.5 sun microsystems inc. javaserver pagestm standard tag library specification原文一: a novel web applicati
15、on frame developed by mvc luo guangchun wangyanhua lu xianliang hanhong information center of uest of china chengdu china 610054abstractthe mvc model/view/controller design pattern was developed in smalltalk-80 andwidely used in software design. this paper introduces a novel web application frame ba
16、sedon mvc. this frame separates the transaction logic from the presentation format. it alsoimproves the system maintainability scalability and performance by using the moduledatabase template database messaging object and buffer queue.key words: mvc design pattern web application1. introduction web
17、application system is a transaction system based on b rowser/server model. itexploits many kinds of dynamic web developing technologies. at present web applicationdeveloping patterns and tools are one of the topics of the software design. they directlyinfluence several key factors such as maintainab
18、ility scalability stability and the security.in this paper the purpose of mvc1-based web application design pattern is to resolvethe two factors maintainability and scalability which are the stubborn problems in theweb application development. by introducing the mvc design pattern into the webapplic
19、ation development the implementation of system transaction logic can be separatedfrom the system presentation. mvc consists of three kinds of objects. 1 the model: is the application object 2 theview: is its screen presentation 3 the controller: defines the way the user interface reactsto user input
20、. before mvc user interface designs tended to lump these objects together.however mvc decouples them to increase the flexibility and reuse. mvc decouplesviews and models by establishing a “subscribe/notify” protocol between them. a viewmust ensure that its appearance reflects the state of the model
21、correctly. whenever themodels data changes the model notifies views that depend on it. in response each viewgets an opportunity to update itself. this approach lets you attach multiple views to a luo guangchun the ph.d. of uest of china wang yanhua the master of the uest of china lu xianliang thepro
22、fessor of uest of china advisor of ph.d. han hong the ph.d. of uest of chinamodel to provide different presentations. you can also create new views for a modelwithout rewriting it.2. background and problems even though the mvc design pattern was already put forward in smalltalk-80 andwidely used in
23、software design it is difficult to introduce it into the web applicationdevelopment. it was mainly due to the following two factors: 1 first it was difficult toseparate the programming language from html. early cgi programs created the htmlcontent by using character string output. in nature it divid
24、ed the html content intoseveral portions and then inserted them into the cgi programs. after the appearance ofscript languages the way changed to insert the programs written by script languages intohtml content. however these two ways had a common deficiency that they could notseparate the programs
25、from the html content absolutely. therefore it is very difficult toimplement the mvc detached three-layer pattern based on these two ways. 2 secondfunctions of the script languages are less weak. they lack some necessary technologies tosupport the mvc design pattern such as message mechanism and eve
26、nt responsemechanism. this situation did not get any improvement until the release of the jsp model24. depending on the powerful functions of java language the jsp model 2 implementsthe mvc design idea to some extent. figure 1 shows the mechanism: model the data layer: it is encapsulated into the en
27、terprise javabean. view the presentation layer: jsp is responsible for the presentation of pages such as the presentation format paging etc. controller the control layer: servlet receives the user input in pages and executes the relevant transaction calling the corresponding ejb modules then gives t
28、heresults to the relevant view so jsp can present these results. this mechanism of jsp model 2 basically meets the developers requirements todetach the web application transaction logic from the user interface. but some limits stillexist. for example although jsp model 2 has implemented the basic id
29、ea of the mvcdesign pattern the relationship of these three layers servlet javabean/ejb and jsp isstill close. especially the servlet which acts as the controller not only controls theselection and call of models modules but also is responsible for transferring data providedby modules to the corresp
30、onding jsp to handle. because of this process servlet has toimplement very complicated transaction logic by itself which is a tough problem for thesystem development and maintenance. thus in the following web application systemframe we will further divide the functions of the controller.3. solution
31、as show in figure 2 this system frame contains three kernel control objects/classessyscontroller model center and lpm logical page module center and their ownkernel database system description database model database and lpm database. thesethree control objects/classes are divided from the raw contr
32、oller. using these controlobjects/classes and databases the following parts of this paper will explain the design ideaand implementation mechanism of this system frame. firstly we consider the syscontroller and the system description database. theyare responsible for receiving the user requests and
33、searching the relevant transaction logicaccording to these requests. the system description database can be a xml2 file or aset of xml files. this database describes the different transaction logic related to differentuser requests one by one. the transaction logics mainly include the interactive mo
34、de datasources and error handling etc. they are organized in a tree structure. the syscontrollersearches the system description database. it combines the user requests and thetransaction logic searched out from the database and then delivers them to messenger toencapsulate. there are two ways for syscontroller to search the database. one uses thedom document object model object3. when the application system boots this wayrequires the whole database to be loaded
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 不銹鋼欄桿安裝與社區(qū)安全防范系統(tǒng)合同
- 施工現(xiàn)場(chǎng)清理服務(wù)合同5篇
- 美術(shù)的英語(yǔ)課件
- 安全生產(chǎn)目標(biāo)指什么
- 冬季安全心得體會(huì)300字
- 小學(xué)安全副校長(zhǎng)述職報(bào)告
- 鋼鐵公司安全培訓(xùn)心得體會(huì)
- 安全環(huán)保知識(shí)學(xué)習(xí)
- 四川省安全生產(chǎn)管理
- 醫(yī)院消防安全巡查記錄表范本
- l輻射安全管理制度
- 2025至2030中國(guó)寵物垃圾袋行業(yè)發(fā)展趨勢(shì)分析與未來(lái)投資戰(zhàn)略咨詢研究報(bào)告
- 健康評(píng)估(第3版)課件6-2 泌尿系統(tǒng)常見(jiàn)癥狀評(píng)估
- 水資源論證管理制度
- 麻醉中的人文關(guān)懷
- 餐廚廢棄食用油脂管理制度
- 2025年云南省時(shí)事政治考試試卷帶解析附完整答案(考點(diǎn)梳理)
- 貴州省黔東南州2024-2025學(xué)年高二下冊(cè)期末教學(xué)質(zhì)量檢測(cè)數(shù)學(xué)試卷(附答案)
- 武漢大學(xué)2020年強(qiáng)基計(jì)劃物理試題(解析版)
- 2024年海原縣社區(qū)專職工作者招聘考試真題
- 人工智能在畜牧業(yè)中的應(yīng)用研究-洞察闡釋
評(píng)論
0/150
提交評(píng)論