版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、<p><b> 外文翻譯</b></p><p><b> MVC設(shè)計(jì)模式</b></p><p> MVC是一種目前廣泛流行的軟件設(shè)計(jì)模式,早在70年代,IBM就推出了</p><p> Sanfronscisico項(xiàng)目計(jì)劃,其實(shí)就是MVC設(shè)計(jì)模式的研究。近來(lái),隨著J2EE的成熟,它正在成為在J2EE
2、平臺(tái)上推薦的一種設(shè)計(jì)模型,也是廣大Java開發(fā)者非常感興趣的設(shè)計(jì)模型。MVC模式也逐漸在PHP和ColdFusion開發(fā)者中運(yùn)用,并有增長(zhǎng)趨勢(shì)。隨著網(wǎng)絡(luò)應(yīng)用的快速增加,MVC模式對(duì)于Web應(yīng)用的開發(fā)無(wú)疑是一種非常先進(jìn)的設(shè)計(jì)思想,無(wú)論你選擇哪種語(yǔ)言,無(wú)論應(yīng)用多復(fù)雜,它都能為你理解分析應(yīng)用模型時(shí)提供最基本的分析方法,為你構(gòu)造產(chǎn)品提供清晰的設(shè)計(jì)框架,為你的軟件工程提供規(guī)范的依據(jù)。</p><p><b>
3、MVC設(shè)計(jì)思想</b></p><p> MVC英文即Model-View-Controller,即把一個(gè)應(yīng)用的輸入、處理、輸出流程按照Model、View、Controller的方式進(jìn)行分離,這樣一個(gè)應(yīng)用被分成三個(gè)層——模型層、視圖層、控制層。</p><p> 視圖(View)代表用戶交互界面,對(duì)于Web應(yīng)用來(lái)說(shuō),可以概括為HTML界面,但有可能為XHTML、XML和A
4、pplet。隨著應(yīng)用的復(fù)雜性和規(guī)模性,界面的處理也變得具有挑戰(zhàn)性。一個(gè)應(yīng)用可能有很多不同的視圖,MVC設(shè)計(jì)模式對(duì)于視圖的處理僅限于視圖上數(shù)據(jù)的采集和處理,以及用戶的請(qǐng)求,而不包括在視圖上的業(yè)務(wù)流程的處理。業(yè)務(wù)流程的處理交予模型(Model)處理。比如一個(gè)訂單的視圖只接受來(lái)自模型的數(shù)據(jù)并顯示給用戶,以及將用戶界面的輸入數(shù)據(jù)和請(qǐng)求傳遞給控制和模型。</p><p> 模型(Model):就是業(yè)務(wù)流程/狀態(tài)的處理以及
5、業(yè)務(wù)規(guī)則的制定。業(yè)務(wù)流程的處理過(guò)程對(duì)其它層來(lái)說(shuō)是黑箱操作,模型接受視圖請(qǐng)求的數(shù)據(jù),并返回最終的處理結(jié)果。業(yè)務(wù)模型的設(shè)計(jì)可以說(shuō)是MVC最主要的核心。目前流行的EJB模型就是一個(gè)典型的應(yīng)用例子,它從應(yīng)用技術(shù)實(shí)現(xiàn)的角度對(duì)模型做了進(jìn)一步的劃分,以便充分利用現(xiàn)有的組件,但它不能作為應(yīng)用設(shè)計(jì)模型的框架。它僅僅告訴你按這種模型設(shè)計(jì)就可以利用某些技術(shù)組件,從而減少了技術(shù)上的困難。對(duì)一個(gè)開發(fā)者來(lái)說(shuō),就可以專注于業(yè)務(wù)模型的設(shè)計(jì)。MVC設(shè)計(jì)模式告訴我們,把應(yīng)
6、用的模型按一定的規(guī)則抽取出來(lái),抽取的層次很重要,這也是判斷開發(fā)人員是否優(yōu)秀的設(shè)計(jì)依據(jù)。抽象與具體不能隔得太遠(yuǎn),也不能太近。MVC并沒有提供模型的設(shè)計(jì)方法,而只告訴你應(yīng)該組織管理這些模型,以便于模型的重構(gòu)和提高重用性。我們可以用對(duì)象編程來(lái)做比喻,MVC定義了一個(gè)頂級(jí)類,告訴它的子類你只能做這些,但沒法限制你能做這些。這點(diǎn)對(duì)編程的開發(fā)人員非常重要。</p><p> 業(yè)務(wù)模型還有一個(gè)很重要的模型那就是數(shù)據(jù)模型。數(shù)據(jù)
7、模型主要指實(shí)體對(duì)象的數(shù)據(jù)保存(持續(xù)化)。比如將一張訂單保存到數(shù)據(jù)庫(kù),從數(shù)據(jù)庫(kù)獲取訂單。我們可以將這個(gè)模型單獨(dú)列出,所有有關(guān)數(shù)據(jù)庫(kù)的操作只限制在該模型中。</p><p> 控制(Controller)可以理解為從用戶接收請(qǐng)求, 將模型與視圖匹配在一起,共同完成用戶的請(qǐng)求。劃分控制層的作用也很明顯,它清楚地告訴你,它就是一個(gè)分發(fā)器,選擇什么樣的模型,選擇什么樣的視圖,可以完成什么樣的用戶請(qǐng)求??刂茖硬⒉蛔鋈魏蔚臄?shù)
8、據(jù)處理。例如,用戶點(diǎn)擊一個(gè)連接,控制層接受請(qǐng)求后, 并不處理業(yè)務(wù)信息,它只把用戶的信息傳遞給模型,告訴模型做什么,選擇符合要求的視圖返回給用戶。因此,一個(gè)模型可能對(duì)應(yīng)多個(gè)視圖,一個(gè)視圖可能對(duì)應(yīng)多個(gè)模型。</p><p><b> MVC的優(yōu)點(diǎn)</b></p><p> 大部分用過(guò)程語(yǔ)言比如ASP、PHP開發(fā)出來(lái)的Web應(yīng)用,初始的開發(fā)模板就是混合層的數(shù)據(jù)編程。例如
9、,直接向數(shù)據(jù)庫(kù)發(fā)送請(qǐng)求并用HTML顯示,開發(fā)速度往往比較快,但由于數(shù)據(jù)頁(yè)面的分離不是很直接,因而很難體現(xiàn)出業(yè)務(wù)模型的樣子或者模型的重用性。產(chǎn)品設(shè)計(jì)彈性力度很小,很難滿足用戶的變化性需求。MVC要求對(duì)應(yīng)用分層,雖然要花費(fèi)額外的工作,但產(chǎn)品的結(jié)構(gòu)清晰,產(chǎn)品的應(yīng)用通過(guò)模型可以得到更好地體現(xiàn)。</p><p> 首先,最重要的是應(yīng)該有多個(gè)視圖對(duì)應(yīng)一個(gè)模型的能力。在目前用戶需求的快速變化下,可能有多種方式訪問(wèn)應(yīng)用的要求。
10、例如,訂單模型可能有本系統(tǒng)的訂單,也有網(wǎng)上訂單,或者其他系統(tǒng)的訂單,但對(duì)于訂單的處理都是一樣,也就是說(shuō)訂單的處理是一致的。按MVC設(shè)計(jì)模式,一個(gè)訂單模型以及多個(gè)視圖即可解決問(wèn)題。這樣減少了代碼的復(fù)制,即減少了代碼的維護(hù)量,一旦模型發(fā)生改變,也易于維護(hù)。</p><p><b> MVC設(shè)計(jì)模型</b></p><p> 其次,由于模型返回的數(shù)據(jù)不帶任何顯示格式,因
11、而這些模型也可直接應(yīng)用于接口的使用。</p><p> 再次,由于一個(gè)應(yīng)用被分離為三層,因此有時(shí)改變其中的一層就能滿足應(yīng)用的改變。一個(gè)應(yīng)用的業(yè)務(wù)流程或者業(yè)務(wù)規(guī)則的改變只需改動(dòng)MVC的模型層。</p><p> 控制層的概念也很有效,由于它把不同的模型和不同的視圖組合在一起完成不同的請(qǐng)求,因此,控制層可以說(shuō)是包含了用戶請(qǐng)求權(quán)限的概念。</p><p> 最后,它
12、還有利于軟件工程化管理。由于不同的層各司其職,每一層不同的應(yīng)用具有某些相同的特征,有利于通過(guò)工程化、工具化產(chǎn)生管理程序代碼。</p><p> MVC的缺點(diǎn) MVC的設(shè)計(jì)實(shí)現(xiàn)并不十分容易, 理解起來(lái)比較容易,但對(duì)開發(fā)人員的要求比較高。MVC只是一種基本的設(shè)計(jì)思想,還需要詳細(xì)的設(shè)計(jì)規(guī)劃。</p><p> 模型和視圖的嚴(yán)格分離可能使得調(diào)試?yán)щy一些,但比較容易發(fā)現(xiàn)錯(cuò)誤。</p&g
13、t;<p> 經(jīng)驗(yàn)表明,MVC由于將應(yīng)用分為三層,意味著代碼文件增多,因此,對(duì)于文件的管理需要費(fèi)點(diǎn)心思。</p><p> 綜合上述,MVC是構(gòu)筑軟件非常好的基本模式,至少將業(yè)務(wù)處理與顯示分離,強(qiáng)迫將應(yīng)用分為模型、視圖以及控制層, 使得你會(huì)認(rèn)真考慮應(yīng)用的額外復(fù)雜性,把這些想法融進(jìn)到架構(gòu)中,增加了應(yīng)用的可拓展性。如果能把握到這一點(diǎn),MVC模式會(huì)使得你的應(yīng)用更加強(qiáng)壯,更加有彈性,更加個(gè)性化。<
14、/p><p> MVC Design Pattern</p><p> MVC is a widely popular software design pattern, as early as in the 70's, IBM introduced the Sanfronscisico on the project, in fact, is the MVC design patte
15、rn 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
16、 developed in PHP and ColdFusion are in use, and growth trends. With the rapid increase in web applications, MVC model for t</p><p> MVC design idea</p><p> MVC in English or Model-View-Contro
17、ller, an application that is input, process, output process in accordance with the Model, View, Controller isolated manner, such an application is divided into three layers - model layer, view layer, control layer.</p
18、><p> 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 Applet. With the application of the complexity and scale, the
19、 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 user's request,
20、 not included in the view on the handling of business processes. The handling of </p><p> Model (Model): is the business process / status of the processing and business rules. Business process layer is the
21、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. </p><p> Cur
22、rently popular 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 use
23、d as a framework for application design model. It only tell you that according to the design of this model will be able to use certain technology components, thereby reducing the technical difficulties. Example of a deve
24、loper, you can focus on </p><p> business model design. MVC design pattern tells us that the application of the model according to certain rules of taking away the level of extraction is very important, whi
25、ch is to determine whether the development in accordance with good design. Abstract and concrete can not be separated too far, nor too close.</p><p> MVC model did not provide the design method, but only te
26、ll you that the management of these models should be organized in order to facilitate reconstruction and improve the model reusability. We can make an analogy with object programming, MVC defines a top-level category, th
27、e 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.</p><p> There is also a business model of the model is very im
28、portant that the data model. Data model mainly refers to the object data entities (continued of).</p><p> Forexample, an order will be saved to the database, to obtain orders from the database. We can separ
29、ate this model, all the operation of the database is only.</p><p> Limited to the model.</p><p> Control (Controller) can be interpreted as a request received from the user, matching the model
30、 and view together to complete the user's 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 choose, choose what kind of vie
31、w, 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 busine</p><p> The bene
32、fits of MVC</p><p> Most of the process of language use such as ASP, PHP developed Web applications, the development of the initial template is the mixed layer of the data programming. For example, send the
33、 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 r
34、eusability. Very flexible product design efforts, it is difficult to meet the changing needs o</p><p> First of all, the most important thing is that there should be a number of view corresponds to the abil
35、ity of a model. In the current rapidly changing user requirements, it may have access to a </p><p> wide range of applications. For example, orders for the model may be orders of the system as well as onlin
36、e orders, or orders 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
37、 problem. This reduced the code to copy, that is, a reduction of the maintenance code, once the model changes, but also easy to maintain.</p><p> MVC Design Model</p><p> Secondly, the data re
38、turned as a result of the model without any display format, so these models can also be directly applied to the use of interfaces.</p><p> Third, as a result of an application to be separated into three, it
39、 is sometimes one of them will be able to change to meet changes in the application.</p><p> An application of business processes or business rules change simply changes the model layer MVC.</p><
40、p> The concept of control layer is also very effective, because of its different models and different views together to complete various requests, the control layer can be said to be included in the concept of a user
41、 request for permission.</p><p> Finally, it is also beneficial to the management of software engineering. Because each different layer, each layer of different applications have some similar characteristic
42、s, is conducive to the adoption of engineering and management tools of program code generated.</p><p> The shortcomings of MVC</p><p> Design and implementation of MVC is not very easy, easier
43、 to understand, but for developers the requirements are relatively high. MVC is just a basic designidea, but also the need for careful design and planning.</p><p> Model and the strict separation of view ma
44、y make debugging more difficult, but easier to find errors.</p><p> Experience has shown that, MVC as a result of the application is divided into three, means that the number of code files, so the need for
45、document management.</p><p> Costs point thought.</p><p> Above, MVC is a very good software to build a basic model, at least the separation of processing and display, forcing the application
46、is divided into model, view and control layer, making you seriously consider the additional complexity of the application of these ideas into the structure, an increase of application scalability. If we can grasp this, M
溫馨提示
- 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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫(kù)僅提供信息存儲(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- mvc設(shè)計(jì)模式畢業(yè)論文外文翻譯
- mvc外文翻譯
- struts-mvc外文翻譯
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文翻譯--spring的web mvc 構(gòu)架模式
- 計(jì)算機(jī)外文翻譯---spring的web_mvc_構(gòu)架模式
- [雙語(yǔ)翻譯]---外文翻譯--集成ssh組合框架實(shí)現(xiàn)mvc模式的應(yīng)用研究
- 集成ssh組合框架實(shí)現(xiàn)mvc模式的應(yīng)用研究-外文翻譯
- 外文翻譯 - 基于mvc模式的圖書館信息管理系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)
- mvc設(shè)計(jì)模式【中文4230字】
- mvc設(shè)計(jì)模式【中文4230字】
- 2011年---外文翻譯--集成ssh組合框架實(shí)現(xiàn)mvc模式的應(yīng)用研究
- 2011年---外文翻譯--集成ssh組合框架實(shí)現(xiàn)mvc模式的應(yīng)用研究
- 2011年---外文翻譯--集成ssh組合框架實(shí)現(xiàn)mvc模式的應(yīng)用研究 (譯文)
- 2011年---外文翻譯--集成ssh組合框架實(shí)現(xiàn)mvc模式的應(yīng)用研究 (原文)
- [雙語(yǔ)翻譯]數(shù)據(jù)庫(kù)管理外文翻譯--基于mvc模式面向數(shù)據(jù)庫(kù)管理的php框架
- 2011年---外文翻譯--集成SSH組合框架實(shí)現(xiàn)MVC模式的應(yīng)用研究 (原文).pdf
- 2011年---外文翻譯--集成SSH組合框架實(shí)現(xiàn)MVC模式的應(yīng)用研究 (譯文).doc
- 2011年---外文翻譯--集成SSH組合框架實(shí)現(xiàn)MVC模式的應(yīng)用研究 (譯文).doc
- 《外文翻譯:學(xué)用javascript設(shè)計(jì)模式》
- 2011年---外文翻譯--集成SSH組合框架實(shí)現(xiàn)MVC模式的應(yīng)用研究 (原文).pdf
評(píng)論
0/150
提交評(píng)論