In the past, I seem to remember you weighting the benefits of using
jQuery heavier almost to the point of advocating it was a good idea to
use jQuery. Am I remembering incorrectly or have your opinions of
jQuery deteriorated over time?
My opinion of jQuery has deteriorated, yes. I don't care so much about
the attr() problems that DM repeatedly points out, but other things
worried me more.
For example, the response to the selectedIndex discussion really
highlighted the skewed perspective the core developers have when
trying to solve problems "correctly".
Also, I'm seeing more and more people write things "the jQuery way"
and ending up with extremely inefficient code. I've spent too much
time going back and un-jquery-ifying code to speed it up.
Finally, the recent discussion about jquery's xhr implementation kind
of blew me away:
http://groups.google.com/group/jquery-dev/browse_frm/thread/5e63ab0adf17aabc
I hadn't really questioned why jQuery polled the ajax response rather
than triggering based on state changes, but I assumed they had some
reason. At least it still worked. It turns out that they just didn't
know how to fix a memory leak in IE. And when it was pointed out, he
initially made a change that showed he really didn't understand scope
chains and how leaks are created. And in the second issue in the
thread, his quick fixes to the logic were incorrect and needed to be
pointed out. I'm not sure he really grasped what was needed or how to
construct the logical tests. Yet he was very hasty in making fixes and
committing them into the source. Sure seems like development on a
whim. No wonder they release so many versions, and always have quick
minor updates after big releases to patch the holes.
Finally finally, they keep changing the API, removing methods, adding
methods, etc. Seemingly at random, depending on their latest design
ideas. It's a big moving target that wanders around as they get
flashes of inspiration about things that were done well and documented
years ago.
What are you using when jQuery is not a good fit?
I am using more and more of my own code, which is a bummer. It's more
robust and faster, but it takes longer to create and it doesn't get as
much testing as a public, open-source library that is heavily used
across the web would get. Javascript is a very minor part of what I
do, so I can't focus on doing it the way I really would like.
But having said all that, I want to say again that I still use jQuery
and recommend it.
These criticisms are really coming from very experienced js developers
who understand all the fine points of the language and implementation.
jQuery is a good product for the common Joe Coder, but it will _never_
meet the standards of those who are the true wizards of the language.
I don't expect it to.
jQuery is good for simple stuff, grabbing elements by selectors, doing
things like hiding and showing and animating, etc. That's what I
mostly use it for, and that's what I recommend it for. I never
recommend writing complex interfaces "in jQuery". I may fall back to
its selector engine, and I may add my own methods that are optimized
to do what I want, but I don't use the UI components or almost any of
the 3rd-party plugins. I don't do things "the jQuery way". I don't
focus on writing dense code but instead code that is logical and easy
to read and understand.
jQuery is javascript for the masses. And it's great for that, IMO.
Once you progress beyond that and learn more, you will naturally see
its flaws. Then you'll move to something else. Which is great! jQuery
is the first step for most people. Without it, they may not move up at
all. It serves its purpose, even if imperfect.
Matt Kruse