{"id":491,"date":"2008-06-21T07:37:58","date_gmt":"2008-06-21T11:37:58","guid":{"rendered":"http:\/\/www.dr-chuck.com\/wordpress\/?p=491"},"modified":"2011-12-17T12:26:46","modified_gmt":"2011-12-17T16:26:46","slug":"should-a-new-project-use-ajax","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2008\/06\/should-a-new-project-use-ajax\/","title":{"rendered":"Should a new Project use Ajax?"},"content":{"rendered":"<p>I got a question about whether or not to use Ajax in a new project from a former student.  Here is my answer.<\/p>\n<p><!--more--><br \/>\nYour tech lead is right in that doing Ajax directly and writing it all from Javascript is crazy &#8211; browser differences drive you nuts and you really never can be sure that things work across browsers until you have been in production for a while.  I wrote some code in Sakai that used XHTMLRequest directly in Javascript about three years ago &#8211; I was nervous for about a year after the code went into production.  There were never any reported bugs &#8211; but the code was really simple &#8211; nothing like the Ajax of today.<br \/>\nWhat your tech lead *might* be saying is that they have a web framework that they like and he does not know how to do Ajax in that framework.  If I knew the framework it would be helpful &#8211; word like Struts, Java Server Faces (JSF), Velocity, Spring Web Flow, Tapestry, would give me a clue &#8211; perhaps he is nervous &#8211; if I was a JSF shop I would be nervous about Ajax.  If you are writing portlets &#8211; that might mean that Ajax is technically difficult in that environment &#8211; but I don&#8217;t know for sure.  I know Ajax is technically difficult in the Portlet environment in the purely standards world &#8211; but vendor implementations may have clever workarounds.<br \/>\nOne problem with Ajax is accessibility &#8211; it is still an open issue &#8211; progress is being made &#8211; but if your application needs accessibility 100% &#8211; avoiding Ajax is probably a good idea.<br \/>\nHowever with all that said against Ajax, the browser issue is kind of a non-issue &#8211; if none of the above are show stoppers &#8211; the key is to use a library for Ajax &#8211; most use JQuery &#8211; in SI539 we used Prototype:<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"Zv91aaK8Kc\"><p><a href=\"https:\/\/jquery.com\/\">jQuery<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;jQuery&#8221; &#8212; jQuery\" src=\"https:\/\/jquery.com\/embed\/#?secret=jiMcDnkH1m#?secret=Zv91aaK8Kc\" data-secret=\"Zv91aaK8Kc\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><br \/>\nhttp:\/\/www.prototypejs.org\/<br \/>\nI like prototype because it is easy as a developer.   But real pros prefer jquery because it is cleaner in how it does its thing.<br \/>\nWith lots of web applications out there using these libraries &#8211; there is safety in numbers &#8211; by following the crowd &#8211; your app will be no worse then the rest.  With Google using Ajax for virtually all its applications &#8211; folks whose browsers don&#8217;t support Ajax well &#8211; generally get new browsers.<br \/>\nSo for me, this is how I come down on Ajax &#8211; (a) If you are making a web site that is trying to be sticky &#8211; you hope users get addicted to the site &#8211; and your development environment works with Ajax &#8211; definitely use Ajax and (b) if you are building something that people are forced to use (like CTools at UM) avoid Ajax except perhaps where it is really necessary &#8211; and then make sure to provide an accessible option.<br \/>\nWhen users are forced to use an application &#8211; accessibility can not be ignored.  For sites that are trying to build a community from random people around the world &#8211; a better\/more functional\/more usable site is more likely to attract and keep people &#8211; and yes accessibility is compromised &#8211; but most startup efforts are trying to show that their idea is successful to get the next round of $$ anyways.  So they cut corners in lots and lots areas including accessibility.  Not pretty but it is the reality of making prototype stuff.<br \/>\nI would also note that accessibility is sadly pretty lousy in many non-Ajax applications as well &#8211; so sometimes Accessibility is a bit of a red herring &#8211; folks say &#8220;Uh we can&#8217;t do Ajax because of accessibility&#8221; and then you ask &#8211; &#8220;Are we going to build an accessible site?&#8221; and then the answer is &#8220;No, we don&#8217;t have time for that but we plan to fix it later&#8221;  &#8211; usually sadly later turns into never as prototype code gets pressed into production.<br \/>\nDid that make sense?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got a question about whether or not to use Ajax in a new project from a former student. Here is my answer.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-491","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=491"}],"version-history":[{"count":1,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/491\/revisions"}],"predecessor-version":[{"id":2612,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/491\/revisions\/2612"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}