So you typically generate the HTML for an ajax call on the server side and send that back to the browser? From a person who is concerned about that extra second and the size of the jQuery library, this approach seems a little contradictory as those ajax responses have to be bloated due to all the included markup as opposed to a simple JSON object.
I'm curious, have you used any tools such as Firebug to actually see if results in less network traffic over the long run, especially considering the jQuery library can/will be cached? On Thu, May 19, 2011 at 4:15 PM, Andrei Kondrashev <adiab...@cs.com> wrote: > > Didn't really wanted to start a discussion. Just expressed my private > opinion applied to this particular situation, not really trying to make any > general claims. > >> 1) It's 90k minified > Only 90? Great! > >>2) Those 10 lines will inevitably be 1 line of jQuery > No, my custom line will be 11th one. > >>3) Those 10 lines will work in your favorite browser; then you find >>that IE x has some quirk you didn't count on, etc > XMLHTTPRequest is the only thing (thanks Computer God!) that works the same > way everywhere. All browsers employ MS XMLHTTP interface. Only difference > is in the initialization process, and this is why it requires 10 lines of > code, not 1 or 2. > >>4) You and Claude S will best friends, I can tell > Does it mean I am blacklisted now? > >> jQuery core is only 229K uncompressed... > This, of course, is much better than 300. > >>Do those 10 lines of code enable you to write different handlers >>depending on the status code and success of the http call without any >>fuss? Do they translate common response formats into plain js objects >>for you? > Yes, I could, but I don't need to, and I don't want to. I am calling MY > Web-site, I know EXACTLY what to expect. I don't want library function to > perform checks for situations, which will never happen. I want to have my own > interface that fits my needs better. Unless I forced to do so, I will make > entire HTML cooking on the server-side (this is why we use ColdFusion) and > just dump results to the browser, to avoid annoying freezes of client's > browser, while it processes "JS objects", JSONs, XMLs, and created HTML on > the fly. If you move server-side processing to the client side, than yes, > you might need something like jQuery to help you with this. But, from my > point of view, this is some different programming concept that significantly > differs from the client-server paradigm that assumes that client must be as > stupid and as simple, as possible. > > >>To be clear, even on Edge or 56K dial-up, non-cached Jquery, with all its >>built-in goodness, arrives in less than a second...so...I really can't >>imagine why rolling your own "just-enough" JS would be better. At least >>when it comes to speed/performance > This is because you think that 1 sec is a short time and can be ignored. I > have a different vision of this. I would fight for this 1 sec. As well as > for the size of browser's working set. > > >>Clearly, use whatever you like...but...wrt your harvester analogy: when >>the harvester is free, doesn't impact speed/performance, and will handle >>the 10 square feet of grass and the 10 hectares of grass...I'm not seeing >>the drawback of using it for both > No, this is a wrong example. The correct one is when you try to build a car > that simultaneously can be used as a truck, limo, and participate in > Formula-1. And yes, it must be electrical. Convertible? Please... > Perhaps, you could build something like this, but in reality it is much > better to have 3 or 4 DIFFERENT cars for different purposes. The only place > where you can find a piece of free cheese is a mousetrap... > >>jQuery (and other libraries) is well tested, well maintained, hugely >>popular and well thought out. All these things will have an impact on >>the speed of development and quality of code, especially for someone >>who wasn't coding before these things were commonplace. >>Andrei's assertion that using jQuery in this case would be 'nonsense' >>ignores these pertinent benefits and is itself nonsense. > My definition of "library" is something that contains millions of books, but > I can come there and borrow a SINGLE book I need, rather than carry back home > all millions books. jQuery is a great exercise in JS programming. Never > could imagine that so many things could be done in the browser! All those > flying DIVs and popping images are amazing and REALLY require significant > amount of efforts to create and maintain, especially considering the > "browsers war". But what it has to do with my simple task of dynamic update > of the application screen? Therefore, my word "nonsense" should be applied > to THIS situation ONLY and should NOT be used in any other context. > > > > Again, I did not try to offend anybody. The "best" > language/tool/browser/etc. is the one you know. For example, we all reading > this post because we all love ColdFusion and think it is "the best". Want to > learn an alternative point of view? Go to PHP or .NET forums. So, if you > like jQuery, you comfortable with it, you totally trust and rely on it, could > quickly produce desired results, or just because it is an internal standard > of your company - USE IT. But don't tell me this how EVERYBODY should > program, because "this is the best", "everybody use it", "this is a common > standard", "it increases (??) the code quality", and so on, and so on. By the > way, if people who created jQuery would think the same way, they would never > created it in the first place, since it wasn't a "common standard" and not > "everybody" used it. > > There are always attempts in the programming community (in its manager's part > especially) to declare something "the last and only thing you need" to > program and impose artificial "common standards". This never worked before > and will never work in the future. Programming languages and libraries come > and go. This is how it always was and this is how it always will be. > > I am not advocating for an anarchy. Computer science is a pretty good > developed area of discrete math, and base principles must be observed at any > cost. Unfortunately, these days many "programmers" never even heard about > Turing (Alan Mathison), but freely make claims about "standards", "best > languages", etc. My [private] point of view is that any "standard" and > "common practice" must have a normal common sense behind. Using a thing that > requires 300K (sorry 229K) of code to perform a task that requires a few > lines of it, is beyond of my definition of "common sense". Sorry. > > If you look at the original post that started this thread, you will see the > definition of the problem. My claim is that I can program this particular > task without jQuery and results will be better. Objectively better, not > because of questionable properties like "everybody", "best", "should use", > "standard", etc., but because it will be faster, smaller, take less resources > on client's computer, and because an author of the code can debug any > possible error, not asking somebody else for help. > > If the original problem would be how to program a fancy-shmancy Web-site that > never "sleeps", doesn't let me freely move cursor on the screen without > popping or moving something that I have to constantly kill, that dims my > screen every 2 minutes and asks "Can we help you?" or "Call us", and provides > additional annoying "services", then "YES" I would use jQuery, because I > don't want to spend the rest of my life to program this, and because, > obviously, nobody cares about the performance on such sites. > > Speaking about "common standards and trends" - hate this thing, I would > recommend to look at CSS. I myself didn't use it too much, always relying on > a Web designer, but now I use it and program more and more. For example, > look here: > > http://www.cssplay.co.uk > > Ask yourself how much JS code you have (possibly, via jQuery) to support > something that does not need JS at all? > > > Good luck to everybody making living during these strange times using jQuery > or without it... > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344724 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm