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

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、<p>  Java and the Internet</p><p>  If Java is, in fact, yet another computer programming language, you may question why it is so important and why it is being promoted as a revolutionary step in compu

2、ter programming. The answer isn’t immediately obvious if you’re coming from a traditional programming perspective. Although Java is very useful for solving traditional standalone programming problems, it is also importan

3、t because it will solve programming problems on the World Wide Web.</p><p>  What is the Web?</p><p>  The Web can seem a bit of a mystery at first, with all this talk of “surfing,” “presence,”

4、and “home pages.” It’s helpful to step back and see what it really is, but to do this you must understand client/server systems, another aspect of computing that’s full of confusing issues.</p><p>  Client/S

5、erver computing</p><p>  The primary idea of a client/server system is that you have a central repository of information—some kind of data, often in a database—that you want to distribute on demand to some s

6、et of people or machines. A key to the client/server concept is that the repository of information is centrally located so that it can be changed and so that those changes will propagate out to the information consumers.

7、 Taken together, the information repository, the software that distributes the information and the</p><p>  The basic concept of client/server computing, then, is not so complicated. The problems arise becau

8、se you have a single server trying to serve many clients at once. Generally, a database management system is involved, so the designer “balances” the layout of data into tables for optimal use. In addition, systems often

9、 allow a client to insert new information into a server. This means you must ensure that one client’s new data doesn’t walk over another client’s new data, or that data isn’t lost i</p><p>  The simple idea

10、of distributing information has so many layers of complexity that the whole problem can seem hopelessly enigmatic. And yet it’s crucial: Client/server computing accounts for roughly half of all programming activities. It

11、’s responsible for everything from taking orders and credit-card transactions to the distribution of any kind of data—stock market, scientific, government, you name it. What we’ve come up with in the past is individual s

12、olutions to individual problems, inventing a</p><p>  The Web as a giant server</p><p>  The Web is actually one giant client/server system. It’s a bit worse than that, since you have all the se

13、rvers and clients coexisting on a single network at once. You don’t need to know that, because all you care about is connecting to and interacting with one server at a time (even though you might be hopping around the wo

14、rld in your search for the correct server).</p><p>  Initially it was a simple one-way process. You made a request of a server and it handed you a file, which your machine’s browser software (i.e., the clien

15、t) would interpret by formatting onto your local machine. But in short order people began wanting to do more than just deliver pages from a server. They wanted full client/server capability so that the client could feed

16、information back to the server, for example, to do database lookups on the server, to add new information to the server, or to</p><p>  The Web browser was a big step forward: the concept that one piece of i

17、nformation could be displayed on any type of computer without change. However, browsers were still rather primitive and rapidly bogged down by the demands placed on them. They weren’t particularly interactive, and tended

18、 to clog up both the server and the Internet because any time you needed to do something that required programming you had to send information back to the server to be processed. It could take many seconds or </p>

19、<p>  To solve this problem, different approaches have been taken. To begin with, graphics standards have been enhanced to allow better animation and video within browsers. The remainder of the problem can be solve

20、d only by incorporating the ability to run programs on the client end, under the browser. This is called client-side programming.</p><p>  Client-side programming</p><p>  The Web’s initial serv

21、er-browser design provided for interactive content, but the interactivity was completely provided by the server. The server produced static pages for the client browser, which would simply interpret and display them. Bas

22、ic HyperText Markup Language (HTML) contains simple mechanisms for data gathering: text-entry boxes, check boxes, radio boxes, lists and drop-down lists, as well as a button that can only be programmed to reset the data

23、on the form or “submit” the data on th</p><p>  Many powerful Web sites today are built strictly on CGI, and you can in fact do nearly anything with CGI. However, Web sites built on CGI programs can rapidly

24、become overly complicated to maintain, and there is also the problem of response time. The response of a CGI program depends on how much data must be sent, as well as the load on both the server and the Internet. (On top

25、 of this, starting a CGI program tends to be slow.) The initial designers of the Web did not foresee how rapidly this ban</p><p>  The solution is client-side programming. Most machines that run Web browsers

26、 are powerful engines capable of doing vast work, and with the original static HTML approach they are sitting there, just idly waiting for the server to dish up the next page. Client-side programming means that the Web b

27、rowser is harnessed to do whatever work it can, and the result for the user is a much speedier and more interactive experience at your Web site.</p><p>  The problem with discussions of client-side programmi

28、ng is that they aren’t very different from discussions of programming in general. The parameters are almost the same, but the platform is different; a Web browser is like a limited operating system. In the end, you must

29、still program, and this accounts for the dizzying array of problems and solutions produced by client-side programming. The rest of this section provides an overview of the issues and approaches in client-side programming

30、.</p><p><b>  Plug-ins</b></p><p>  One of the most significant steps forward in client-side programming is the development of the plug-in. This is a way for a programmer to add new

31、functionality to the browser by downloading a piece of code that plugs itself into the appropriate spot in the browser. It tells the browser “from now on you can perform this new activity.” (You need to download the plug

32、-in only once.) Some fast and powerful behavior is added to browsers via plug-ins, but writing a plug-in is not a trivial task, and is</p><p>  Scripting languages</p><p>  Plug-ins resulted in

33、an explosion of scripting languages. With a scripting language, you embed the source code for your client-side program directly into the HTML page, and the plug-in that interprets that language is automatically activated

34、 while the HTML page is being displayed. Scripting languages tend to be reasonably easy to understand and, because they are simply text that is part of an HTML page, they load very quickly as part of the single server hi

35、t required to procure that page. The tr</p><p>  This points out that the scripting languages used inside Web browsers are really intended to solve specific types of problems, primarily the creation of riche

36、r and more interactive graphical user interfaces (GUIs). However, a scripting language might solve 80 percent of the problems encountered in client-side programming. Your problems might very well fit completely within th

37、at 80 percent, and since scripting languages can allow easier and faster development, you should probably consider a scrip</p><p>  The most commonly discussed browser scripting languages are JavaScript (whi

38、ch has nothing to do with Java; it’s named that way just to grab some of Java’s marketing momentum), VBScript (which looks like Visual BASIC), and Tcl/Tk, which comes from the popular cross-platform GUI-building language

39、. There are others out there, and no doubt more in development.</p><p>  JavaScript is probably the most commonly supported. It comes built into both Netscape Navigator and the Microsoft Internet Explorer (I

40、E). Unfortunately, the flavor of JavaScript on the two browsers can vary widely (the Mozilla browser, freely downloadable from www.Mozilla.org, supports the ECMAScript standard, which may one day become universally suppo

41、rted). In addition, there are probably more JavaScript books available than there are for the other browser languages, and some tools automaticall</p><p>  原文來源:(美)Bruce Ecket. Thinking in JAVA第三版. 2003</

42、p><p>  Java 和Internet</p><p>  可能你會問,如果Java只是一種新的計算機編程語言的話(實際上這話也沒錯),它為什么會那么重要,為什么會被除數(shù)拔高到“計算機編程領域的革命性的進步”,這個高度。如果你是從傳統(tǒng)編程的立場上來看這個問題,也許答案還不是那么有說服力。盡管在解決傳統(tǒng)的,孤立的編程問題方面,Java也是很能干的,但是真正讓它脫穎而出的,是因為它能解決在萬

43、維網上編程的問題。</p><p><b>  Web就什么?</b></p><p>  剛開始的時候,Web看上去很神秘,大家都江堰市在談沖浪、在線、主頁什么的。要把講Web講清楚,最好是退回來從頭開始。但是這么做,先得理解客戶/服務器系統(tǒng)。這是計算機技術的另一個領域,里面也有大把讓人頭暈的問題。</p><p><b>  客戶

44、/服務器系統(tǒng)</b></p><p>  客戶機/服務器系統(tǒng)的主要思想是,你有一個中央信息庫———通常是保存在數(shù)據庫中的一些信息———要根據需要,把它們分配給某些人或機器??蛻魴C/服務器系統(tǒng)的關鍵在于,信息庫會集中管理信息,因此信息的修改能夠傳播到用戶那里。信息庫,分發(fā)信息的軟件,以及存儲信息的軟件的機器合起來稱為服務器。存儲在遠程機器上的軟件會同這個服務器通訊,提取信息,處理信息,并且在過程機器上顯

45、示結果。這被除數(shù)稱為客戶。</p><p>  這么看來,客戶/服務器計算機的基本概念沒那么復雜。但是,當你試圖用孤零零的一個服務器來為很多客戶服務的時候,問題就來了。這個架構通常都會牽扯到數(shù)據庫管理系統(tǒng),所以為了優(yōu)化應用,設計人員會去“平衡”數(shù)據的格式。此外,通常系統(tǒng)還允許客戶往服務器里插入新的數(shù)據。這就意味著你必須保證一個客戶的新數(shù)據不會和另一個客戶的新數(shù)據攪在一起,以及數(shù)據不會在添加的過程中遺失(這被稱為事

46、務處理)。當客戶端的程序修改之后,還必須重新編譯,調試并且安裝到客戶機上,這要比你想像的復雜昂貴得多。而且如果要支持多種機器或操作系統(tǒng)的話,事情會更麻煩。最后還有一個最重要的性能問題:服務器可能會同時響應成百上千個客戶,所以再小的耽擱都是很要命的。為了把延時降到最低,程序員們盡量減輕服務的負載,通常會把這些處理任務挪到客戶端,不過有時也會移到所謂的中間件的服務器上。(中間件也被用來增進系統(tǒng)的可維護性。)</p><p

47、>  分發(fā)數(shù)據這個簡單的思想竟然會引出這么些復雜層次,而所有這些問題看起來都像是根本不可能解開的謎。但還有更重要的:大約有一半的開發(fā)項目都是基于客戶/服務器架構的。它們包括像接收訂單,信用卡交易額以及分發(fā)各種各樣的數(shù)據———股票市場的,科研的,政府部門的,只要你能叫的上名字的。以前我們的作法是為每個問題設計不同的解決方案,每次都發(fā)明一種新方法。這種項目開發(fā)起來難,用戶用起來也不方便,它們必須適應新的界面??蛻?服務器架構這個問題必

48、須要能在總體上解決。</p><p>  把Web當作巨型的服務器</p><p>  Web實際上就是一個巨型的客戶/服務器系統(tǒng)。實際上還差一點,因為所有的服務器和客戶機是共存在同一個網絡上的。不過這點你并不知道,因為你只關心是不是能連到那臺服務器,并且對它進行操作(盡管你可能得先在什么地方找到那臺服務器)。</p><p>  最初這只是個關向過程。你向服務器提

49、請求,它交給你一個文件,然后你用本地機上的瀏覽器(也就是客戶)來解釋這個文件并且為它重新排版。但沒過多久,人們就不滿足于僅僅從服務器收發(fā)文件了。他們需要完整的客戶/服務器功能,所以客戶也能向服務器發(fā)送信息了,比如查詢服務器端的數(shù)據庫,向服務器添加新的信息,或者下單(這項任務所要求的安全性比系統(tǒng)原先能提供的要高得多)。這些就是我們在Web的發(fā)展歷程中親眼目睹的變化。</p><p>  Web瀏覽器是一項巨大的進步

50、:它的思想是要讓同樣的信息以通常的形式顯示在所有的機器上。然而瀏覽器還是太原始了一些,而且也很快被加在它身上的任務給拖垮了。它的互動性不好,而且所有需要編程解決的任務都要交到服務器上去處理,所以經常會把服務器和Internet給堵了。有時可能會花幾秒鐘,甚至是幾分鐘,才會發(fā)現(xiàn)提交的請求里面有一個拼寫錯誤。由于瀏覽器只是用來顯示,不能承擔哪怕是最簡單的計算任務。(另一方面這樣也很安全,因為它不會在你的本地機上執(zhí)行可能包含bug或病毒程序。

51、)</p><p>  為了解決這個問題,人們用了很多辦法。開始是升級圖形超標準,讓瀏覽器能顯示效果更佳的動畫和視頻。但是有些問題,只能通過讓客戶端的瀏覽器運行程序來解決了。這被稱為客戶端編程。</p><p><b>  客戶端編程</b></p><p>  Web最初的服務器——瀏覽器設計提供了互動內容,但是這種互動性是完全建立在服務器之

52、上的。服務器為客戶端提供靜態(tài)頁面,而瀏覽器只是簡單的解釋頁面,然后顯示出來。HTML包括了基本的數(shù)據采集功能:輸入框,復選框,單選按鈕,列表,下拉式列表,以及只能用于清除表單或是把表單數(shù)據“提交”給服務器的按扭。提交上來的數(shù)據會交給Web服務器上的通用網關接口程序。這些文本會告訴CGI該做些什么。最常見的就是在服務器上運行一個程序,這個程序一般會放在“cgi-bin”目錄中。(如果按完Web頁面上的按扭之后,你仔細觀察瀏覽器頂部的地址條

53、的話,有時你就會在那些不知所云的東西中看到“cgi-bin”。)大多數(shù)語言都可以寫這些程序。Perl是最常用的,因為它設計的目的就是為了處理和解釋文本,所以不論服務器用的是那種處理器,或是那種操作系統(tǒng),都能安裝Perl。但Python(我的最愛———見www.Pythoin.org)由于其功能強大簡單易用,已經對Perl的霸主地位發(fā)起了挑戰(zhàn)。</p><p>  很多大型網站都是完全建立在CGI之上的,而且實際上

54、你能用CGI來做幾乎任何事情。但是建立在CGI之上的網站會很快變得過于復雜而難以維護,此處還有一個相應時間的問題。CGI程序的相應時間取決于它要發(fā)送多少數(shù)據,以及服務器端各Internet的負載。(而且CGI程序本身就啟動很慢。)最初設計Web的人沒能預料到帶寬會消耗在這類應用程序中。舉例來說,動態(tài)圖形實際上是不可能一致地運行的,所以服務器會把所有版本的GIF文件都傳到客戶端。而且,毫無疑問你肯定做過像填寫表格這種簡單的事。當你按了發(fā)送

55、按鈕之后,數(shù)據會被送回到服務器,然后服務器啟動CGI程序,但是發(fā)現(xiàn)有個錯誤,于是重新生成一個HTML告訴你出來錯,再把這個頁面?zhèn)鹘o你;然后你再重頭來一遍。這樣做不但慢,而且蠢。</p><p>  解決方案就是客戶端編程。絕大多數(shù)運行Web瀏覽器的機器都有強大的引擎,能作很多工作,而且在原告靜態(tài)的HTML方法下,大多數(shù)時間,它們都是在傻等著服務器發(fā)送下一個頁面??蛻舳司幊桃馕吨鳺eb瀏覽器能物盡其用,結果是用戶能

56、更快同時也更互動地體驗你的網站。</p><p>  客戶端編程所遇到的問題同通用編程的沒有什么本質性的區(qū)別。參數(shù)幾乎是相同的,只是平臺有寫差異;瀏覽器就是一個小型的操作系統(tǒng)。最后,你還得寫程序,還要解決一串讓人眼花繚亂的問題,還是提供客戶端編程的解決方案。本節(jié)的余下部分會簡要介紹客戶端編程的問題與方法。</p><p><b>  插件</b></p>

57、<p>  在客戶端編程方面最重要的步驟之一就是開發(fā)插件。這是程序員就為瀏覽器提供新功能的辦法。它要求用戶從網上下載插件程序,然后把它集成到瀏覽器里。插件告訴瀏覽器“從今往后,你可以進行這些新的工作了?!保ú寮恍柘螺d一次。)插件為瀏覽器添加了一些快速強大的功能,但是寫一個插件可不是什么輕松的任務,也不應該是建網站應該作的事。插件對于客戶端編程的價值在于,它能讓專家級的程序員開發(fā)一種新的語言,并且不經開發(fā)商的同意,就把這種語

58、言加進瀏覽器里。于是插件提供了一個能創(chuàng)建新的客戶端編程語言的“后門”(盡管不是所有的語言都是通過插件來實現(xiàn)的)。</p><p><b>  腳本語言</b></p><p>  插件導致了腳本語言的泛濫。你可以用腳本語言把客戶端程序的源代碼直接嵌進HTML頁面里去,HTML頁面顯示的時候,會自動激活這個插件去解釋這些程序的。腳本語言應該比較簡單,而且作為HTML頁面

59、的一個部分,它們都是簡單的文本,所以會隨頁面一起獲取,而且裝載也很快。不過代價就是代碼只能給別人看了(或者說偷了)。總之,由于你沒法用腳本語言做非常復雜的東西,所以它的難度不會太大。</p><p>  這一點決定了Web瀏覽器所用的腳本語言實際上是用來解決某些具體的問題的,主要是創(chuàng)建更豐富的,更互動的用戶界面的(GUI)。然而,腳本語言也許能解決百分之十的客戶端編程的問題??赡苣阋鉀Q的問題正好落進這百分之八十

60、的范圍,而且由于腳本語言開發(fā)起來更簡單也更快,所以你應該在選用Java或ActiveX這類難度更大的方案之前,先考慮一下腳本語言。</p><p>  最常被提及的瀏覽器用的腳本語言有JavaScript(跟Java沒什么關系;它取這個名字只是想搭Java的順風車),VBScript(看上去像Visual BASIC),以及Tcl/Tk,這是一種很流行的跨平臺的創(chuàng)建GUI的語言。此外還有一些,但是正在開發(fā)肯定還要

61、多。</p><p>  JavaScript可能是人氣最旺的。Netscape Navigator同Microsoft Internet(IE)都內置了這個語言。然而不幸的是這兩個瀏覽器所支持的JavaScript在風格上有很大的不同(Mozilla支持的ECMAScript或許有一天能成為普遍支持的標準??梢缘絯ww.Mozilla.org去下載這個瀏覽器)。此外講JavaScript的書可能要比其它語言的都

溫馨提示

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

評論

0/150

提交評論