Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming

To Learn (Or Not Learn) JQuery 126

Nerval's Lobster writes: jQuery isn't without its controversies, and some developers distrust its use in larger projects because (some say) it ultimately leads to breakage-prone code that's harder to maintain. But given its prevalence, jQuery is probably essential to know, but what are the most important elements to learn in order to become adept-enough at it? Chaining commands, understanding when the document is finished loading (and how to write code that safely accesses elements only after said loading), and learning CSS selectors are all key. The harder part is picking up jQuery's quirks and tricks, of which there are many... but is it worth studying to the point where you know every possible eccentricity?
This discussion has been archived. No new comments can be posted.

To Learn (Or Not Learn) JQuery

Comments Filter:
  • Learn jQuery (Score:1, Informative)

    by Anonymous Coward

    It's awesome, and a lot easier than learning all of the eccentricities of plain old JavaScript.

    • Re:Learn jQuery (Score:4, Insightful)

      by Nimloth ( 704789 ) on Monday June 29, 2015 @04:16PM (#50014151)
      I agree, but there is a balance you should achieve. When I first learned jQuery and realized how easy it was to do a lot of things, I went crazy with it. Nowadays I've realized most of what I was using jQuery for, was better done using minimal jQuery (or none at all) and more CSS. Yes, it would be possible to use plain old javascript, but it's easier to write, AND READ jQuery than it would be to script all browser-specific perks of javascript. At the end of the day, use it, but don't abuse it. It's cached on all client browsers anyway and processing overhead and minimal, might as well use it and save yourself a headache or two.
    • It's great to start out and become productive quickly, but ultimately a web developer needs to learn those eccentricities if they want to work on more complex and interesting projects. jQuery is a good stepping stone.
    • Bingo. I love jquery for several reasons, not the least of which is that it provides simple ways to do common things without having to cook it all myself over and over.
    • #fail. It fixes DOM problems, not javascript problems. I mean, if you're dirtyt, can you clean yourself off by smearing shit all over yourself? Of course not. So how can a javascript library, written in javascript, fix deficiencies in the javascript language? It can't. You need to use a transpiler like coffeescript or babel if you want to improve the javascript language.
  • by pushing-robot ( 1037830 ) on Monday June 29, 2015 @04:12PM (#50014119)
    • Till all very commonly used browsers treat javascript the same way there will still be a place for jQuery. It may be a time now for something more light weight.
  • by bulled ( 956533 ) on Monday June 29, 2015 @04:14PM (#50014133)
    This is another in a long chain of articles that seem to assume all developers work on web frontend software. We do not. I have no use for jQuery and thankfully do not have to work on a single line of JavaScript in my day job. Maybe if you want to work on frontend-y stuff then it would be worth learning, but it is by no means required to be a developer.
    • Re: (Score:2, Insightful)

      frontend developers

      Isn't that an oxymoron?

      • It's no more an oxymoron than UX designers.

        Umm, hang on ...

      • by Tablizer ( 95088 )

        We really need a better term for "back-end developers", for what should be obvious reasons. Nerds have enough social cred problems as it is. Sometimes "server side" is used, but that doesn't quite cut it because some UI dev is also done on the server side in many cases.

    • Re: (Score:2, Informative)

      by Anonymous Coward

      You assume that Javascript is front-end
      That is no longer the case [nodejs.org]

      • by murdocj ( 543661 )

        God help you if you are using JS on the back end. It's bad enough on the front end.
        But I do love jQuery.

      • You assume that Javascript is front-end That is no longer the case [nodejs.org]

        Irrelevant to the topic at hand, JQuery (and front web development specifically which is the article's theme.)

        This is like having a discussion on C/C++'s direct memory management and then drop a retort saying "you can get automatic garbage collection" with a link to Microsoft's C++/CX. #duh

    • by Tablizer ( 95088 )

      I don't really understand your gripe. Slashdot covers many technology specialties. Very few article topics will fit the entire audience, and many will fit only a small subset. That's expected. I've seen embedded programming articles also, for example, which a web developer will typically not care about. Should web developers gripe about articles on embedding?

      You seem to have a set of unstated assumptions about the domain of slashdot and the domain of its readers that doesn't match mine. Perhaps you are argu

      • It sounds like a gripe about the wording in the summary:

        But given its prevalence, jQuery is probably essential to know,

        It's clear enough that they're talking about web UI development, but when do you not hear someone complaining about assumptions made in the summary?

    • I think it's pretty clear that this means, given you need to write JavaScript for the browser, should you learn jQuery and if so how? The fact that accountants and plumbers don't really need to know jQuery is kind of a given, right?

      • How will your plumber ever fix your IoT toilet, running node.js, that simulcasts your poops play by play on facebook and twiitter?
    • by mwvdlee ( 775178 )

      Some of us are, some of us aren't and some of us are both or even neither.
      This site is not "News for me, nothing else matter".

  • by frovingslosh ( 582462 ) on Monday June 29, 2015 @04:15PM (#50014139)
    No matter what they tell you, last Friday's Supreme Court ruling does not say that straight people must accept JQuery.
  • by Anonymous Coward

    Do NOT use a hosted library. If you have to use it, copy the damn thing to your own server.
    Hosted libraries, especially massively used ones like jQuery, are a security disaster waiting to happen.

    Not to mention the privacy issues caused by using a library hosted by a company that is known to correlate every bit of information about people that they can get their hands on (Google)

    • ^^^^^ THIS, times a billion.

      Hosting your own libraries bypasses a slew of potential security holes. I never do it any other way, ever. I wish I points to mod you up. Maybe someday, lol.
      • by lucm ( 889690 )

        There is a performance aspect to consider, however, especially on mobile where the network sucks. It's very likely that people would already have the CDN version in their browser cache since a lot of website use that link. By forcing users to download your version, you are slowing things down for them at the worst possible time - their first visit to your website.

        If you have valuable content and a captive audience, fine, but if like most people you are in dire need to attract and retain visitors, it's best

        • It's very likely that people would already have the CDN version in their browser cache since a lot of website use that link.

          This is a popular claim, but what little real data I've seen says quite the opposite. There are so many different minor versions of a library like jQuery that the chance of any given visitor to your site actually having visited another site using the exact same version from the exact same CDN within the cache window turns out to be pretty low.

          There are still reasonable performance-related arguments in favour of hosting static content on a CDN, and for splitting resources across domains unless you're in SPDY

          • by lucm ( 889690 )

            It's very likely that people would already have the CDN version in their browser cache since a lot of website use that link.

            This is a popular claim, but what little real data I've seen says quite the opposite. There are so many different minor versions of a library like jQuery that the chance of any given visitor to your site actually having visited another site using the exact same version from the exact same CDN within the cache window turns out to be pretty low.

            There are not that many version of jquery in use, and anyways the odds of that same visitor having your local version on his first visit are ZERO, which is basically the worst case scenario. Given the fact that this is a third-party library that you are unlikely to modify, hosting it on your own servers provides no advantage whatsoever. Just monitor the CDN like you do for your own resources.

            • Given the fact that this is a third-party library that you are unlikely to modify, hosting it on your own servers provides no advantage whatsoever.

              Of course it does. It has the same advantages in terms of security and your visitors' privacy as any decision to host your own material instead of quietly using a third party service. Whether you consider those significant advantages is a different question, and whether your visitors would is a different question again, but clearly there is a difference.

  • Comment removed based on user account deletion
  • Front end browser development is littered with dozens of front end frame works that have fizzled over the years. YUI, Prototype, script. aculo.us, etc. All popular in their day. jQuery is still active but certainly on the decline.

    You want to be a good front end developer? Learn about the DOM model. Learn about HTTP, HTTP/2 and CSS. Learn the fundamentals of how all that stuff works together and then you'll never need to worry about picking up whatever front end framework is used by the cool kids.

    • To be fair, back in the day browsers were a lot more quirky and getting even simple scripts to work in the big five was a major hassle. These frameworks took a lot of that away. These days, that issue is much less prevalent.

  • by SirJorgelOfBorgel ( 897488 ) on Monday June 29, 2015 @04:32PM (#50014271)

    Back when I did web stuff a number of years ago, we used jQuery pretty extensively. I've even been involved a bit, submitted performance patches, etc. (none of the code I touched is still present though). Having used other javascript toolkits, jQuery was by far my favorite (I still have nightmares about Dojo). Made a lot of things very easy that were otherwise cumbersome, lengthy, or errorprone to do. Note that when I say jQuery here I mean the core of it, not the UI components and such that came later.

    I've actually read the linked articles (*gasp*), and it seems the one referenced to imply that developers distrust it in large projects (really, summary?) is simply elaborating on how they have been using jQuery in a way that doesn't work very well, and found a different way of using it where it does work well. Surprise, jQuery is a tool, and crafting solutions requires you to use the right tool, in the right way, at the right time. Screwdrivers are great for screws, but nails pair better with the hammer.

    jQuery is a very helpful tool if you use it right, and I think it would be beneficial for most javascript developers to have played around with it. It's not all that complicated, it's easy to learn, and if you're javascript is novice level, figuring out how/why jQuery works will also improve your javascript skills significantly.

    I haven't heard of any other controversy regarding jQuery either but I haven't really been paying attention to it lately. Anyone care to elaborate?

    • by Anonymous Coward

      The controversy is there are all these new hotness JS frameworks that need jQuery market share.

    • I mix and match jQuery and Javascript freely, there's no reason you can't use it in places where it works well, although my default is Javascript, which itself is not without its little quirks - like when you try to sidestep the client-server push model without AJAX and discover JS doesn't do line breaks in variables. Can you say concatenation on an industrial scale?

    • Exactly.

      If you're browser-side JS developer (as opposed to something server-side like Node.JS) and you haven't worked with JQuery, then you're not really a browser-side JS developer. It's just far too widely used to pretend that it doesn't or shouldn't exist. And most of the consistency across other frameworks (like using the $ shortcut or css selectors to target elements in the DOM) comes from the popularity of JQuery to begin with.

  • Anyone who is considering learning jQuery should also check out Vanilla JS [vanilla-js.com].

    Vanilla JS is a fast, lightweight, cross-platform framework for building incredible, powerful JavaScript applications.

    • Anyone who is considering learning jQuery should also check out Vanilla JS [vanilla-js.com].

      Vanilla JS is a fast, lightweight, cross-platform framework for building incredible, powerful JavaScript applications.

      I love it every time "Vanilla JS" is brought up in a jquery post. Please see my previous post on the topic, which demonstrates why that website is both dishonest in its comparison, as well as a perfect example of why you should use a proven library instead of reinventing the wheel (and all the bugs that come with said reinvention)

      http://slashdot.org/comments.p... [slashdot.org]

  • Comment removed based on user account deletion
  • If you need to perform complex DOM manipulation jQuery is still the best tool, fortunately recent javascript frameworks drastically reduced the need for manual DOM manipulation. Usually you encapsulate your jQuery DOM manipulation code using your framework of choice, this is very common when doing specialized UI components.

  • I personally don't like jQuery for various reasons, but if one is going to use it, learn the why's and how's, so that when things aren't working, you can figure out why.

    Myself, I use ExtJS heavily for projects on the front end, granted i'm doing things that actually have a purpose for business.

  • Vanilla JS (Score:1, Offtopic)

    by Ark42 ( 522144 )

    http://vanilla-js.com/ [vanilla-js.com] is probably much more worth learning and using. The *ONLY* reason to be using jQuery is for IE8 support, but I've long since required IE9+ for all freelance work I do, and do everything in CSS and Vanilla JS now.

  • by Anonymous Coward

    Because today someone will say Angular is the way to go. Tomorrow they will say something different. Web development is a big joke.

  • by quietwalker ( 969769 ) <pdughi@gmail.com> on Monday June 29, 2015 @05:25PM (#50014727)

    If you're doing front end web development, at some point, you're going to have to become good at Javascript.

    You've got all these different frameworks where everything gets abstracted 3 redirections deep into a pseudo MVC layer populated with promise events and callback system that work well for 80% of the job and make 20% incredibly hard, and STILL in the end ties into the DOM, and is just as breakage prone, all the while explicitly demanding you adhere to their code organization because that way they can encode configuration into class names and function invokations and all of them claiming the other is bad not because of intrinsic issues but because they don't make the same ideological architectural choices like one-page-apps or putting business logic (including navigation!) in pages - even though it's more predicated on popularity than functionality, and ALL of that built on top of the mess that is Javascript and you are well and truly sunk my friend. Not even a run-on-sentence has enough space to cover all the horrible stuff that lies out there for the aspiring web developer.

    So I recommend learning Javascript. Once you have a good strong feel for the fundamentals, once you've treated Crockford's "JavaScript: The Good Parts," the same way as you've done with K&R's "The C Programming Language," and you're solid on the basics, THEN jump off into these new worlds of overly pretentious web designers delving into their first languages and claiming you can't write a decent site without coffeescript, haml, and sass. So you can put them in their place, or at least, so you can understand how much they're complicating what is, after all, not that difficult of a thing. Even experienced developers write really, seriously completely awful code with Javascript, thinking they'd doing a decent job because they didn't invest time and energy to understand why they're not.

    The only problem is that Javascript is bad. I like learning by examples, but that is so not the way to go with Javascript. Examples abound - but they're more than likely to be bad examples. There's reference books, like "Javascript: The Definitive Guide," but they're not great for learning. So what I do is tell people to learn jQuery first.

    With jQuery and a few minutes, they can pick up the basics. Someone who already knows CSS or writes code for a living should feel productive in less than a full work day. It's easy, it's fast*, it handles browser differences**, there are well documented examples of how to use each feature on the jQuery doc pages, and best of all for me - it's non intrusive, so you can fit in the new vanilla javascript you're slowly picking up in, without needing to learn any framework specific configurations or magic function naming or guessing why it's not calling a method because it's not been added to the object prototype by your pesudo controller registration.

    For me, I hate frameworks that are all-or-one solutions. Big heavyweight*** frameworks that tell you "This webpage is now a ____ application". First, they never are perfect solutions, and second, they always make some percent easier at the cost of making the rest painful. I think when learning a new language, especially if you've already got one or more under your belt, forcing someone to do it your way, or making familiar patterns or constructs hard is a huge detriment. Besides, how can you expect someone to learn if they're not allowed to get it wrong? You end up with folks who don't understand the importance of things like memory management if they never had to do it, and how useful are they during crunch mode?

    So, yeah. Learn jQuery. Learn dom traversal and manipulation. Learn event registration. Learn AJAX. Try out some animations. Write a plugin or two. Many of these things are appearing in modern browsers now, but once you understand the concept, the basics that are endemic to web development, and you can be productive, then you'll have the grace time needed to properly learn actual Javascript. Then you get out your

  • by b1ng0 ( 7449 )
    Stop! Just stop already! Nobody gives a shit about Dice's clickbait fluff pieces void of content. We know you need to justify Dice's executive management's $1M salaries (http://finance.yahoo.com/q/pr?s=DHX+Profile [yahoo.com]) but this is getting ridiculous and you are alienating your most loyal users.
  • by metamatic ( 202216 ) on Monday June 29, 2015 @05:37PM (#50014821) Homepage Journal

    If you are working on an existing project that has already chosen to use jQuery, then you should learn it.

    Otherwise, I wouldn't bother. Just learn Vanilla JS, and skip jQuery. Your pages will be faster and better.

    jQuery was a useful thing a few years ago, but now that browser standards compliance is so much better it's a big chunk of unnecessary code.

    • by Khyber ( 864651 )

      "browser standards compliance is so much better"

      Not even. Closest one to any sort of compliance is Chrome, which is a multi-process steaming hunk of garbage. It can do HTML5 and WebGL properly.

      FireFox? Trying to log into my in-development game using the web interface, (again, pure HTML5 and WebGL) it fucking horks. What's sad is that IE8 works better for my web game than the latest version of FireFox.

      Opera? Give me a fucking break.

  • jQuery isn't without its controversies

    Huh?

    and some developers distrust its use in larger projects because (some say) it ultimately leads to breakage-prone code that's harder to maintain [jenkov.com].

    This article is less critical of jQuery than the summary led me to believe. It just warns you against two things: (1) a long procedure of code for the ready argument, "The Big Main Method Problem," and (2) DOM-centric code. But neither of these are problems, and neither of them are caused or even encouraged by jQuery.

    After the click-baitish FUD, the summary goes on, saying you might as well use it anyway:

    But given its prevalence, jQuery is probably essential to know [dice.com]

    The phrase "probably essential" is a weird combination of a weak and a strong word, and may be a sig

  • In my perception jQuery has basically become the JavaScript standard library.
    Basically any combination of frontend toolkits has it included somewhere, so you don't even have to worry about doing that. It's the default for Joomla and Wordpress and there are a measurable amount of functions that take care of the gruntwork and normalize utility across browsers.

    On top of that, the amount of JS projects relying on jQuery as a foundation is staggering. The secondary market has tools built around the jQuery ecosystem and the project as a whole does an excellent job at marketing and advocating.

    I personally see the next generation in such avantgarde stuff as Googles Polymer (pretty amazing) but until everyone has moved to SPAs and web components - which is not happening any time soon - but until then it's not the worst idea to familiarize yourself with the concepts and the utility funcitons of jQuery. ... *After* you've learned JS itself properly, that is.

    My 2 cents.

    • Absolutely. I cannot praise the jQuery ecosystem too highly. Coding with it allows you to approach the problem at hand with just the right mix of ease and complexity *and* it scales well.
      We have tried and abandoned many of the larger js frameworks.
      Just my 2c.
  • "some developers distrust its use in larger projects because (some say) it ultimately leads to breakage-prone code that's harder to maintain."

    Most likely because they write shit bloated code in the first place.

    Meanwhile, jQuery + SQLite + MariaDB connector, I've got my own personal intelligent porn recommendation/scraper/indexer site that runs through a few million images and renders my requested search results in under a tenth of a second.

    So odds are, it's those developers talking about breakage-prone code

  • 18 year JS programmer here. Learn JavaScript proper (well) first, then a framework such as Angular.
  • It helps some times, and if you are going to become a good JavaScripter, how much of the effort is really redundant? You'll probably need to learn how to select an element with CSS selectors even if you don't use jQuery. It's clear you eventually won't need jQuery for this, but a) jQuery is a little less verbose b) learning how to use selectors is 90% of learning jQuery.

    Granted, you don't need to learn how to write a jQuery plugin anymore, not that would be difficult to learn anyway. Aside from that, wha

  • jQuery was relevant as a shim for browser compatibility 10 years ago - and even then only for AJAX. Modern browser's DOM API is far more powerful than what pathetic methods jQuery offers. And what jQuery does offer is often broken, deprecated or just shit code. Want to animate something the way the web animated things in the 90's? Use jQuery. Want to use native animation methods that are orders of magnitude more efficient, more featureful and MUCH easier to use? Use the fucking DOM API that comes with
    • You bitch about devs lazily abusing repeated DOM lookups instead of variables, but that is exactly what prompted the Javascript speed war that even resulted in massive improvements on IE. So even if you think it's bad practice, it helped everyone.

  • FYI, check this page source code. You'll find some jQuery code. It's funny how some articles here seem being related to Slashdot's tech...
  • Personally, I find jQuery great as the baseline to support bespoke programming solutions.

    There is a LOT of love for framework over libraries like jQuery, but in my experience most hit up against Dietzler's Law* pretty hard. with frameworks one has to be rock solid in the real browsers stuff AND the framework one chose AND the hacks you had to set up to meet the gap between requirements and the framework sweetspot. (vs bespoke, where it's just the real browser stuff and then straight to the gap ;-)

    *Dietzler'

  • It is only breakage prone if you are bad and use $. Just save yourself a shitload of headaches and type jQuery() instead of $(). Then later when you feel even more hipster you can start duct taping more random.js junk to your project and none of your jQuery code will [most likely] not conflict with them. I won't even touch Javascript without jQuery. It's nice being able to do things like [for].each() with no effort like languages should have natively.

For God's sake, stop researching for a while and begin to think!

Working...