Joose Niemi said:
Gregor Kofler wrote:
I don't understand why some people feel the need to needlessly
bash jQuery every time it gets mentioned here.
If something can be validly criticised then understanding that criticism
can be very valuable (for everyone involved).
jQuery is a *great* tool to simplify things which
Any 'simplification' that may follow from the use of JQuery is only
superficial simplification. Under the hood what JQuery does with the
simplest function call is extremely complex and involved. And this
superficial simplification masking internal convolutions still happens
when the things being programmed at the top level are actually extremely
simple.
would be tedious at best with pure javascript.
Not really. The alternatives in javascript authoring are not using some
else's pre-written library or writing thousands of individual statements
each time you need to do something. Code re-use, OO design and moving
repetitive activities into parameterised function/method calls
absolutely normal activities in javascript authoring. And by the time
someone has gone through the effort of learning browser scripting the
odds are that they will have written (and understood) a huge resource of
re-usable code.
That leaves the people favouring JQuery and the like being the
individuals who have never learnt browser scripting for themselves, and
do not want to try. And for them JQuery does give then the ability to
(at least superficially) do a job for which they are not qualified, and
usually to a degree that is not easy for the casual observer (the client
(at first), or non-technical management) to notice. Some (indeed many)
will be satisfied with that, but it is not a particularly 'professional'
attitude.
After learning javascript as a language, and then browser scripting as a
discipline, the last hurdle is learning to design scripted browser
systems. For each project (of any sort) there is something (or some set
of things) that is to be achieved, and the 'professional' designer's job
is to design a system that best achieves that 'something'. Ultimately
the ability to do that job well is dependent upon an accumulation of
knowledge, understanding and experience. With sufficient of each it is
possible to perceive the possibilities available and plot the course
thought them that has (as near as practical) the optimum outcome.
While an individual who knows nothing but JQuery will plonk JQuery into
a project before anything else even gets considered, and so will never
achieve anything other than what JQuery can achieve. In many cases that
may not be critical, and in more it may go unnoticed (so an e-commerce
site that has been 'designed' out of 20% of its turnover may never
notice that that has happened because they have never had the
opportunity to operate at full potential, or a web application that has
had its potential growth prematurely capped may be developed for a
number of years before it reaches that cap).
But beyond the issue of a script author's ability to design the best
system for the client, the JQuery jockey faces the problems that come
with relying on others to facilitate everything that they may ever want
to do. Faced with the situation of not having any code available for a
particular task someone who has learnt browser scripting can write what
they need from scratch, while someone who can only use pre-existing code
written by others just cannot deliver.
And even when pre-existing 'plugins' do exist the individual who has
chosen superficial simplicity over understanding has no basis for
judging the quality of that code (its efficiency, effectiveness or the
ramifications of employing it in any particular design context). There
is, for example, a 'table sorting' plugin for JQuery in which there are
many uses of - replace - method of strings that have an application of
the - new - operator to the RegExp constructor as its first argument,
where the argument to the constructor is an regular expression literal.
That is just insane code. Nobody who knew what they were doing would
write such a thing, and there are no shortage of people who could tell
you why doing it is stupid (and doubly stupid in IE) and even which
misconception about javascript might result in the table sorter's author
employing such a mystical incantation construct (and the correct
approach to use instead). But the people who use it are never likely to
even know it is there.
It lowers the bar of creating usable JavaScript-applications
and while you seem to think it's a bad thing I really can't
see what's the harm in that.
Ask an e-commerce client if they want a significant proportion of their
potential turnover designed out at stage one and see what they say.
Sure, it may be fun to create your own functions and
librarys, some might say re-inventing the wheel, but I really can't
see that work being productive in
a business sense.
Employing people who have never learnt to do the job they are being pied
for is not necessarily productive in a business sense (at least for
business that are not interested in ripping-off their clients).
And if the code quality behing jQuery isn't that great,
There is no "if" about it.
which I'm not saying it isn't, then so what?
So everything that is built on it will never (and could never) be of any
higher quality than JQuery itself.
It doesn't even really matter to me if and *when* it
takes care of the browser differences in a reliable way and makes
JavaScript actually fun.
JQuery does not "take care of the browser differences". It barely
functions with the default configurations of 4 web browsers, and will
behave chaotically whenever it encounters anything else.
I really do not care about the arguments I've read in
this newsgroup where some have been scrutinizing jQuerys
source code line by line.
Haven forbid anyone should base their judgments on the code itself.
Belief, hype and blind prejudice are so much more appropriate criteria
for judging javascript code. ;-)
I'm sure there are some parts in every JavaScript
code, even in your own, where people could jump in
and point out potential problems.
If there is one thing that is true it is that on comp.lang.javascirpt if
code that is posted could be subject to reasonable criticism it will be
subject to that criticism. Any prolonged engagement in that process
tends to produce script authors for whom little or no further criticism
is necessary (it goes from questions of errors/mistakes/misconceptions
to the more subjective realms of style and design, and takes between 6
months and a year).
But it is hardly an reason for not criticising a script that is littered
with errors, stupid constructs and pedestrian design, to be pointing out
that other scripts also may contain errors.
Heck, pointing out other peoples errors isn't that difficult.
It is not that difficult to point out errors where they exist.
On the contrary. Critical peer review is one of the most effective
teaching/learning aids in programming. How could anyone learn from the
mistakes they did not recognise they were making unless someone else
pointed them out?
Besides jQuery is getting better and faster after each release
"Better" is largely a matter of opinion. If the design has fundamental
flaws that are manifest in its API then they can never be corrected
without abandoning back-compatibility (and squandering any time that
anyone has devoted to learning the existing API). Given its starting
point (and the internal inefficiencies) it is difficult to see how it
could not get faster with changes, but judgments of 'fast' have to be
made in comparison to something else (not just its previous versions).
and if and when there are bugs they will be fixed
- it's that simple.
Well, you say that but John Resig directly replied to one set of
criticisms his code received on this group and the faulty/irrational
code is still in the latest version 6 months later.
If you are really unable to see the benefit of using jQuery
Who said anyone cannot see the benefits? The problem is that we can also
see the drawbacks, and judge them as having the greater significance.
- well, then I guess each of us makes decisions based
on different merits,
Of course.
but it still doesn't make jQuery "crap" even if you
don't like it.
Saying that it is "crap" does not make it crap, any more than saying
that it "fast" and "cross-browser" makes it fast or cross-browser, but
saying why it is crap (or at least enumerating its may faults) is a much
more objective activity.
All of you who don't really know what this is even about -
don't just eat up the beliefs of some of the regulars but
check out jQuery to make up your own mind -
http://jquery.org.
And most especially apply an understanding of javascript as a language,
and browser scripting as discipline to an examination of the code inside
JQuery. Everything it there to be seen by anyone capable of recognising
it.
Richard.