Where can I learn jQuery? Is it worth it?

I know I find OOP useful pretty much solely on a syntactical sugar basis (encapsulation, operator overloading, typechecking). As to the benefits of OOP... I don't know. I don't think it's worse than procedural stuff.

I've had a lot of good experiences learning about web development on w3schools.com. It's hit or miss, I know, but the PHP and CSS sections specifically have proven very useful for reference.

On the lighter side, my OOP lecturer said that OOP is important because otherwise the "code would have too many loops". Yeah. Sometimes it's depressing that I pay $500 per paper. :(

n learning, but I need it to be online/searchable, so I can refer back to it easily when I need the information in the future.

Anyway, I was wondering if there was a similar site for jQuery. I'm interested in learning, but I need it to be online/searchable, so I can refer back to it easily when I need the information in the future.

Also, as a brief aside, is jQuery worth learning? Or should I look at different JavaScript libraries? I know Jeff uses jQuery on Stack Overflow and it seems to be working well.

Also, as a brief aside, is jQuery worth learning? Or should I look at different JavaScript libraries? I know Jeff uses jQuery on Stack Overflow and it seems to be working well.

Thanks!

Thanks!

Edit: jQuery's website has a pretty big list of tutorials, and a seemingly comprehensive documentation page. I haven't had time to go through it all yet, has anyone else had experience with it?

Edit: jQuery's website has a pretty big list of tutorials, and a seemingly comprehensive documentation page. I haven't had time to go through it all yet, has anyone else had experience with it?

Edit 2: It seems Google is now hosting the jQuery libraries. That should give jQuery a pretty big advantage in terms of publicity.

Edit 2: It seems Google is now hosting the jQuery libraries. That should give jQuery a pretty big advantage in terms of publicity.

Also, if everyone uses a single unified aQuery library hosted at the same place, it should get cached for most Internet users early on and therefore not impact the download footprint of your site should you decide to use it.

Also, if everyone uses a single unified aQuery library hosted at the same place, it should get cached for most Internet users early on and therefore not impact the download footprint of your site should you decide to use it.

2 Months Later...

2 Months Later...

Edit 3: I started using jQuery on a project at work recently and it is great to work with! Just wanted to let everyone know that I have concluded it is ABSOLUTELY worth it to learn and use jQuery.

Edit 3: I started using jQuery on a project at work recently and it is great to work with! Just wanted to let everyone know that I have concluded it is ABSOLUTELY worth it to learn and use jQuery.

Also, I learned almost entirely from the Official jQuery documentation and tutorials. It's very straightforward.

Also, I learned almost entirely from the Official jQuery documentation and tutorials. It's very straightforward.

10 Months Later...

10 Months Later...

jQuery is a part of just about every web app I've made since I initially wrote this post. It makes progressive enhancement a breeze, and helps make the code maintainable.

jQuery is a part of just about every web app I've made since I initially wrote this post. It makes progressive enhancement a breeze, and helps make the code maintainable.

Also, all the jQuery plug-ins are an invaluable resource!

Also, all the jQuery plug-ins are an invaluable resource!

3 Years Later...

3 Years Later...

Still using jQuery just about every day. I now author jQuery plug-ins and consult full time. I'm primarily a Djangonaut but I've done several javascript only contracts with jQuery. It's a life saver.

Still using jQuery just about every day. I now author jQuery plug-ins and consult full time. I'm primarily a Djangonaut but I've done several javascript only contracts with jQuery. It's a life saver.

From one jQuery user to another... You should look at templating with jQuery (or underscore -- see below).

From one jQuery user to another... You should look at templating with jQuery (or underscore -- see below).

Other things I've found valuable in addition to jQuery (with estimated portion of projects I use it on):

28757 次浏览

I use Prototype, which I like. I'm afraid I don't know jQuery, so I can't compare them, but I think Prototype is worth checking out. Their API docs are generally pretty good, in my experience (which certainly helps with learnability).

I agree completely with InSciTek Jeff's answer, I'll just add the following refinements:

    ramming language, doesn't require OO features, but doing it will make your code slightly OO-like.
  • Information hiding and encapsulation: Critical for any maintainable code. Can be done by being careful in any programming language, doesn't require OO features, but doing it will make your code slightly OO-like.
  • Inheritance: There is one important application domain for which all those OO is-a-kind-of and contains-a relationships are a perfect fit: Graphical User Interfaces. If you try to build GUIs without OO language support, you will end up building OO-like features anyway, and it's harder and more error-prone without language support. Glade (recently) and X11 Xt (historically) for example.
  • Inheritance: There is one important application domain for which all those OO is-a-kind-of and contains-a relationships are a perfect fit: Graphical User Interfaces. If you try to build GUIs without OO language support, you will end up building OO-like features anyway, and it's harder and more error-prone without language support. Glade (recently) and X11 Xt (historically) for example.
  • Using OO features (especially deeply nested abstract hierarchies), when there is no point, is pointless. But for some application domains, there really is a point.

    I learned it through jQuery in Action (Manning), which I whipped through over a weekend. It's a little bit behind the current state of affairs, especially in regard to plug-ins, but it's a great introduction.

    Reuse shouldn't be a goal of OOP - or any other paradigm for that matter.

    heritance is fundamentally flawed. As you note the LSP violations abound. Instead, OO is properly thought of as a method of managing the complexity of a problem domain. The goal is maintainability of a system over time. The primary tool for achieving this is the separation of public interface from a private implementation. This allows us to have rules like "This should only be modified using ..." enforced by the compiler, rather than code review.

    Reuse is a side-effect of an good design and proper level of abstraction. Code achieves reuse by doing something useful, but not doing so much as to make it inflexible. It does not matter whether the code is OO or not - we reuse what works and is not trivial to do ourselves. That's pragmatism.

    Using this, I'm sure you will agree, allows us to create and maintain hugely complex systems. There is lots of value in that, and it is not easy to do in other paradigms.

    A place where jQuery falls a little flat is with its UI components. Those don't seem to be quite ready for primetime just yet.

    I believe the most beneficial quality of OOP is data hiding/managing. However, there are a LOT of examples where OOP is misused and I think this is where the confusion comes in.

    Just because you can make something into an object does not mean you should. However, if doing so will make your code more organized/easier to read then you definitely should.

    A great practical example where OOP is very helpful is with a "product" class and objects that I use on our website. Since every page is a product, and every product has references to other products, it can get very confusing as to which product the data you have refers to. Is this "strURL" variable the link to the current page, or to the home page, or to the statistics page? Sure you could make all kinds of different variable that refer to the same information, but proCurrentPage->strURL, is much easier to understand (for a developer).

    In addition, attaching functions to those pages is much cleaner. I can do proCurrentPage->CleanCache(); Followed by proDisplayItem->RenderPromo(); If I just called those functions and had it assume the current data was available, who knows what kind of evil would occur. Also, if I had to pass the correct variables into those functions, I am back to the problem of having all kinds of variables for the different products laying around.

    It could be that Prototype or MooTools or ExtJS are as good as jQuery. But for me, jQuery seems to have a little more momentum behind it right now and that counts for something for me.

    Instead, using objects, all my product data and functions are nice and clean and easy to understand.

    Check jQuery out. It is very cool!

    owever. The big problem with OOP is when somebody believes that EVERYTHING should be OOP. This creates a lot of problems. I have 88 tables in my database. I only have about 6 classes, and maybe I should have about 10. I definitely don't need 88 classes. Most of the time directly accessing those tables is perfectly understandable in the circumstances I use it, and OOP would actually make it more difficult/tedious to get to the core functionality of what is occurring.

    However. The big problem with OOP is when somebody believes that EVERYTHING should be OOP. This creates a lot of problems. I have 88 tables in my database. I only have about 6 classes, and maybe I should have about 10. I definitely don't need 88 classes. Most of the time directly accessing those tables is perfectly understandable in the circumstances I use it, and OOP would actually make it more difficult/tedious to get to the core functionality of what is occurring.

    I believe a hybrid model of objects where useful and procedural where practical is the most effective method of coding. It's a shame we have all these religious wars where people advocate using one method at the expense of the others. They are both good, and they both have their place. Most of the time, there are uses for both methods in every larger project (In some smaller projects, a single object, or a few procedures may be all that you need).

    To put some names out there, Prototype, script.aculo.us, Jquery, Dojo, YUI...those all seem to have active users and contributers, so they are probably worth reading up on to see if they meet your needs.

    Jquery is good, but with a little extra effort, maybe you'll find that something else works better for you.

    To me, the value of OOP is to reduce the scope and to separate state from behavior. With smaller scope, code is easier to understand.

    It can be done in most languages, all is needed to achieve this is a way for a state to delegate a method call to a behavior, and a way for a behavior to further delegate the call to a parent behavior.

    Good luck.

    http://visualjquery.com/1.1.2.html. Manning publications also has a great book which is highly recommended called jQuery in Action. As far as JavaScript libraries are concerned, this one and Prototype are probably the most popular if you're looking to compare jQuery to something else.

    OOP lends itself well to programming internal computer structures like GUI "widgets", where for example SelectList and TextBox may be subtypes of Item, which has common methods such as "move" and "resize".

    the right way to do things because they are newer.

    I started learning by looking at jQuery extensions to see how other developers work with the jQuery language. It not only helped me to learn jQuery syntax but also taught me how to develop my own extensions.

    It's so much easier to use and feels a lot more powerful. The plugin support is also great. For almost any common js pattern, there's a plugin that does what you want. With prototype, you'll be googling for blogs that have the snippet of code you need.

    I agree with InSciTek Jeff. Even if you don't use OO in its purest sense, Encapsulation Theory can help reduce potential structural complexity: http://www.edmundkirwan.com

    @ DrPizza

    If procedureal programming uses the benefits of encapsulation to the same degree then good on it!

    A great resource for learning jQuery is: Learning jQuery. The author, Karl Swedberg, also co-wrote the book titled... ready? Yup, Learning jQuery. Remy Sharp also has great info geared towards the visual aspects of jQuery on his blog.

    --SEAN O

    d towards the visual aspects of jQuery on his blog.

    jQuery worths learning!!! I recommend reading "Learning jQuery" and "jQuery in Action". Both books are great with expalanation and examples. The next step is to actually use it to do something. You will find official http://docs.jquery.com docummentation very useful. I use it as a reference, google it all the time :)

    --SEAN O

    Also "Learning jQuery" blog mensioned by Sean is also very useful. Also jQuery HowTo is also has a great collection of jQuery code snippets.

    for solving a specific one, because

    To me, there is a lot of value in the OOP syntax itself. Using objects that attempt to represent real things or data structures is often much more useful than trying to use a bunch of different flat (or "floating") functions to do the same thing with the same data. There is a certain natural "flow" to things with good OOP that just makes more sense to read, write, and maintain long term.

    you don't know what that framework

    It doesn't necessarily matter that an Invoice isn't really an "object" with functions that it can perform itself - the object instance can exist just to perform functions on the data without having to know what type of data is actually there. The function "invoice.toJson()" can be called successfully without having to know what kind of data "invoice" is - the result will be Json, no matter it if comes from a database, XML, CSV, or even another JSON object. With procedural functions, you all the sudden have to know more about your data, and end up with functions like "xmlToJson()", "csvToJson()", "dbToJson()", etc. It eventually becomes a complete mess and a HUGE headache if you ever change the underlying data type.

    should look like.

    I know there's a lot of free resource out there, I guess the difference here is the quality of the content you get. hope it's useful!

    I don't care for reuse as much as I do for readability. The latter means your code is easier to change. That alone is worth in gold in the craft of building software.

    It is a very good book. It also explains the fundamentals of JavaScript required to understand the basics of JQuery.

    http://karticles.com/2011/06/learning-jquery-with-sql-basic-selectors

    http://karticles.com/2011/06/learning-jquery-with-sql-attribute-selectors

    The problem with OOP is that it was oversold.

    as functional programming.

    As Alan Kay originally conceived it, it was a great alternative to the prior practice of having raw data and all-global routines.

    Then some management-consultant types latched onto it and sold it as the messiah of software, and lemming-like, academia and industry tumbled along after it.

    So what would I do differently? Plenty, and I wrote a book on this. (It's out of print - I don't get a cent, but you can still get copies.)Amazon

    Now they are lemming-like tumbling after other good ideas being oversold, such as functional programming.

    My constructive answer is to look at programming not as a way of modeling things in the real world, but as a way of encoding requirements.

    That is very different, and is based on information theory (at a level that anyone can understand). It says that programming can be looked at as a process of defining languages, and skill in doing so is essential for good programming.

    So what would I do differently? Plenty, and I wrote a book on this. (It's out of print - I don't get a cent, but you can still get copies.)Amazon

    It elevates the concept of domain-specific-languages (DSLs). It agrees emphatically with DRY (don't repeat yourself). It gives a big thumbs-up to code generation. It results in software with massively less data structure than is typical for modern applications.

    My constructive answer is to look at programming not as a way of modeling things in the real world, but as a way of encoding requirements.

    It seeks to re-invigorate the idea that the way forward lies in inventiveness, and that even well-accepted ideas should be questioned.