版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、<p><b> 外文翻譯</b></p><p> 學(xué) 院: 計算機與信息工程學(xué)院 </p><p> 專 業(yè)、 班 級: 信息管理與信息系統(tǒng) </p><p> 學(xué) 號:
2、</p><p> 姓 名 : </p><p> Java and the Internet</p><p> If Java is, in fact, yet another computer programming language, you may question why it
3、 is so important and why it is being promoted as a revolutionary step in computer programming. The answer isn’t immediately obvious if you’re coming from a traditional programming perspective. Although Java is very usefu
4、l for solving traditional stand-alone programming problems, it is also important because it will solve programming problems on the World Wide Web.</p><p> Client-side programming</p><p> The W
5、eb’s initial server-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
6、display them. Basic 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 on the form
7、 or “submit” the data on the form back to the server. T</p><p> Many powerful Web sites today are built strictly on CGI, and you can in fact do nearly anything with it. However, Web sites built on CGI progr
8、ams can rapidly 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 I
9、nternet. (On top of this, starting a CGI program tends to be slow.) The initial designers of the Web did not foresee how rapidly this band</p><p> The solution is client-side programming. Most machines that
10、 run Web browsers 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 mea
11、ns that the Web browser 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 clie
12、nt-side programming 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 t
13、he end, you must 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
14、-side programming.</p><p> 2.Plug-ins</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
15、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
16、-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> 3.Scripting languages</p><p> Plug-ins resulted i
17、n 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 activate
18、d 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 h
19、it required to procure that page. The tra</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 ric
20、her 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
21、that 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 (w
22、hich 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 langua
23、ge. 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
24、(IE). In addition, there are probably more JavaScript books available than there are for the other browser languages, and some tools automatically create pages using JavaScript. However, if you’re already fluent in Visua
25、l Basic or Tcl/Tk, you’ll be more productive using those scripting languages rather than learning a new one. (You’ll have your hands full dealing wi</p><p><b> 4.Java</b></p><p> I
26、f a scripting language can solve 80 percent of the client-side programming problems, what about the other 20 percent—the “really hard stuff?” The most popular solution today is Java. Not only is it a powerful programming
27、 language built to be secure, cross-platform, and international, but Java is being continually extended to provide language features and libraries that elegantly handle problems that are difficult in traditional programm
28、ing languages, such as multithreading, database access, net</p><p> An applet is a mini-program that will run only under a Web browser. The applet is downloaded automatically as part of a Web page (just as,
29、 for example, a graphic is automatically downloaded). When the applet is activated it executes a program. This is part of its beauty—it provides you with a way to automatically distribute the client software from the ser
30、ver at the time the user needs the client software, and no sooner. The user gets the latest version of the client software without fail and wi</p><p> One advantage a Java applet has over a scripted program
31、 is that it’s in compiled form, so the source code isn’t available to the client. On the other hand, a Java applet can be decompiled without too much trouble, but hiding your code is often not an important issue. Two oth
32、er factors can be important. As you will see later in this book, a compiled Java applet can comprise many modules and take multiple server “hits” (accesses) to download. (In Java 1.1 and higher this is minimized by Java
33、archi</p><p><b> 5.ActiveX</b></p><p> To some degree, the competitor to Java is Microsoft’s ActiveX, although it takes a completely different approach. ActiveX was originally a Wi
34、ndows-only solution, although it is now being developed via an independent consortium to become cross-platform. Effectively, ActiveX says “if your program connects to its environment just so, it can be dropped into a Web
35、 page and run under a browser that supports ActiveX.” (IE directly supports ActiveX and Netscape does so using a plug-in.) Thus, ActiveX do</p><p> 6.Internet vs. intranet</p><p> The Web is t
36、he most general solution to the client/server problem, so it makes sense that you can use the same technology to solve a subset of the problem, in particular the classic client/server problem within a company. With tradi
37、tional client/server approaches you have the problem of multiple types of client computers, as well as the difficulty of installing new client software, both of which are handily solved with Web browsers and client-side
38、programming. When Web technology is used for an </p><p> The security problem brings us to one of the divisions that seems to be automatically forming in the world of client-side programming. If your progra
39、m is running on the Internet, you don’t know what platform it will be working under, and you want to be extra careful that you don’t disseminate buggy code. You need something cross-platform and secure, like a scripting
40、language or Java. </p><p> If you’re running on an intranet, you might have a different set of constraints. It’s not uncommon that your machines could all be Intel/Windows platforms. On an intranet, you’re
41、responsible for the quality of your own code and can repair bugs when they’re discovered. In addition, you might already have a body of legacy code that you’ve been using in a more traditional client/server approach, whe
42、reby you must physically install client programs every time you do an upgrade. The time wasted in ins</p><p> When faced with this bewildering array of solutions to the client-side programming problem, the
43、best plan of attack is a cost-benefit analysis. Consider the constraints of your problem and what would be the shortest path to your solution. Since client-side programming is still programming, it’s always a good idea t
44、o take the fastest development approach for your particular situation. This is an aggressive stance to prepare for inevitable encounters with the problems of program development.</p><p> 7.Server-side progr
45、amming</p><p> This whole discussion has ignored the issue of server-side programming. What happens when you make a request of a server? Most of the time the request is simply “send me this file.” Your brow
46、ser then interprets the file in some appropriate fashion: as an HTML page, a graphic image, a Java applet, a script program, etc. A more complicated request to a server generally involves a database transaction. A common
47、 scenario involves a request for a complex database search, which the server then formats</p><p><b> Java和因特網(wǎng)</b></p><p> 既然Java不過另一種類型的程序設(shè)計語言,大家可能會奇怪它為什么值得如此重視,為什么還有這么多的人認為它是計算機程序
48、設(shè)計的一個里程碑呢?如果您來自一個傳統(tǒng)的程序設(shè)計背景,那么答案在剛開始的時候并不是很明顯。Java除了可解決傳統(tǒng)的程序設(shè)計問題以外,還能解決World Wide Web(萬維網(wǎng))上的編程問題。</p><p><b> 1.客戶端編程</b></p><p> Web最初采用的“服務(wù)器-瀏覽器”方案可提供交互式內(nèi)容,但這種交互能力完全由服務(wù)器提供,為服務(wù)器和因特網(wǎng)
49、帶來了不小的負擔(dān)。服務(wù)器一般為客戶瀏覽器產(chǎn)生靜態(tài)網(wǎng)頁,由后者簡單地解釋并顯示出來?;綡TML語言提供了簡單的數(shù)據(jù)收集機制:文字輸入框、復(fù)選框、單選鈕、列表以及下拉列表等,另外還有一個按鈕,只能由程序規(guī)定重新設(shè)置表單中的數(shù)據(jù),以便回傳給服務(wù)器。用戶提交的信息通過所有Web服務(wù)器均能支持的“通用網(wǎng)關(guān)接口”(CGI)回傳到服務(wù)器。包含在提交數(shù)據(jù)中的文字指示CGI該如何操作。最常見的行動是運行位于服務(wù)器的一個程序。那個程序一般保存在一個名為“
50、cgi-bin”的目錄中(按下Web頁內(nèi)的一個按鈕時,請注意一下瀏覽器頂部的地址窗,經(jīng)常都能發(fā)現(xiàn)“cgi-bin”的字樣)。大多數(shù)語言都可用來編制這些程序,但其中最常見的是Perl。這是由于Perl是專為文字的處理及解釋而設(shè)計的,所以能在任何服務(wù)器上安裝和使用,無論采用的處理器或操作系統(tǒng)是什么。</p><p><b> 2. 插件</b></p><p> 朝客
51、戶端編程邁進的時候,最重要的一個問題就是插件的設(shè)計。利用插件,程序員可以方便地為瀏覽器添加新功能,用戶只需下載一些代碼,把它們“插入”瀏覽器的適當位置即可。這些代碼的作用是告訴瀏覽器“從現(xiàn)在開始,你可以進行這些新活動了”(僅需下載這些插入一次)。有些快速和功能強大的行為是通過插件添加到瀏覽器的。但插件的編寫并不是一件簡單的任務(wù)。在我們構(gòu)建一個特定的站點時,可能并不希望涉及這方面的工作。對客戶端程序設(shè)計來說,插件的價值在于它允許專業(yè)程序員
52、設(shè)計出一種新的語言,并將那種語言添加到瀏覽器,同時不必經(jīng)過瀏覽器原創(chuàng)者的許可。由此可以看出,插件實際是瀏覽器的一個“后門”,允許創(chuàng)建新的客戶端程序設(shè)計語言(盡管并非所有語言都是作為插件實現(xiàn)的)。</p><p><b> 3. 腳本編制語言</b></p><p> 插件造成了腳本編制語言的爆炸性增長。通過這種腳本語言,可將用于自己客戶端程序的源碼直接插入HTML
53、頁,而對那種語言進行解釋的插件會在HTML頁顯示的時候自動激活。腳本語言一般都傾向于盡量簡化,易于理解。而且由于它們是從屬于HTML頁的一些簡單正文,所以只需向服務(wù)器發(fā)出對那個頁的一次請求,即可非常快地載入。缺點是我們的代碼全部暴露在人們面前。另一方面,由于通常不用腳本編制語言做過分復(fù)雜的事情,所以這個問題暫且可以放在一邊。</p><p> 腳本語言真正面向的是特定類型問題的解決,其中主要涉及如何創(chuàng)建更豐富、
54、更具有互動能力的圖形用戶界面(GUI)。然而,腳本語言也許能解決客戶端編程中80%的問題。你碰到的問題可能完全就在那80%里面。而且由于腳本編制語言的宗旨是盡可能地簡化與快速,所以在考慮其他更復(fù)雜的方案之前(如Java及ActiveX),首先應(yīng)想一下腳本語言是否可行。</p><p> 目前討論得最多的腳本編制語言包括JavaScript(它與Java沒有任何關(guān)系;之所以叫那個名字,完全是一種市場策略)、VBS
55、cript(同Visual Basic很相似)以及Tcl/Tk(來源于流行的跨平臺GUI構(gòu)造語言)。當然還有其他許多語言,也有許多正在開發(fā)中。</p><p> JavaScript也許是日常用的,它得到的支持也最全面。無論NetscapeNavigator,Microsoft Internet Explorer,還是Opera,目前都提供了對JavaScript的支持。除此以外,市面上講述JavaScript
56、的書籍也要比講述其他語言的書多得多。有些工具還能利用JavaScript自動產(chǎn)生網(wǎng)頁。當然,如果你已經(jīng)有Visual Basic或者Tcl/Tk的深厚功底,當然用它們要簡單得多,起碼可以避免學(xué)習(xí)新語言的煩惱(解決Web方面的問題就已經(jīng)夠讓人頭痛了)。</p><p><b> 4. Java</b></p><p> 如果說一種腳本編制語言能解決80%的客戶端程序
57、設(shè)計問題,那么剩下的20%又該怎么辦呢?它們屬于一些高難度的問題嗎?目前最流行的方案就是Java。它不僅是一種功能強大、高度安全、可以跨平臺使用以及國際通用的程序設(shè)計語言,也是一種具有旺盛生命力的語言。對Java的擴展是不斷進行的,提供的語言特性和庫能夠很好地解決傳統(tǒng)語言不能解決的問題,比如多線程操作、數(shù)據(jù)庫訪問、連網(wǎng)程序設(shè)計以及分布式計算等等。Java通過“程序片”(Applet)巧妙地解決了客戶端編程的問題。</p>
58、<p> 程序片(或“小應(yīng)用程序”)是一種非常小的程序,只能在Web瀏覽器中運行。作為Web頁的一部分,程序片代碼會自動下載回來(這和網(wǎng)頁中的圖片差不多)。激活程序片后,它會執(zhí)行一個程序。程序片的一個優(yōu)點體現(xiàn)在:通過程序片,一旦用戶需要客戶軟件,軟件就可從服務(wù)器自動下載回來。它們能自動取得客戶軟件的最新版本,不會出錯,也沒有重新安裝的麻煩。由于Java的設(shè)計原理,程序員只需要創(chuàng)建程序的一個版本,那個程序能在幾乎所有計算機以及
59、安裝了Java解釋器的瀏覽器中運行。由于Java是一種全功能的編程語言,所以在向服務(wù)器發(fā)出一個請求之前,我們能先在客戶端做完盡可能多的工作。例如,再也不必通過因特網(wǎng)傳送一個請求表單,再由服務(wù)器確定其中是否存在一個拼寫或者其他參數(shù)錯誤。大多數(shù)數(shù)據(jù)校驗工作均可在客戶端完成,沒有必要坐在計算機前面焦急地等待服務(wù)器的響應(yīng)。這樣一來,不僅速度和響應(yīng)的靈敏度得到了極大的提高,對網(wǎng)絡(luò)和服務(wù)器造成的負擔(dān)也可以明顯減輕,這對保障因特網(wǎng)的暢通是至關(guān)重要的。
60、 與腳本程序相比,Java程序片的另一個優(yōu)點是它采用編譯好的形式,所以客戶端看不到源碼。當然在另一方面,反編譯Java程序片也并不是件</p><p> 5. ActiveX</p><p> 在某種程度上,Java的一個有力競爭對手應(yīng)該是微軟的ActiveX,盡管它采用的是完全不同的一套實現(xiàn)機制。ActiveX最早是一種純Windows的方案。經(jīng)過一家獨立的專業(yè)協(xié)會的努力,A
61、ctiveX現(xiàn)在已具備了跨平臺使用的能力。實際上,ActiveX的意思是“假如你的程序同它的工作環(huán)境正常連接,它就能進入Web頁,并在支持ActiveX的瀏覽器中運行”(IE固化了對ActiveX的支持,而Netscape需要一個插件)。所以,ActiveX并沒有限制我們使用一種特定的語言。比如,假設(shè)我們已經(jīng)是一名有經(jīng)驗的Windows程序員,能熟練地使用像C++、Visual Basic或者Borland Delphi那樣的語言,就能
62、幾乎不加任何學(xué)習(xí)地創(chuàng)建出ActiveX組件。事實上,ActiveX是在我們的Web頁中使用“歷史遺留”代碼的最佳途徑。</p><p> 6. 因特網(wǎng)和內(nèi)聯(lián)網(wǎng)</p><p> Web是解決客戶機/服務(wù)器問題的一種常用方案,所以最好能用相同的技術(shù)解決此類問題的一些“子集”,特別是公司內(nèi)部的傳統(tǒng)客戶機/服務(wù)器問題。對于傳統(tǒng)的客戶機/服務(wù)器模式,我們面臨的問題是擁有多種不同類型的客戶計算機
63、,而且很難安裝新的客戶軟件。但通過Web瀏覽器和客戶端編程,這兩類問題都可得到很好的解決。若一個信息網(wǎng)絡(luò)局限于一家特定的公司,那么在將Web技術(shù)應(yīng)用于它之后,即可稱其為“內(nèi)聯(lián)網(wǎng)”(Intranet),以示與國際性的“因特網(wǎng)”(Internet)有別。內(nèi)聯(lián)網(wǎng)提供了比因特網(wǎng)更高的安全級別,因為可以物理性地控制對公司內(nèi)部服務(wù)器的使用。說到培訓(xùn),一般只要人們理解了瀏覽器的常規(guī)概念,就可以非常輕松地掌握網(wǎng)頁和程序片之間的差異,所以學(xué)習(xí)新型系統(tǒng)的開
64、銷會大幅度減少。</p><p> 安全問題將我們引入客戶端編程領(lǐng)域一個似乎是自動形成的分支。若程序是在因特網(wǎng)上運行,由于無從知曉它會在什么平臺上運行,所以編程時要特別留意,防范可能出現(xiàn)的編程錯誤。需作一些跨平臺處理,以及適當?shù)陌踩婪?,比如采用某種腳本語言或者Java。</p><p> 但假如在內(nèi)聯(lián)網(wǎng)中運行,面臨的一些制約因素就會發(fā)生變化。全部機器均為Intel/Windows平臺
65、是件很平常的事情。在內(nèi)聯(lián)網(wǎng)中,需要對自己代碼的質(zhì)量負責(zé)。而且一旦發(fā)現(xiàn)錯誤,就可以馬上改正。除此以外,可能已經(jīng)有了一些“歷史遺留”的代碼,并用較傳統(tǒng)的客戶機/服務(wù)器方式使用那些代碼。但在進行升級時,每次都要物理性地安裝一道客戶程序。浪費在升級安裝上的時間是轉(zhuǎn)移到瀏覽器的一項重要原因。使用了瀏覽器后,升級就變得易如反掌,而且整個過程是透明和自動進行的。如果真的是牽涉到這樣的一個內(nèi)聯(lián)網(wǎng)中,最明智的方法是采用ActiveX,而非試圖采用一種新的
66、語言來改寫程序代碼。</p><p> 面臨客戶端編程問題令人困惑的一系列解決方案時,最好的方案是先做一次投資/回報分析。請總結(jié)出問題的全部制約因素,以及什么才是最快的方案。由于客戶端程序設(shè)計仍然要編程,所以無論如何都該針對自己的特定情況采取最好的開發(fā)途徑。這是準備面對程序開發(fā)中一些不可避免的問題時,我們可以做出的最佳姿態(tài)。</p><p><b> 7.服務(wù)器端編程<
67、/b></p><p> 我們的整個討論都忽略了服務(wù)器端編程的問題。如果向服務(wù)器發(fā)出一個請求,會發(fā)生什么事情?大多數(shù)時候的請求都是很簡單的一個“把這個文件發(fā)給我”。瀏覽器隨后會按適當?shù)男问浇忉屵@個文件:作為HTML頁、一幅圖、一個Java程序片、一個腳本程序等等。向服務(wù)器發(fā)出的較復(fù)雜的請求通常涉及到對一個數(shù)據(jù)庫進行操作(事務(wù)處理)。其中最常見的就是發(fā)出一個數(shù)據(jù)庫檢索命令,得到結(jié)果后,服務(wù)器會把它格式化成H
68、TML頁,并作為結(jié)果傳回來(當然,假如客戶通過Java或者某種腳本語言具有了更高的智能,那么原始數(shù)據(jù)就能在客戶端發(fā)送和格式化;這樣做速度可以更快,也能減輕服務(wù)器的負擔(dān))。另外,有時需要在數(shù)據(jù)庫中注冊自己的名字(比如加入一個組時),或者向服務(wù)器發(fā)出一份訂單,這就涉及到對那個數(shù)據(jù)庫的修改。這類服務(wù)器請求必須通過服務(wù)器端的一些代碼進行,我們稱其為“服務(wù)器端的編程”。在傳統(tǒng)意義上,服務(wù)器端編程是用Perl和CGI腳本進行的,但更復(fù)雜的系統(tǒng)已經(jīng)出
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- java外文翻譯---java和因特網(wǎng)
- java思想外文翻譯---java編程思想 (java和因特網(wǎng))
- 畢業(yè)論文外文翻譯-java和因特網(wǎng)
- java和因特網(wǎng)
- 無線局域網(wǎng)外文翻譯
- java 外文翻譯
- java外文翻譯
- [雙語翻譯]物聯(lián)網(wǎng)外文翻譯--物聯(lián)網(wǎng)愿景、應(yīng)用和挑戰(zhàn)
- java介紹外文翻譯
- java介紹外文翻譯
- java 編程外文翻譯
- [雙語翻譯]物聯(lián)網(wǎng)外文翻譯--物聯(lián)網(wǎng)愿景、應(yīng)用和挑戰(zhàn)(英文)
- 外文翻譯-java設(shè)計和zos的開發(fā)應(yīng)用
- [雙語翻譯]物聯(lián)網(wǎng)外文翻譯--物聯(lián)網(wǎng)愿景、應(yīng)用和挑戰(zhàn)中英全
- java的基礎(chǔ)外文翻譯
- 2018年物聯(lián)網(wǎng)外文翻譯--物聯(lián)網(wǎng)愿景、應(yīng)用和挑戰(zhàn).DOCX
- 外文翻譯---java學(xué)習(xí)過程
- 外文翻譯---java的思考
- java相關(guān)外文翻譯
- java外文文獻翻譯
評論
0/150
提交評論