Ajax Patterns 读书笔记 --3

程序设计模式 (25)
Programming Patterns (25)
  • RESTful Service Expose web services according to RESTful principles.
  • RPC Service(远端程序调用) Expose web services as Remote Procedural Calls (RPCs).
  • HTML Response(直接生成HTML代码片断返回) Have the server generate HTML snippets to be displayed in the browser.
  • Semantic Response(以特定语义的数据封装方式返回) Have the server respond with abstract, semantic, data.
  • Plain-Text Message Text格式传递)Pass simple messages between server and browser in plain-text format.
  • XML Message XML格式传递)Pass messages between server and browser in XML format.
  • JSON Message Pass messages between server and browser in Javascript Object Notation (JSON) format.
浏览器 - 服务器对话
Browser-Server Dialogue
  • Call Tracking Accommodate busy user behaviour by allocating a new XMLHtpRequest object for each request. See Richard Schwartz's blog entry.Note: Pending some rewrite to take into account request-locking etc.
  • Distributed Events Keep objects synchronised with an event mechanism.
  • On-Demand Javascript (立即响应JSDownload Javascript as and when required, instead of downloading it all on page load.
DOM Population
  • XML Data IslandXML数据岛) Retain XML responses as "XML Data Islands", nodes within the HTML DOM.
  • Browser-Side XSLT(浏览器端XSLT Apply XSLT to convert XML Messages into XHTML.
  • Browser-Side Templating(浏览器端模板) Produce browser-side templates and call on a suitable browser-side framework to render them as HTML.
性能优化
Performance Optimisation
  • Fat Client (创建富客户端)Create a rich, browser-based, client by peforming remote calls only when there is no way to achieve the same effect in the browser.
  • Browser-Side Cache (浏览器端缓存)Maintain a local cache of information.
  • Guesstimate(估计值替代服务器端的真实数据读取) Instead of grabbing real data from the server, make a guesstimate that's good enough for most user's needs. ITunes Download Counter, GMail Storage Counter.
  • Submission Throttling(提交调节) Instead of submitting upon each Javascript event, retain the data in a local buffer and upload it periodically.
  • Explicit Submission(显示提交) Instead of submitting upon each Javascript event, require the user to explicitly request it, e.g. submit upon clicking a button.
  • Multi-Stage Download (页面分级下载)Quickly download the page structure with a standard request, then populate it with further requests.
  • Predictive Fetch(数据预取) Anticipate likely user actions and pre-load the required data.
扩展
Extension
  • Cross-Domain Proxy (跨域代理)Allow the browser to communicate with other domains by server-based mediation.
  • Richer Plugin(更的插件) Make your application "more Ajax than Ajax" with a Richer Plugin.
代码产生与重用
Code Generation and Reuse
  • Ajax Stub (桩)Use an "Ajax Stub" framework which allows browser scripts to directly invoke server-side operations, without having to worry about the details of XMLHttpRequest and HTTP transfer.
  • Server-Side Code Generation(服务端的代码生成) Automatically generate HTML and Javascript from server-side code.
  • Cross-Browser Component (跨浏览器组件)Create cross-browser components, allowing programmers to reuse them without regard for browser compatibility.
待续 --3
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值