Jump to content

Is using jQuery cheating?


toxicious

Recommended Posts

I recently started coding some javascript which is use at my site (no big complex functions) and I have also discovered jQuery.Quite often when I do different things, it all ends with me finding out how to do it in jQuery and going that way instead since in 100% of the cases it is simpler I think. I mean, it feels like a human designed jQuery and a robot designed javascript :glare: Is it bad to use jQuery all the time? Since I am not learning to use any of the native functions?

Link to comment
Share on other sites

If you don't know how it could be done in Javascript, it's probably best if you don't use jQuery. jQuery isn't cheating but you won't learn anything if that's all you rely on. The problem I have with jQuery is if you're only doing something really simple and you make the client download the entire jQuery library for a basic click event or something like that. It takes extra time loading the page and extra bandwidth cost from the server.

Link to comment
Share on other sites

Didn't know that Ingolme. Thanks. Now I have two good reasons to share with people that bug me to use it on projects.

Edited by niche
Link to comment
Share on other sites

What? all 24 to 40kb WOW! massive bandwidth that would take up, about size of one high quality thumbnail image, once you consider the amount of code using just javascript alone compared to jquery you would save on that amount many times over.

Link to comment
Share on other sites

What? all 24 to 40kb WOW! massive bandwidth that would take up, about size of one high quality thumbnail image, once you consider the amount of code using just javascript alone compared to jquery you would save on that amount many times over.
Well I am a little with you here, besides, I am using the jQuery from google which means it isn't my bandwidth. Though on my current site (which is small), I load it one time, at the index page. The rest of the site is pretty much loaded into divs (instead of iframes) via jquery so they also can use that jquery :) Meaning that, if we put aside the bandwidth question and the loading it multiple times thingy, I suppose it is okay?Though as you say, Ingolme, I should probably learn how to do it both with and without jQuery.
Link to comment
Share on other sites

I don't think jQuery would be bad for learning it offers a new point of view to the problem which might give you the perspective you need to understand the real deal.

Link to comment
Share on other sites

It is quite an order of magnitude of difference between 24,000 bytes and approximately 200 bytes that the simple scripts usually need. If you're making a client-side application, or complex animations, I don't object to the usage of jQuery.

Link to comment
Share on other sites

By that theory, Why don't we do away with images and just use a descriptive text only. What starts as simple script usually get added to and before you know it! it's no longer a 200byte script but a massive 100kb+ file. You usually find JavaScript used somewhere on every page now days, especially for form validation, ajax etc, so it will soon add up.

Link to comment
Share on other sites

If you know from the start that you'll most probably use JavaScript somewhere on every page, your application is probably complex enough to warrant the use of jQuery from the start.And as for growing applications that only start with needing JavaScript at one place, and then another, etc... if you find yourself replicating several jQuery features, you probably need jQuery. Otherwise, you don't.

Link to comment
Share on other sites

I don't have a crystal ball, but i pretty much guarantee,that from the very start that jquery WILL be used on most pages in some form, so would it not be prudent to use jquery regardless of the 24kb file library files. Yes by all means get a understanding of JavaScript on its own, so you understand how to combine it together with jquery, and how it it works, compared to jquery.

Link to comment
Share on other sites

I don't have a crystal ball, but i pretty much guarantee,that from the very start that jquery WILL be used on most pages in some form,
What? For every site/application?
so would it not be prudent to use jquery regardless of the 24kb file library files.
If you're using several features, and not just a single simple feature like an "ajax" function... sure. It's prudent indeed.
Link to comment
Share on other sites

Yes! advertisment for one example, where you have slideshow effect at the side, jquery in almost every page to show specific content related to the page you are on, which will take you to application page related to that specific content you just came from.

Link to comment
Share on other sites

Well, if you want a fancy thing like a slideshow effect, I suppose that's warranted too. I haven't seen many sites that do this for ads... instead, most sites typically show a random ad chosen by the server, and for THAT, using jQuery is not needed.I'm sure you can think of other "fancy" stuff too... and if you want to be fancy, jQuery is a good way to be fancy. The point Ingolme and I are making is that if you don't need the fancy stuff, but just use jQuery for the sake of using jQuery "in case you decide you want the fancy stuff" is... I think the right word is "pointless".

Link to comment
Share on other sites

I think you will find most ads are flash and jquery, or similar, and you will find they will have links, code added within the advirsiment area. And NO! i don't mean use jquery just for fancy stuff, but using jquery means smaller scripts, less code, leaner load time. IF one jquery app is used, where you have link to jquery libraries, you might as well start creating code using jquery anyway.

Link to comment
Share on other sites

Indeed, I find most sites make ads that are using Flash, and/or they have jQuery included, but the point is that most sites don't need to do that with the way their ads are structured. To put this in another way, even though they use jQuery or Flash, they don't have a slideshow or something like that.Those who use Flash use it for the sake of audio or video ("animation" in general, really), which is OK (doing audio or video with HTML5 is still somewhat tricky with all the formats). Those who use jQuery typically have jQuery there because of something else. Something that they use on just one or a few pages (like if they have an interactive form of some sort on one page), and something which uses just one not-so-fancy feature (like making ajax requests on change), but include the library everywhere anyway - the very practice that Ingolme and I consider "bad".There are of course some who actually do use jQuery for the sake of making their ads fancy with stuff like slideshows, in which case they've made the right decision, but those are the exception, not the rule.

Link to comment
Share on other sites

but include the library everywhere anyway - the very practice that Ingolme and I consider "bad".
How can that be bad! its only loaded once in the cache and that's that! not loaded time, and time again its only 24kb. Using that theory you should separated all css styling to a specific page, and only link to that specific css, on load? The good thing about using jquery it teaches you to create leaner, unobtrusive code (non of which is mentioned in the JavaScript examples at W3chools, i don't think, all inline as far as i know). Edit: which means leaner js/jquery code, leaner html code as well. Edited by dsonesuk
Link to comment
Share on other sites

If it's a very little CSS/JavaScript, it's fine to include it in a file that's downloaded always. But including a whole library, alongside all of your CSS/JavaScript, if most of your pages don't even use it, is just a waste of your users' bandwidth.Yes, jQuery can create leaner, unobtrusive code, if used right, but the same can be said about JavaScript itself when it comes to non-fancy scenarios.

Link to comment
Share on other sites

You seriously think its bad about ONE SINGLE 24kb file being uploaded once? just like that! when you have can HAVE multiple images that have not been compressed being used, tables instead of div (section, article for HTML5) for layout of page, which can slow the rendering of a page, that can cause more problems with the loading of a page, than one single 24kb js file will ever do. I think someone hates jQuery with as much vengeance as i hate crappy IE.

Link to comment
Share on other sites

Who said using uncompressed images (and multiple ones too), and/or using tables for layout is a good thing? I sure didn't, and I don't think that's OK either.You're lumping those together as if you can't create a table-less, image-compressed site without jQuery, which we all know is false.

I think someone hates jQuery with as much vengeance as i hate crappy IE.
Who's that?Saying "not everything is a nail" is not the same thing as saying "you should never use a hammer".
Link to comment
Share on other sites

Interesting posts... I just add my two sense in regards to it being cheating or not: IF you are really good with JavaScript, I mean good as in you can do/make a lot of the things jquery does but instead decide to still use jquey EVEN when you have the time to make your own, then in a way.. in my opinion that's cheating(not necessarily, but in a way). IF you are learning JavaScript or aiming to learn it, but always use jquery for everything, then you're preventing yourself from really learning JavaScript. IF you tell your client or the person you're making the site for, that you do ALL the coding, I mean ALL the coding and use jquery to do a lot of fancy stuff etc, then that's cheating in a way but more like being untruthful. IF you don't care or don't want to learn JavaScript and/or don't have time to make your own, then using jquery of course is alright. That's what it was intended for I believe, for those kind of people. So all in all, I guess it depends on the individual and situation. If Douglas Crockford always used jquery for everything he does and then presents his work as in he did it himself, then that's cheating/being untruthful imo. ;) I am not against jquery, I think it's really nice, but if you want to learn JavaScript itself and master the language, I suggest staying away from it for awhile. If you were to get a job at some developing company and they asked you to make something in JavaScript and then you turn to your friend and say "yes! I can do it with jquery, shh!" and then they come back and say "oh hey, forget to mention.. don't use any JavaScript library like jquery etc", you'll be sitting there scratching your head. :umnik2: So in the end, I guess it depends.

Link to comment
Share on other sites

No! wrong again! I'm stating that you are comparing a mere 24kb, that could be nothing compared to any uncompressed images, or the problem of using a table being used in the design instead, compared to these that is NOTHING, talking about crappy IE, with jquery you do not have to take in consideration the different crappy IE methods used to achieve the same result in better browsers, as the same code will be recognised in all better browser, and oh yea IE.

Link to comment
Share on other sites

No! wrong again! I'm stating that you are comparing a mere 24kb, that could be nothing compared to any uncompressed images, or the problem of using a table being used in the design instead, compared to these that is NOTHING, talking about crappy IE, with jquery you do not have to take in consideration the different crappy IE methods used to achieve the same result in better browsers, as the same code will be recognised in all better browser, and oh yea IE.
I see.Well, that doesn't invalidate anything I said then. I mean, it's as if you're saying "Yeah, algorithm X is faster than Y, but Y is still magnitudes faster than Z, and also accounts for stuff X doesn't account for!". Sure, if you need that power, use it. If you don't need the power, having it is pointless.
So in the end, I guess it depends.
Amen to that!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...