2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩6頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、<p><b>  外文翻譯</b></p><p><b>  MVC設(shè)計模式</b></p><p>  MVC是一種目前廣泛流行的軟件設(shè)計模式,早在70年代,IBM就推出了</p><p>  Sanfronscisico項目計劃,其實就是MVC設(shè)計模式的研究。近來,隨著J2EE的成熟,它正在成為在J2EE

2、平臺上推薦的一種設(shè)計模型,也是廣大Java開發(fā)者非常感興趣的設(shè)計模型。MVC模式也逐漸在PHP和ColdFusion開發(fā)者中運用,并有增長趨勢。隨著網(wǎng)絡(luò)應(yīng)用的快速增加,MVC模式對于Web應(yīng)用的開發(fā)無疑是一種非常先進的設(shè)計思想,無論你選擇哪種語言,無論應(yīng)用多復(fù)雜,它都能為你理解分析應(yīng)用模型時提供最基本的分析方法,為你構(gòu)造產(chǎn)品提供清晰的設(shè)計框架,為你的軟件工程提供規(guī)范的依據(jù)。</p><p><b>  

3、MVC設(shè)計思想</b></p><p>  MVC英文即Model-View-Controller,即把一個應(yīng)用的輸入、處理、輸出流程按照Model、View、Controller的方式進行分離,這樣一個應(yīng)用被分成三個層——模型層、視圖層、控制層。</p><p>  視圖(View)代表用戶交互界面,對于Web應(yīng)用來說,可以概括為HTML界面,但有可能為XHTML、XML和A

4、pplet。隨著應(yīng)用的復(fù)雜性和規(guī)模性,界面的處理也變得具有挑戰(zhàn)性。一個應(yīng)用可能有很多不同的視圖,MVC設(shè)計模式對于視圖的處理僅限于視圖上數(shù)據(jù)的采集和處理,以及用戶的請求,而不包括在視圖上的業(yè)務(wù)流程的處理。業(yè)務(wù)流程的處理交予模型(Model)處理。比如一個訂單的視圖只接受來自模型的數(shù)據(jù)并顯示給用戶,以及將用戶界面的輸入數(shù)據(jù)和請求傳遞給控制和模型。</p><p>  模型(Model):就是業(yè)務(wù)流程/狀態(tài)的處理以及

5、業(yè)務(wù)規(guī)則的制定。業(yè)務(wù)流程的處理過程對其它層來說是黑箱操作,模型接受視圖請求的數(shù)據(jù),并返回最終的處理結(jié)果。業(yè)務(wù)模型的設(shè)計可以說是MVC最主要的核心。目前流行的EJB模型就是一個典型的應(yīng)用例子,它從應(yīng)用技術(shù)實現(xiàn)的角度對模型做了進一步的劃分,以便充分利用現(xiàn)有的組件,但它不能作為應(yīng)用設(shè)計模型的框架。它僅僅告訴你按這種模型設(shè)計就可以利用某些技術(shù)組件,從而減少了技術(shù)上的困難。對一個開發(fā)者來說,就可以專注于業(yè)務(wù)模型的設(shè)計。MVC設(shè)計模式告訴我們,把應(yīng)

6、用的模型按一定的規(guī)則抽取出來,抽取的層次很重要,這也是判斷開發(fā)人員是否優(yōu)秀的設(shè)計依據(jù)。抽象與具體不能隔得太遠,也不能太近。MVC并沒有提供模型的設(shè)計方法,而只告訴你應(yīng)該組織管理這些模型,以便于模型的重構(gòu)和提高重用性。我們可以用對象編程來做比喻,MVC定義了一個頂級類,告訴它的子類你只能做這些,但沒法限制你能做這些。這點對編程的開發(fā)人員非常重要。</p><p>  業(yè)務(wù)模型還有一個很重要的模型那就是數(shù)據(jù)模型。數(shù)據(jù)

7、模型主要指實體對象的數(shù)據(jù)保存(持續(xù)化)。比如將一張訂單保存到數(shù)據(jù)庫,從數(shù)據(jù)庫獲取訂單。我們可以將這個模型單獨列出,所有有關(guān)數(shù)據(jù)庫的操作只限制在該模型中。</p><p>  控制(Controller)可以理解為從用戶接收請求, 將模型與視圖匹配在一起,共同完成用戶的請求。劃分控制層的作用也很明顯,它清楚地告訴你,它就是一個分發(fā)器,選擇什么樣的模型,選擇什么樣的視圖,可以完成什么樣的用戶請求。控制層并不做任何的數(shù)

8、據(jù)處理。例如,用戶點擊一個連接,控制層接受請求后, 并不處理業(yè)務(wù)信息,它只把用戶的信息傳遞給模型,告訴模型做什么,選擇符合要求的視圖返回給用戶。因此,一個模型可能對應(yīng)多個視圖,一個視圖可能對應(yīng)多個模型。</p><p><b>  MVC的優(yōu)點</b></p><p>  大部分用過程語言比如ASP、PHP開發(fā)出來的Web應(yīng)用,初始的開發(fā)模板就是混合層的數(shù)據(jù)編程。例如

9、,直接向數(shù)據(jù)庫發(fā)送請求并用HTML顯示,開發(fā)速度往往比較快,但由于數(shù)據(jù)頁面的分離不是很直接,因而很難體現(xiàn)出業(yè)務(wù)模型的樣子或者模型的重用性。產(chǎn)品設(shè)計彈性力度很小,很難滿足用戶的變化性需求。MVC要求對應(yīng)用分層,雖然要花費額外的工作,但產(chǎn)品的結(jié)構(gòu)清晰,產(chǎn)品的應(yīng)用通過模型可以得到更好地體現(xiàn)。</p><p>  首先,最重要的是應(yīng)該有多個視圖對應(yīng)一個模型的能力。在目前用戶需求的快速變化下,可能有多種方式訪問應(yīng)用的要求。

10、例如,訂單模型可能有本系統(tǒng)的訂單,也有網(wǎng)上訂單,或者其他系統(tǒng)的訂單,但對于訂單的處理都是一樣,也就是說訂單的處理是一致的。按MVC設(shè)計模式,一個訂單模型以及多個視圖即可解決問題。這樣減少了代碼的復(fù)制,即減少了代碼的維護量,一旦模型發(fā)生改變,也易于維護。</p><p><b>  MVC設(shè)計模型</b></p><p>  其次,由于模型返回的數(shù)據(jù)不帶任何顯示格式,因

11、而這些模型也可直接應(yīng)用于接口的使用。</p><p>  再次,由于一個應(yīng)用被分離為三層,因此有時改變其中的一層就能滿足應(yīng)用的改變。一個應(yīng)用的業(yè)務(wù)流程或者業(yè)務(wù)規(guī)則的改變只需改動MVC的模型層。</p><p>  控制層的概念也很有效,由于它把不同的模型和不同的視圖組合在一起完成不同的請求,因此,控制層可以說是包含了用戶請求權(quán)限的概念。</p><p>  最后,它

12、還有利于軟件工程化管理。由于不同的層各司其職,每一層不同的應(yīng)用具有某些相同的特征,有利于通過工程化、工具化產(chǎn)生管理程序代碼。</p><p>  MVC的缺點  MVC的設(shè)計實現(xiàn)并不十分容易, 理解起來比較容易,但對開發(fā)人員的要求比較高。MVC只是一種基本的設(shè)計思想,還需要詳細的設(shè)計規(guī)劃。</p><p>  模型和視圖的嚴格分離可能使得調(diào)試困難一些,但比較容易發(fā)現(xiàn)錯誤。</p&g

13、t;<p>  經(jīng)驗表明,MVC由于將應(yīng)用分為三層,意味著代碼文件增多,因此,對于文件的管理需要費點心思。</p><p>  綜合上述,MVC是構(gòu)筑軟件非常好的基本模式,至少將業(yè)務(wù)處理與顯示分離,強迫將應(yīng)用分為模型、視圖以及控制層, 使得你會認真考慮應(yīng)用的額外復(fù)雜性,把這些想法融進到架構(gòu)中,增加了應(yīng)用的可拓展性。如果能把握到這一點,MVC模式會使得你的應(yīng)用更加強壯,更加有彈性,更加個性化。<

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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論