I’m still learning jQuery, but the more I use jQuery, the more it appears that it is procedural rather than object-oriented. For example, I don’t think I have seen or used any jQuery classes although I’m sure there are some used internally. All I do is method chaining, instead of constructing objects myself. e.g new Foo(). Also, the jQuery documentation for plug-in development does not even mention classes.
Is my observation correct that jQuery encourages you to expose only functions and methods and keep any custom classes internal when writing jQuery-based libraries? I’m not talking about writing jQuery plug-ins, but custom libraries that are unique to each application.
I’m coming from Java, so I’m kind of confused here.
jQuery is mainly just a layer over the DOM API, coupled with some convenience methods like
each()for iteration and enumeration. It smooths out a bit of what some may consider to be clunkiness in DOM API, and what most certainly is a lack of consistency across implementations.It isn’t a framework, and it isn’t a language. It’s really just there to give a better experience than the DOM API provides.
It utilizes the OOP features found in javascript, but it itself provides no specific programming paradigm. There are other libraries like
prototypejsandunderscorethat are more focused in that area.