{"id":594,"date":"2008-10-11T21:10:40","date_gmt":"2008-10-11T13:10:40","guid":{"rendered":"http:\/\/fdream.net\/blog\/article\/594.aspx"},"modified":"2008-10-12T00:10:56","modified_gmt":"2008-10-11T16:10:56","slug":"%5b%e7%bf%bb%e8%af%91%5d%e4%bc%98%e5%8c%96%e5%9f%ba%e4%ba%8eAjax%e7%9a%84%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/fdream.net\/blog\/article\/594","title":{"rendered":"[\u7ffb\u8bd1]\u4f18\u5316\u57fa\u4e8eAjax\u7684\u5e94\u7528\u7a0b\u5e8f"},"content":{"rendered":"<h3>Optimizing Ajax Based Applications<\/h3>\n<h3>\u4f18\u5316\u57fa\u4e8eAjax\u7684\u5e94\u7528\u7a0b\u5e8f<\/h3>\n<p>\u539f\u6587\u5730\u5740\uff1ahttp:\/\/www.ajaxwith.com\/Optimizing-Ajax-Based-Applications.html<\/p>\n<p>Ajax is all about speed and interactivity. Without these features, using Ajax for building a specific application or website is just useless.<\/p>\n<p>Ajax\u5b8c\u5168\u5728\u4e8e\u901f\u5ea6\u548c\u4ea4\u4e92\u6027\u3002\u5982\u679c\u6ca1\u6709\u8fd9\u4e9b\u7279\u6027\uff0c\u7528Ajax\u6765\u6784\u5efa\u7279\u5b9a\u7684\u5e94\u7528\u6216\u8005\u7f51\u7ad9\u662f\u6beb\u65e0\u7528\u5904\u7684\u3002<\/p>\n<p>Developers have to ensure that they build applications that will cater to the immediate need of their users. They have to optimize their application before releasing them even for beta testing.<\/p>\n<p>\u5f00\u53d1\u8fd9\u5e94\u8be5\u786e\u4fdd\u4ed6\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u8fce\u5408\u7528\u6237\u7684\u76f4\u63a5\u9700\u6c42\u3002\u4ed6\u4eec\u5fc5\u987b\u5728\u53d1\u5e03\u4e4b\u524d\u4f18\u5316\u4ed6\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u751a\u81f3\u53ea\u662f\u53d1\u5e03Beta\u6d4b\u8bd5\u3002<\/p>\n<p><b>Optimizing the Application Prematurely<\/b><\/p>\n<p><b>\u8fc7\u65e9\u5730\u4f18\u5316\u5e94\u7528\u7a0b\u5e8f<\/b><\/p>\n<p>Premature optimization may seem to be a safe practice in ensuring that the application will work as expected. But this, however, is the cause of almost any problem in an Ajax based applications when it comes to optimization.<\/p>\n<p>\u8fc7\u65e9\u7684\u4f18\u5316\u4f3c\u4e4e\u56db\u4e2a\u5b89\u5168\u7684\u505a\u6cd5\uff0c\u53ef\u4ee5\u786e\u4fdd\u5e94\u7528\u7a0b\u5e8f\u5982\u671f\u5de5\u4f5c\u3002\u4f46\u662f\uff0c\u5f53\u5f00\u59cb\u4f18\u5316\u57fa\u4e8eAjax\u7684\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u8fd9\u51e0\u4e4e\u662f\u6240\u6709\u95ee\u9898\u7684\u8d77\u56e0\u3002<\/p>\n<p>Premature optimization will require developers to examine the functions of the application piece by piece and optimize them before they are brought together as a fully functional application.<\/p>\n<p>\u8fc7\u65e9\u7684\u4f18\u5316\u5c06\u9700\u8981\u5f00\u53d1\u8005\u4e00\u70b9\u4e00\u70b9\u5730\u5ba1\u67e5\u8fd9\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u529f\u80fd\uff0c\u5e76\u5728\u7ec4\u5408\u4ed6\u4eec\u6210\u4e3a\u4e00\u4e2a\u5168\u529f\u80fd\u7684\u5e94\u7528\u7a0b\u5e8f\u4e4b\u524d\u4f18\u5316\u5b83\u4eec\u3002<\/p>\n<p>This may seem to look good but it will only create confusion in finishing the application. Optimizing the application prematurely will require certain functions to be expanded which could complicate the function. Other functions will have to be updated and the application may not be finished.<\/p>\n<p>\u8fd9\u53ef\u80fd\u770b\u8d77\u6765\u4e0d\u9519\uff0c\u4f46\u662f\u8fd9\u53ea\u4f1a\u5728\u5b8c\u6210\u5e94\u7528\u7a0b\u5e8f\u7684\u8fc7\u7a0b\u4e2d\u9020\u6210\u6df7\u4e71\u3002\u8fc7\u65e9\u5730\u4f18\u5316\u5e94\u7528\u7a0b\u5e8f\u8981\u6c42\u6269\u5c55\u4e00\u4e9b\u51fd\u6570\uff0c\u800c\u8fd9\u4f1a\u8ba9\u8fd9\u4e9b\u51fd\u6570\u66f4\u52a0\u590d\u6742\u3002\u5176\u4ed6\u7684\u51fd\u6570\u8fd9\u9700\u8981\u66f4\u65b0\uff0c\u4ece\u800c\u8ba9\u8fd9\u4e2a\u5e94\u7528\u7a0b\u5e8f\u53ef\u80fd\u65e0\u6cd5\u5b8c\u6210\u3002<\/p>\n<p>Optimization has to be based on the application as a whole and not just piece by piece. The application has to be completely built before any changes have to be made in the Ajax based application.<\/p>\n<p>\u4f18\u5316\u9700\u8981\u628a\u6574\u4e2a\u5e94\u7528\u7a0b\u5e8f\u770b\u6210\u4e00\u4e2a\u6574\u4f53\uff0c\u800c\u4e0d\u662f\u4e00\u5757\u4e00\u5757\u7684\u3002\u5f53\u9700\u8981\u6539\u53d8\u57fa\u4e8eAjax\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u5e94\u8be5\u5b8c\u6210\u5e94\u7528\u7a0b\u5e8f\u7684\u6784\u5efa\u3002<\/p>\n<p>The developer has to be backed by a system or even just a philosophy on how to effectively build an application and eventually optimize it for better performance.<\/p>\n<p>\u5f00\u53d1\u8005\u5fc5\u987b\u652f\u6301\u8fd9\u6837\u4e00\u4e2a\u7cfb\u7edf\u751a\u81f3\u53ea\u662f\u4e00\u4e2a\u7406\u5ff5\uff1a\u600e\u6837\u9ad8\u6548\u5730\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\u5e76\u6700\u7ec8\u5bf9\u5176\u8fdb\u884c\u6027\u80fd\u4f18\u5316\u3002<\/p>\n<p><b>Order of Development<\/b><\/p>\n<p><b>\u5f00\u53d1\u6b21\u5e8f<\/b><\/p>\n<p>Performance optimization does not mean the development stage should be left behind. While developing the application, developers should consider the functionality and optimization of the application before they are actually coded.<\/p>\n<p>\u6027\u80fd\u4f18\u5316\u5e76\u4e0d\u610f\u5473\u7740\u5f00\u53d1\u821e\u53f0\u5e94\u8be5\u629b\u5728\u8111\u540e\u3002\u5f53\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\u7684\u65f6\u5019\uff0c\u5f00\u53d1\u8005\u5e94\u8be5\u5728\u5b9e\u9645\u7f16\u7801\u4e4b\u524d\u8003\u8651\u5e94\u7528\u7a0b\u5e8f\u7684\u529f\u80fd\u6027\u548c\u6700\u4f18\u5316\u3002<\/p>\n<p>Optimizing each function after they have been developed is a bad move because it will just complicate things before further development and will cause future problems.<\/p>\n<p>\u5728\u5f00\u53d1\u5b8c\u6210\u4e4b\u540e\u4f18\u5316\u6bcf\u4e00\u4e2a\u51fd\u6570\uff0c\u8fd9\u662f\u4e00\u4e2a\u7cdf\u7cd5\u7684\u4e3e\u52a8\uff0c\u56e0\u4e3a\u8fd9\u53ea\u4f1a\u4f7f\u5f97\u4e1c\u897f\u5728\u540e\u671f\u5f00\u53d1\u65f6\u66f4\u590d\u6742\uff0c\u5e76\u4e14\u4f1a\u5bfc\u81f4\u65b0\u7684\u95ee\u9898\u3002<\/p>\n<p>By creating an order of development, the application will be smoothly developed and optimization could be done after the application is done.<\/p>\n<p>\u901a\u8fc7\u5efa\u8bae\u4e00\u4e2a\u5f00\u53d1\u6b21\u5e8f\uff0c\u5e73\u7a33\u5730\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\uff0c\u7136\u540e\u5728\u5b8c\u6210\u4e4b\u540e\u5bf9\u5176\u8fdb\u884c\u4f18\u5316\u3002<\/p>\n<p><b>Scalability<\/b><\/p>\n<p><b>\u53ef\u4f38\u7f29\u6027<\/b><\/p>\n<p>This feature should be considered by developers if they are aiming to build a very powerful application. Scalability would mean that the application will have the same performance after optimization and different updates.<\/p>\n<p>\u5982\u679c\u8981\u5efa\u8bae\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5f00\u53d1\u8005\u5e94\u8be5\u8003\u8651\u8fd9\u4e2a\u7279\u6027\u3002\u53ef\u4f38\u7f29\u6027\u610f\u5473\u7740\u5f53\u5e94\u7528\u7a0b\u5e8f\u4f18\u5316\u548c\u4e0d\u540c\u66f4\u65b0\u540e\u5e94\u8be5\u6709\u540c\u6837\u7684\u6027\u80fd\u3002<\/p>\n<p>This is very challenging for developers since they will be required to be vigilant on the different trends in application development.<\/p>\n<p>\u8fd9\u5bf9\u5f00\u53d1\u8005\u6765\u8bf4\u4e00\u4e2a\u5f88\u5927\u7684\u6311\u6218\uff0c\u56e0\u4e3a\u4ed6\u4eec\u9700\u8981\u5728\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u5bf9\u4e0d\u540c\u8d8b\u52bf\u975e\u5e38\u8b66\u60d5\u3002<\/p>\n<p>More often than not, they should ensure that the Ajax based application will be able to receive constant updates from developers and even additional plug-ins and future APIs.<\/p>\n<p>\u66f4\u591a\u7684\u4e0d\u662f\u8fd9\u6837\u7684\uff0c\u4ed6\u4eec\u5e94\u8be5\u786e\u4fdd\u8fd9\u4e9b\u57fa\u4e8eAjax\u7684\u5e94\u7528\u80fd\u591f\u4ece\u5f00\u53d1\u8005\u548c\u989d\u5916\u7684\u63d2\u4ef6\u4ee5\u53ca\u672a\u6765\u7684API\u83b7\u53d6\u8fde\u7eed\u4e0d\u65ad\u7684\u66f4\u65b0\u3002<\/p>\n<p>Scalability could be attained if the developer is aware of the functions they are developing would be eventually upgraded.<\/p>\n<p>\u5982\u679c\u5f00\u53d1\u8005\u610f\u8bc6\u5230\u4ed6\u4eec\u6b63\u5728\u5f00\u53d1\u7684\u529f\u80fd\u6700\u540e\u53ef\u80fd\u9700\u8981\u5347\u7ea7\uff0c\u53ef\u6269\u5c55\u6027\u5c31\u8fbe\u5230\u4e86\u3002<\/p>\n<p>A technique in ensuring proper reception of the function for updates is to develop a prototype for testing. This way, developers should test the ability of the application to receive further updates.<\/p>\n<p>\u4e3a\u4fdd\u8bc1\u529f\u80fd\u80fd\u591f\u9002\u5f53\u5730\u63a5\u53d7\u66f4\u65b0\uff0c\u4e00\u79cd\u6280\u672f\u624b\u6bb5\u5c31\u662f\u5f00\u53d1\u4e00\u4e2a\u6d4b\u8bd5\u539f\u578b\u3002\u5728\u8fd9\u79cd\u65b9\u5f0f\u4e2d\uff0c\u5f00\u53d1\u8005\u5e94\u8be5\u6d4b\u8bd5\u8fd9\u4e2a\u5e94\u7528\u7a0b\u5e8f\u63a5\u53d7\u540e\u671f\u66f4\u65b0\u7684\u80fd\u529b\u3002<\/p>\n<p>Ajax should perform above and beyond expectation. This is a very big challenge to developers especially that Ajax is constantly changing. By following a system for optimization, developers could improve their application without complicating smaller functions.<\/p>\n<p>Ajax\u6267\u884c\u4e0a\u9762\u8bf4\u63d0\u5230\u7684\u5e76\u8d85\u51fa\u9884\u671f\u3002\u8fd9\u5bf9\u5f00\u53d1\u8005\u6765\u8bf4\u662f\u4e00\u4e2a\u975e\u5e38\u5927\u7684\u6311\u6218\uff0c\u5c24\u5176\u662f\u9700\u8981\u4e0d\u65ad\u53d8\u5316\u7684Ajax\u3002\u5728\u4f18\u5316\u7cfb\u7edf\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5f00\u53d1\u8005\u5e94\u8be5\u5728\u4e0d\u8ba9\u5c0f\u529f\u80fd\u53d8\u5f97\u590d\u6742\u7684\u60c5\u51b5\u4e0b\u6539\u8fdb\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>Scalability should also be considered as a highly scalable application will be able to change and adopt based on the needs of users.<\/p>\n<p>\u53ef\u6269\u5c55\u6027\u4e5f\u5e94\u8be5\u8003\u8651\u5230\uff0c\u53ef\u56e0\u4e3a\u4e00\u4e2a\u53ef\u9ad8\u5ea6\u6269\u5c55\u7684\u5e94\u7528\u7a0b\u5e8f\u8981\u80fd\u591f\u505a\u51fa\u6539\u53d8\u5e76\u901a\u8fc7\u57fa\u4e8e\u7528\u6237\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Optimizing Ajax Based Applications \u4f18\u5316\u57fa\u4e8eAjax\u7684\u5e94\u7528\u7a0b\u5e8f \u539f\u6587\u5730\u5740\uff1ahttp:\/\/www.ajaxwith.com\/Optimizing-Ajax-Based-Applications.html Ajax is all about speed and interactivity. Without these features, using Ajax for building a specific application or website is just useless. Ajax\u5b8c\u5168\u5728\u4e8e\u901f\u5ea6\u548c\u4ea4\u4e92\u6027\u3002\u5982\u679c\u6ca1\u6709\u8fd9\u4e9b\u7279\u6027\uff0c\u7528Ajax\u6765\u6784\u5efa\u7279\u5b9a\u7684\u5e94\u7528\u6216\u8005\u7f51\u7ad9\u662f\u6beb\u65e0\u7528\u5904\u7684\u3002 Developers have to ensure that they build applications that will cater to the immediate need of their users. They have to optimize their application before releasing &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[120],"class_list":["post-594","post","type-post","status-publish","format-standard","hentry","category-coding","tag-AJAX"],"views":3368,"_links":{"self":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/comments?post=594"}],"version-history":[{"count":0,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/594\/revisions"}],"wp:attachment":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/media?parent=594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/categories?post=594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/tags?post=594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}