




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
外文原文之一Popular Ajax作者:Dave Crane国籍:USA出处:A原文正文: Ajax (Asynchronous JavaScript + XML) is a relatively recent name, coined by Jesse James Garrett of Adaptive Path. Some parts of Ajax have been previously described as Dynamic HTML and remote scripting. The classical “web application” that we have become used to is beginning to creak under the strain that increasingly sophisticated web-based services are placing on it. A variety of techno-logies are lining up to fill the gap with richer, smarter, or otherwise improved clients. Ajax is able to deliver this better, smarter richness using only technologies that are already installed on the majority of modern computers.With Ajax, we are taking a bunch of dusty old technologies and stretching them well beyond their original scope. We need to be able to manage the complexity that we have introduced.The client/server and related n-tier architectures are essential for collaborative or centrally coordinated applications, but they raise the specter of network latency, with its ability to break the spell of user productivity. Although a generalpurpose solution to the conflict between the two exists in asynchronous remote event handling, the traditional request-response model of the classic web application is ill suited to benefit from it.Weve set a goal for ourselves, and for Ajax, in this chapter of delivering usablesovereign applications through a web browser, thereby satisfying the goals of user productivity, networking, and effortless, centralized maintenance of an application all at once. In order for this mission to succeed, we need to start thinking about our web pages and applications in a fundamentally different way. Weve identified the key ideas that we need to learn and those that we need to unlearn:l The browser hosts an application, not content.l The server delivers data, not content.l The user interacts continuously with the application, and most requests to the server are implicit rather than explicit.l Our codebase is large, complex, and well structured. It is a first-class citizen in our architecture, and we must take good care of it.Ajax isnt a single technology. Rather, its a collection of four technologies that complement one another. JavaScriptJavaScript is a general-purpose scripting language designed to be embedded inside applications. The JavaScript interpreter in a web browser allows programmatic interaction with many of the browsers inbuilt capabilities. Ajax applications are written in JavaScript.Cascading StyleSheets (CSS)CSS offers a way of defining reusable visual styles for web page elements. It offers a simple and powerful way of defining and applying visual styling consistently. In an Ajax application, the styling of a user interface may be modified interactively through CSS.Document ObjectModel (DOM)The DOM presents the structure of web pages as a set of programmable objects that can be manipulated with JavaScript. Scripting the DOM allows an Ajax application to modify the user interface on the fly, effectively redrawing parts of the page.XMLHttpRequestobjectThe (misnamed) XMLHttpRequest object allows web programme -rs to retrieve data from the web server as a background activity. The data format is typically XML, but it works well with any text-based data. While XMLHttpRequest is the most flexible general-purpose tool for this job, there are other ways of retrieving data from the server, too.Ajax represents a break from the previous use of DHTML technologies not only in the way the technologies are put together but also in the scale at which they are used. Were dealing with much more JavaScript than a classic web application would, and the code will often be resident in the browser for a much longer time. Consequently, Ajax needs to manage complexity in a way that classic DHTML doesnt.The main tool that we will apply is refactoring, the process of rewriting code to introduce greater clarity rather than to add new functionality.It is typically easier to add new functionality to well-factored code, to modify its existing functionality, and to remove functionality from it. In short, it is understandable. In a poorly factored codebase, it is often the case that everything does what the current requirements specify, but the programming team isnt fully confident as to why it all works.Ajaxs role of the server In the lifecycle of an Ajax application, the server has two roles to fulfill, and these are fairly distinct. First, it has to deliver the application to the browser. So far, weve assumed that the initial delivery of content is fairly static, that is, we write the application itself as a series of .html, .css, and .js files that even a very basic web server would be able to deliver. Nothing is wrong with this approachin fact, a lot can be said for itbut it isnt the only option available to us. The second role of the server is to talk to the client, fielding queries and supplying data on request. Because HTTP is the only transport mechanism available to us, were limited to the client starting off any conversation. The server can only respond. Keeping the models in sync with one another represents a major challenge, and one that the client cant solve on its own. Server-side programming is dominated by a handful of languages. Over the very brief course of Internet history, fashions in server-side languages have changed remarkably. The current kings of the hill are PHP, Java, and classic ASP, with ASP.NET and Ruby growing in popularity too. Ajax is primarily a client-side technology and can interoperate with any of these languages. Indeed, some ways of working with Ajax downplay the importance of the serverside language considerably, making it easy to port Ajax applications from one server platform to another.Web frameworks are in many ways more important to Ajax than the implementation language. Web frameworks carry assumptions with them, about how the application is structured and where key responsibilities lie. Most frameworks have been designed for building classic web applications, and assumptions about the lifecycles of thesewhich are very different from those of an Ajax appmay be problematic in places.Ajax building a quality applicationUsability is an especially hot topic for Ajax because web app users can be an extremely fickle bunch. The downside of being able to download and run your app with zero effort is that the users have invested no time and effort in it when they start to use the application and will be willing to throw it away and move on to the next of the 8 billion web pages that Google can point them to. To complicate matters further, with Ajax we are seeing the convergence of two different usability traditions, namely the desktop application and the web page. Getting Licensed to the mixture right can be quite a challenge, and failing to get it right can consign your hard work to obscurity.Its probably the case that your code doesnt responsiveness, robustness, consistency , simplicity. These are merely ideals that weve presented. Making the effort to move toward these ideals can pay big dividends when it comes to maintaining your codebase in the future, and refactoring existing code can introduce these qualities as you go along. Choosing where to concentrate the effort is something of a black art, and the only way to get good at it is by practicing. Remember, refactoring is an incremental process, and you can add quality to your code without pulling it apart and leaving bits on the floor for weeks on end.Somewhere along the way, JavaScript had grown up without our quite realizing it. And it had been sneaking up on us all for the last few years: Ajax.And the rest, is history. Ajax is generating a lot of interest now, and a lot of good code is getting written by the people behind Prototype, Rico, Dojo, qooxdoo, Sarissa, and numerous other frameworks, too plentiful to count. Actually, we do try to count them.中文译文一流行的AJAX作者:Dave Crane国籍:美国出处:AAjax (Asynchronous JavaScript + XML)是近来新出现的一个名词,由Jesse James Garrett of Adaptive Path创造。Ajax的一些部分先前被描述为动态网页和远程脚本。我们曾经奉之为经典的“web应用”日趋被越来越多的尖端的基于网络的服务施加更大的压力。很多技术出现来填补这个缺陷使之更丰富的,更聪明,或以其他方式改善客户。Ajax是能够提供这更好,更聪明的丰富的技术,并且只使用已安装在大多数的现代计算机的东西。有了Ajax,我们可以对一些陈旧的技术进行打包,对其原先的功能和范围进行延展。我们需要有足够的能力去妥善处理这些错综复杂的技术。C/S和多层结构对那些合作的或者在中心点上相同的应用程序来说是最根本的,但是也因为他们能够打破用户生产率的束缚从而带来增大网络延时的隐患。尽管异步远程事件处理提供了这两者间的冲突的一个通用的解决方案,但是以前的web程序所使用的传统请求响应模型就没有办法适宜于他们从而不能从中获益。我们为自己和Ajax制定了目标,在这章节提到的通过网页浏览器便捷控制应用更加有利于我们目标的效率,联网,和轻松集中的快速应用。为了任务的成功,我们需要从不同方面开始思考我们的网页和应用。我们已经可以辨别出哪些思想我们必须记住,哪些我们需要忘却。浏览器有一些应用程序不太令人满意。服务器传送数据不太令人满意用户和应用程序持续的相互影响,大多数对服务器的需求是含糊的而不是明确的我们的代码库有很大的容量,复杂,而且有很好的结构。Ajax不是一门独立技术。在一定程度上,他是由四门科技互相补充而形成的。JavaScriptJavaScript是一种多用途脚本语言为植入应用程序而设。JavaScript在浏览器上的应用使得项目的配合有了很多潜在的内在能力。Ajax应用程序是用JavaScript.编写的。Cascading StyleSheets (CSS)Css为网页基础提供了一种定义可再用的可视风格。他提供的是一种一贯的简单但是强大的可定义和应用的可视风格。在一种Ajax程序中,通过Css可以使一个用户界面的风格相互改良。Document ObjectModel (DOM)DOM作为呈现网页结构的可编程对象可以被JavaScript所熟练操控。插入DOM脚本允许Ajax应用程序在运行中修改用户界面,有效的使用所有网页。XMLHttpRequestobject未命名的XMLHttpRequest可以作为备份方便网络程序员从网络服务器回复数据。数据格式是可标志的XML,但是他是一种基于文本的数据。XMLHttpRequest是最灵活的多用途的工具,当然还有很多恢复数据的其他方法。Ajax代表着从先前使用的DHTML技术中脱离,他们不仅在技术上难以聚集,而且他们也不是在一个级别上被使用。我们更多的使用JavaScrip而不是传统的网络应用程序,而且他的代码会更长时间应用于浏览器。因此,Ajax可以处理更复杂的事物,但是DHTML不能做到。我们应用的主要工具是代码重构,一个比插入方法更加广泛有效的重写插入代码进程。它通常是比较容易加入新的功能,形成良好的因素代码,修改它的扩展功能,撤销功能。总之很好理解。在一个不太完善的插入代码中,经常会遇到所有事情都只能执行即时命令,但是程序组不能完全的成功完成所有任务。Aj
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025贵州省民族研究院第十三届贵州人才博览会引进人才1人模拟试卷有完整答案详解
- 2025广东广州市中级人民法院招聘劳动合同制审判辅助人员考前自测高频考点模拟试题参考答案详解
- 2025年冀北博望电力产业管理(北京)有限公司高校毕业生招聘(第三批)考前自测高频考点模拟试题附答案详解(完整版)
- 2025年冀北博望电力产业管理(北京)有限公司高校毕业生招聘(第三批)模拟试卷及答案详解(有一套)
- 2025年温州永嘉县茗岙乡卫生院招聘劳务派遣人员1人模拟试卷有完整答案详解
- 2025年西安凤城医院招聘(21人)考前自测高频考点模拟试题及一套参考答案详解
- 易制毒安全教育培训课件
- 2025云南昆明地铁运营有限公司招聘笔试题库历年考点版附带答案详解
- 2025中国铁建投资集团有限公司海外人才公开招聘8人笔试题库历年考点版附带答案详解
- 美国旅游线路介绍
- 典当行财产抵押借款合同2024
- 拉弯矫培训获奖课件
- GB/T 18029.6-2024轮椅车第6 部分:电动轮椅车最大速度的测定
- 专题报告2 刘宏民-燕山大学-板形仪20120408
- 城市配送行业未来发展展望
- 舞龙舞狮二级裁判员理论考试题库(含答案)
- (正式版)SHT 3115-2024 石油化工管式炉轻质浇注料衬里工程技术规范
- 食品行业新产品开发案例分析
- 建筑业绿色发展与节能减排
- 《统计分析与SPSS的应用(第7版)》课件全套 第1-12章 SPSS统计分析软件概述
- 青少年毒品预防教育-初中版
评论
0/150
提交评论