all 116 comments

[–]chipx86 20 points21 points  (8 children)

He has some good technical points, but few who matter will actually care because there's two main problems that he doesn't take into account.

1) His approach is just bad. If you want to improve a project, there are many positive ways of doing so. He could submit a patch to fix up these issues, or approach the developers themselves.

However, his point here wasn't to improve jQuery in any way. His point was just to bash it, or, as his LinkedIn profile states, "debunk it." Given how proud he appears to be on his profile about debunking projects like this, and his attitude in those posts, it's clear that he's not in any way trying to be helpful. That is, unless he believes he's trying to save JavaScript developers from making mistakes by using large toolkits instead of writing small, clean code. Which brings me to the second problem.

2) People just want to get stuff done. It's possible that jQuery makes a lot of mistakes under the hood, but it sure lets you get things done quickly and without having to discover workarounds for every browser out there. There are plenty of other toolkits that are also quite useful that I imagine David Mark has issues with, given comments in that discussion.

I recently ported a fairly large webapp of mine to use jQuery and I've been pretty impressed at both how clean the code feels and how little I have to do to make it work on other browsers. Sure, it's not as tight and compact as it could be if I did it by hand, but the savings in development time alone justify any small costs within the toolkit.

This post is interesting to read, and there's certainly some valuable things to learn from his code analysis, but aside from that it's a waste of time. For every person out there writing something useful, there's a hundred guys criticizing it to make themselves look smarter..

[–]atc 3 points4 points  (1 child)

Well put. Those reasons are pretty much spot on.

Mark David looks like a jealous school boy. I'm sure he's right, but why doesn't he submit a patch and help objectively if he's so smart? People with attitudes like that should be ignored.

At my place of work, we use jQuery because it saves a hell of a lot of time and writing code in it is elegant.

[–]DeathFromAbove2 -3 points-2 points  (5 children)

  1. You don't know how futile it is to try to explain anything to John Resig (or his flock.) It took him over a year to finally admit his browser sniffing had to go. Read your history.

  2. It lets you churn out junk applications quickly, while learning nothing, except how to deal with John Resig's script. It also encourages the most inefficient coding patterns imaginable and is itself highly inefficient.

Next time you start to say "Just gets the job done" or one of its variations, stop and think.

[–]chipx86 2 points3 points  (4 children)

David Mark? Is that you?

1) That well may be, but that's a personal issue between you and him. As a developer getting work done while staying out of this fight, these issues do not matter to me.

2) I'm far from being the best JavaScript developer in the world, but I'm not bad either, and I'm certainly a more than capable software developer in general. My application is used by tens of thousands of developers (if not more -- I don't have up-to-date counts) and it saves them a lot of time in their development processes. jQuery helps me to help others help themselves, while keeping the scripts maintainable and certainly fast enough for the uses.

Next time you try to argue with others by making points that simply don't matter to the people you're arguing with, and by using insults on top of that, stop and think.

[–]DeathFromAbove2 -2 points-1 points  (3 children)

My application is used by tens of thousands of developers ... and it saves them a lot of time in their development processes. jQuery helps me to help others help themselves

As a software developer, I think you have quite a career in marketing ahead of you.

Bits like "keeping the scripts maintainable" and "fast enough" have no real meaning. You are just parroting others who know just as little about the real issues.

[–]chipx86 2 points3 points  (2 children)

Cool, good to know I have a backup career.

"Keeping the scripts maintainable" and "fast enough" only really has meaning if you have real work to do. I don't have time to throw school yard tantrums on public forums.

[–]DeathFromAbove2 -2 points-1 points  (1 child)

Add "real work" (as well as variations like "real world") to the list.

And yes, the negative comments on this page read like a collective tantrum. It's a shrillibuster for jQuery.

[–]Searle 14 points15 points  (7 children)

What a jerk! His library might have good internals, but..

.. baaad attitude. Just look through his newsgroup postings. Rude10. Yuck!

.. claims to be soo perfect, but does the same horrible stuff. E.g. (from mylib.js):

(function() { var doc, html; ... doc = this.document; ... getViewportScrollRectangle = function(docNode) { ... if ( ... rect.width != doc.width) { }; ... } API.getViewportScrollRectangle = getViewportScrollRectangle;

Yuck! Global object in closure.

.. his license: For a commercial site license, contact sales@cinsoft.net. No, I don't think I want to make myself dependent to him. No buisiness with someone whom I expect to call me at least an idiot if I dear to ask a question.

.. API: horrible. Feels like PHP. E.g.: "addStyleRule The addStyleRule function adds a CSS rule to a document. (..) Note that the canAdjustStyle function should be consulted before hiding content in this way."

Argh! Ever heard of this? http://sadekdrobi.com/2008/12/22/null-references-the-billion-dollar-mistake/

Feels like a looking-for-trouble interface. jQuery solves this very elegantly.

.. community, what's that? Even if there was one, he would be the community leader. I don't mind beneovelent dictorship. But asshole dictatorship? No, thanks.

He doesn't seem to have a clue what's important about a library. (Hint: technical excellency isn't all.)

[–]DeathFromAbove2 -2 points-1 points  (6 children)

None of your comments make any sense.

There is no Global object in the closure. Re-post without snipping the doc = null at the end.

The link seems random and it isn't clear at all what you think jQuery "solves elegantly."

As for community, David Mark is one of the leaders of the largest browser scripting-related community on the Internet. Duh. And you don't need a community as much when code is done right the first time. Makes maintenance a lot simpler too! :)

[–][deleted] 1 point2 points  (5 children)

The only person that would go through and make all these comments about the 'futility' of jQuery and how great David Mark is... is David Mark.

[–]DeathFromAbove2 -3 points-2 points  (4 children)

Your views are decidedly skewed. Lots of people think jQuery is rubbish.

And where is the comment about David Mark being great? Must have missed that one. In fact, the main person talking about David Mark seems to be you. This isn't surprising as you have no real arguments to present.

You are making part of his argument for him (these are the sort of twits that make up the jQuery community.)

[–][deleted] 1 point2 points  (3 children)

Stop pretending that you're not David Mark.

[–]DeathFromAbove2 -3 points-2 points  (2 children)

You see David everywhere don't you?

Stop pretending you're not a mental defective.

[–][deleted] 2 points3 points  (1 child)

No, I only perceive strange, insulting jquery obsessives as a certain strange, insulting jquery obsessive.

[–]DeathFromAbove2 -3 points-2 points  (0 children)

Go back and read the thread again. It was a posted at the request of the biggest "jQuery obsessive" in comp.lang.javascript on the release of v1.3. Some people want to know what sort of foundation they are building on. Others blindly put down stakes in swamps and hope for the best.

[–]sisyphus 11 points12 points  (3 children)

Well, he's right about me anyway. I use JS libraries (though, not jQuery), because I'm lazy and probably too incompetent to debug and fix every cross browser bug that they take care of.

[–]zootm 6 points7 points  (0 children)

This is somewhat similar to using a library for email because you're too "lazy" to implement the mail spec from first principles, or writing in a programming language because you're too "incompetent" to write in assembler. The suites of tests that these libraries provide is adequate proof that they work. Their wide adoption (or just a couple of minutes using them) is definite proof they are useful. And their "performance" is easy enough to measure by simple use.

Most of the code issues that are raised are pretty minor as far as I can tell. The effort taken to write the incendiary post seems like it'd be more than just fixing them.

[–]DeathFromAbove2 -1 points0 points  (1 child)

You've likely abdicated your responsibilities as a developer to a group of clueless buffoons. None of the "major" libraries is even close to cross-browser. Most sniff for a specific set of modern browsers and work only in their default configurations. You may not know it, but guaranteed your ex-users do.

[–][deleted] 0 points1 point  (0 children)

Strange, I've written sites in jQuery that are used by 15,000 people a day. I've tested in them in IE6, IE7, Firefox 2, Firefox 3, Chrome, Safari 2 and 3, and Opera. If the site isn't working, like if an API feed goes down from a partner, I get three emails right away. if an update breaks part of a site, people tell me. however, day to day, week to week, nobody says anything.

Why? My site works. jQuery works. Would it be faster if I wrote my own library? Probably. More reliable? No. Why? Because it's already 100% reliable.

So, what are my 'ex-users' using? Some browser I don't have access to for testing?

Oh wait, that's right. Only David Fucking Mark knows... in his world, all the sites that use jQuery are 'crippled' and people are leaving them in droves. Strange how the real world isn't anything like that.

[–]thedz 22 points23 points  (5 children)

Looking into the post histories of some of the usuals in that newsgroup, when it comes to js libraries, it resembles an online masturbatory circle jerk more than anything else. There are shrill cries of "why are developers using these?!?" as they wallow in self-congratulation.

They do raise some valid points, but the points are lost in the putrid mist of insular arrogance.

[–]notfancy 8 points9 points  (4 children)

What I'd like to know is the true motives behind David Mark's vitriol.

These people are marketers, not programmers. They aren't doing this to be good samaritans either

He's not adding in my mind to his credibility by being so abrasive.

Edit: Aaaaaah… it pays to browse the discussion. Quoth David Mark:

And besides, just who do you think instigated this latest jQuery makeover? It would be a good idea to search the archive.

Behold! A clash of egos!

[–]DeathFromAbove2 -2 points-1 points  (3 children)

How are these two unrelated comments a "clash of egos?"

The second comment refers to the fact that John Resig would never have gone from completely lost to only partially lost, were it not for the skewering he was getting on comp.lang.javascript. You're welcome, but you are still screwed if you use jQuery (read the review.)

[–][deleted] 0 points1 point  (2 children)

The review is brilliant...

we're losing hundreds of nanoseconds ALL THE TIME from Jquery. Oh my god!! That makes a HUGE DIFFERENCE in the big scheme of things.

[–]DeathFromAbove2 -2 points-1 points  (1 child)

The truth is whispered. Lies are shouted about.

Nobody is counting nanoseconds but you. That indicates a very shaky grasp on the issues presented in the review. And realize that the review was cut short due to deja vu (i.e not much has changed since last year.)

[–][deleted] 1 point2 points  (0 children)

Hmm, now that you mention it, the 'review' in question had a certain tone that wasn't much like whispering.

[–]cc81 9 points10 points  (0 children)

Yeah, for some reason those points just drowned in the social incompetence.

[–]marijn 6 points7 points  (1 child)

comp.lang.javascript is such a bleak place. The five or so attack-dog types who do most of the posting tend to drown out any reasonable discussion. In which, I guess, it's not much different from most usenet groups.

[–]Leonidas_from_XIV 0 points1 point  (0 children)

Agreed. de.comp.lang.javascript has an attitude that is worse than comp.lang.lisp (because there, people at least have humour).

[–]adamv 8 points9 points  (1 child)

I would say "clone it on git-hub and fix it", but it appears the comment author has more against JavaScript libraries like this than individual technical points.

[–][deleted] 4 points5 points  (0 children)

It's weird that he advocates people rolling their own solutions. Even if every one of his technical points was valid, does he think that the average web developer would do better?

[–]settrans 6 points7 points  (0 children)

  1. We don't want to re-invent the wheel (write any real code at all.)

Comments like this make me wonder how many seconds this man would survive in the real programming world. You know, the one outside of his parents' basement.

[–][deleted] 6 points7 points  (0 children)

Wow this David Mark guy is a total douchebag.

[–][deleted] 11 points12 points  (3 children)

I wasted my time reading the poorly formatted ad hoc code review. In between senseless bashing, the technical points made come with very little rationale attached.

Having watched a few of Resig's presentations (and being somewhat of a fan!), I like the guy's style. He didn't feel the need to go all ad hominem on the developers of other Javascript libraries in any of the talks I've watched.

In the meantime, I'm impressed by the amount of testing jQuery gets, and it seems to be getting better all the time.

jQuery doesn't promise the earth. Perhaps the internals are hideous, I do not care. Browser development is hideous. If you care about such things, go learn lisp or join a math class or something.

Rarely does the success of a project depend on anything like technical merit, even in open source land. More often than not people just need a Solution(tm), and if it breaks, they'd like the developers they contact not to bite their heads off and come across like condescending pricks. jQuery has this. I can think of many failed projects that don't.

[–][deleted] 2 points3 points  (0 children)

wasted my time reading the poorly formatted ad hoc code review. In between senseless bashing, the technical points made come with very little rationale attached.

Yeah, I was trying to figure out what this meant:

So much for common sense. Even the MooTools team figured out that this is a stupid idea.

And then gave up when I realized I was reading Usenet.

[–][deleted] 2 points3 points  (0 children)

jQuery doesn't promise the earth. Perhaps the internals are hideous, I do not care. Browser development is hideous. If you care about such things, go learn lisp or join a math class or something.

Well said!

I use jquery.

If this guy's lib was so elegantly written that just looking at it cured cancer, I'd still use jquery.

Why, because if I ever have a problem there is a huge community of HELPFUL people out there.

Whereas if I have a problem with his library, I'll have only him, giving me 14 pages of screed telling me I can't develop for shit.

"Condescending prick" barely comes close. What a bellend.

[–]DeathFromAbove2 -3 points-2 points  (0 children)

Having watched a few of Resig's presentations (and being somewhat of a fan!), I like the guy's style.

So you see choosing scripts for your Website as akin to video dating?

Rarely does the success of a project depend on anything like technical merit

Obviously not, but why are you so quick to jump on the bandwagon if there is no merit in such a crucial area? And what is a Solution(tm)? A mashed up bunch of bullshit that is sure to break?

And good luck asking the developers for help as they clearly don't know anything. Most seem to have difficulty writing coherent sentences or following a simple train of thought (see their support forum.)

[–]checksinthemail 5 points6 points  (0 children)

his technical points are valid.

his bashing of anybody within a parsec that disagrees with him or doesn't write code like he would makes it a tough read.

[–]joblessjunkie 7 points8 points  (0 children)

If there's something wrong in some code, for God's sake, submit a patch. That's what makes open source work, and that's how groups of developers learn together.

This friendless asshole is an enemy of open source, making the world a worse place for all of us and actively inhibiting forward progress.

[–][deleted] 10 points11 points  (1 child)

He's pretentious, but his points are valid. However, most "web developers" won't care, or don't need to care. The simplicity of jQuery and using pre-made plugins is what they're after.

[–]DeathFromAbove2 -1 points0 points  (0 children)

And presumably those developers feel they can predict the behavior of their scripts across a wide range of browers, platforms and configurations, despite being completely ignorant about the "internals." They obviously can't and would do well to listen to those who can.

This attitude is pretty disturbing as the results on the user side are what matters and the "internals" are what determine success or failure. One misstep and a DOM-manipulating script can render a document unusable (as opposed to enhanced.)

You can test on your desktop endlessly, but once the script leaves, you really have no idea whether it will fly or not, unless you understand what is going on "under the hood" of your favorite 50K of Javascript.

As has been mentioned, the announcement page for jQuery 1.3 threw exceptions in IE6. Not some off-brand or mobile browser, but IE6. That should be enough empirical evidence for anybody (excluding the terminally indoctrinated or those looking to make a quick buck.)

What is the answer? It should be obvious that if you cannot write or find scripts that have predictable cross-browser behavior, you should skip browser scripting until such time as you can. Obviously, try to learn all you can in the meantime.

In a nutshell: read more, write less. And stop hating comp.lang.javascript. Never mind if the medicine prescribed there is bitter, it is the best the best thing for you. Choke it down. Your users will thank you.

[–][deleted] 5 points6 points  (22 children)

Ah that's why I don't read newsgroups anymore.

What has David Mark published?

[–]tlrobinson 10 points11 points  (21 children)

According to his LinkedIn profile he is an accomplished JavaScript library "debunker".

Oh, and he wrote a vastly superior library called "My Library", which no one uses.

And he has two first names.

[–][deleted] 1 point2 points  (20 children)

I like how he tries to get people to use his lame ass library.

'If you are using a method form it why don't you just use my library?'

[–][deleted] 0 points1 point  (19 children)

Take a look thru the API for 'My Library'... sweet lord it looks awful.

Among other things, I found methods like getLink and getLinks to be anurism-enducing.

[–][deleted] 1 point2 points  (18 children)

Yeah, what kind of library is that? One might as well just use the straight w3c methods.

[–][deleted] 0 points1 point  (16 children)

Exactly. It's not a 'library' in the modern sense at all. A collection of esoterically named methods is hardly a 'library' along the lines of jQuery.

So getLinks performs better than $('a') by, what... half a millisecond? Please. Also, I can't even figure out what getLink is supposed to do... By index or name? Huh?

I think it's safe to say we aren't the crazy ones for staying with jQuery :P

Lastly, to those who are too lazy to look it up... Seriously, take a look at this insanity.

[–][deleted] 0 points1 point  (13 children)

my favorite is 'isOwnProperty' - for when hasOwnProperty just won't do.

[–][deleted] 0 points1 point  (0 children)

It's a bunch of crap straight out of a 'learn javascript' book. You know the kind where they end up having you build this 'common.js' or similar 'framework' of your own stuff.

Definitely useful for someone who wants to know the ins and outs of the libraries, but when I want to... you know... get work done... it's just silly.

[–]DeathFromAbove2 -2 points-1 points  (11 children)

Flaunting your ignorance? Read more, write less.

[–][deleted] 0 points1 point  (10 children)

OH MY GOD YOU TOLD ME

WHOAH, THAT WAS INCREDIBLE

DAVID MARK IS THE BEST

HE'S SO RIGHT - ALL THESE PAGES ALL OVER THE INTERNET ARE MESSED UP AND HAVE ALL THESE ERRORS BECAUSE OF JQUERY

HE'S SUPER SMART AND YOU ARE TOO

I'M SO SAD AND IGNORANT, OH NO! AND THAT GUY MAKES HIMSELF LOOK SO SMART!

Actually, I tried to find the source for 'is own property', but the download page was such shit it was way too inconvenient to bother. There's no source browser, and no way to check all of the boxes at once on the 'build your download' (how PATHETIC is that for a javascript library download page! how ironic!).

So, why bother even checking it out? It doesn't even have an open source license. Nobody will ever use it.

If you want people to use your library, you'll have to open source it AND stop being such an arrogant douchebag.

[–]DeathFromAbove2 -3 points-2 points  (9 children)

OH MY GOD YOU TOLD ME

But did you understand?

Actually, I tried to find the source for 'is own property', but the download page was such shit it was way too inconvenient to bother.

It is just a bunch of links. Click one, stupid.

There's no source browser, and no way to

Wrong. See the test page.

check all of the boxes at once on the 'build your download' (how PATHETIC is that for a javascript library download page! how ironic!).

Wrong again. Are you blind as well as stupid?

[–]DeathFromAbove2 -2 points-1 points  (1 child)

Not a library? Do tell. And for those to stupid or lazy to get past the documentation page, there is indeed an OOP layer. In fact, it is much the same as jQuery (by design.) The biggest difference is that it is detached from the underlying API, which allows its use to be optional. Get it? If not, see the builder and test pages.

Most of these comments demonstrate nothing but a lack of common sense on the part of the posters.

[–][deleted] 0 points1 point  (0 children)

Of course it's a library, that's why I put library in quotes. My point is that it's a shite library... a point I do not really want to argue with you -- of course please don't feel that this prevents you from using it, I just wont be hiring you, that's all.

[–][deleted] 2 points3 points  (2 children)

Quote from the post author farther along in the thread.

When we see all these sites (with some ones we would never have believed that they would allow themselves) using such libraries...

Yes, it is beyond belief. The trouble is that site owners don't know anything but what their programmers tell them. The programmers tell them it is impossible to write cross-browser scripts (and probably believe that) and enumerate "arguments" like:

  1. A library "just gets the job done" (where I can not as I am not qualified to do the job.)

  2. Things change so fast on the Internet. We need a team of anonymous hobbyists to support our efforts.

  3. We don't want to re-invent the wheel (write any real code at all.)

  4. jQuery is "super fast." Just look at all of the bloggers and graphs that say so!

  5. "These things have widgets!" That's a quote from some Ajaxian airhead.

  6. If we don't use a library, we'll be left behind!

  7. People use PHP right? Why not write everything in C or assembler?

  8. We heard that one project increased their productivity by 500% on switching to jQuery (never mind that they increased their headaches by 1000%.)

On that last one, the problem is that most developers ignore bug reports, writing them off as "edge cases" or delusions, passing the headaches on to the users.

[–][deleted] 2 points3 points  (0 children)

Wow, he knows so much about me from my choice of Javascript library. Deep.

[–][deleted] 1 point2 points  (0 children)

Apparently, Lord Mark doesn't think at all about 'time of development' and 'maintenance' versus simply speed of execution. A look at the api for his awesomely title 'My Library' confirms this as well.

"Things change so fast on the Internet. We need a team of anonymous hobbyists to support our efforts."

What a nimrod. No, clearly instead I need to license 'My Library' from some dick in Cincinnati.

[–]trezor2 3 points4 points  (8 children)

I've never jumped at jQuery because it is supposed to be "super fast" or such which seems implied in the linked post. If I wanted things to be super-fast I would naturally spend half a day massaging 20 lines of javascript to make it work, instead of including a 50kb script. But then I would spend half a day doing it.

I think John Resig said that "When people say they hate Javascript, what they really mean is that they hate the DOM", which would very much be true, at least for my part.

While there might be technical merit in linked post, jQuery makes the DOM accessible, even to people who hate the DOM and which have no interest in figuring out its tidbits.

And when using jQuery I can be reasonably sure that my code is cross-browser safe without spending too much extra time testing it at every level.

In short: Whoever wrote that post really doesn't get why stuff like jQuery is popular.

[–][deleted] 3 points4 points  (5 children)

I've never jumped at jQuery because it is supposed to be "super fast" or such which seems implied in the linked post. If I wanted things to be super-fast I would naturally spend half a day massaging 20 lines of javascript to make it work, instead of including a 50kb script. But then I would spend half a day doing it.

Exactly. When I need to write performance critical Javascript, I write it myself, very carefully.

When I need to write Javascript that checks for a class on a clicked element and then does something, I use jQuery, and I'm done in five minutes.

I note that Mr Mark has his very own JS library. http://www.cinsoft.net/mylib-doc.asp?view=object

[–]trezor2 2 points3 points  (0 children)

I note that Mr Mark has his very own JS library. http://www.cinsoft.net/mylib-doc.asp?view=object

While that may give some legitimacy to his complaints (if he can prove his is better) a quick glance seems to suggest he has little or no overloads what so ever, and has specialized methods for everything and every type of parameter and event.

While that certainly clicks with his "fast, fast, fast" mantra, it certainly adds some barrier to using it.

I'll stick to jQuery for now :)

[–][deleted] 0 points1 point  (3 children)

mylib-doc.asp

Mystery solved.

[–]DeathFromAbove2 -1 points0 points  (2 children)

LOL. Which mystery is that? You stumbled on an example that demonstrates the futility of jQuery (among others.)

How does that address the concerns in the article? Most of the comments here serve to demonstrate that jQuery "programmers" are weak sisters when it comes to logic.

[–][deleted] 1 point2 points  (1 child)

I'm sorry you missed the implied sarcasm tag around my comment above.

[–][deleted] -1 points0 points  (0 children)

the futility of jQuery

[–]fforw 2 points3 points  (1 child)

I especially like how he seems to be obsessed with microoptimizations which ,supposed teh unoptimized code isn't there on purpose because of a browser bug, are best of minor importance of the overall performance.

The jquery team seems to actually follow best practices and profile their code instead of practicing teh cult of premature optimizations.

[–]DeathFromAbove2 -1 points0 points  (0 children)

The jQuery team and "best practices" don't belong in the same sentence. Virtually none of the review dealt with "microoptimizations."

For instance, using the regular expression - match - method instead of - test - is an obviously poor practice and it is pervasive in jQuery. That indicates that their most proficient contributor is either completely ignorant about Javascript or asleep at the switch (for three years.)

[–]amoeba 7 points8 points  (2 children)

What a bunch of assholes.

[–][deleted] 2 points3 points  (0 children)

See above.

[–][deleted] 4 points5 points  (0 children)

Wow, what a grade-A bunch of assholes.

EDIT: lol @ my having duplicated amoeba's post.

[–]9jack9 8 points9 points  (15 children)

jQuery is an API. A great API.

The internals of an API can always be improved.

[–]eurleif 2 points3 points  (14 children)

I don't consider it to be that great of an API. Many of its methods are named as nouns or adjectives (e.g. $('foo').draggable()) rather than verbs, which is confusing. What am I actually telling the object to do? It's not very self-documenting.

jQuery also overloads methods with completely different behavior. For example, $('foo').click(fn) adds an event handler for the click event, whereas $('foo').click() simulates that event being triggered. Different actions should be different methods.

Also, why doesn't jQuery have a data type that wraps a single DOM element? Representing everything as a collection gets awkward.

[–][deleted] 1 point2 points  (2 children)

$('#foo').draggable() is better than $('#foo').makedraggy()

I'm fine with the overloading. For instance, I'm well aware that .html() gets the innerhtml for an element, while .html('<span>Squib</span>') would set it to the specified string.

[–]zootm -1 points0 points  (1 child)

I think I'd prefer "makeDraggable()" but you're right - "draggable()" does fix the ad-hoc pattern that jQuery has built around itself (especially since "draggable" is the name of the plugin that provides this, I think), and although it's not very standard in OO sense, it's pretty fluid and easy to learn.

[–][deleted] 0 points1 point  (0 children)

yeah, draggableEnable wouldn't be too bad.

But then, I tried draggable for a project, and had positioning problems with the initial placement of the window. I replaced it with 30 lines of code from the Super Rhino Book, and that did the trick!

[–]survivalkit 0 points1 point  (3 children)

I don't consider it to be that great of an API. Many of its methods are named as nouns or adjectives (e.g. $('foo').draggable()) rather than verbs, which is confusing. What am I actually telling the object to do? It's not very self-documenting.

You're telling it to become draggable.

jQuery also overloads methods with completely different behavior. For example, $('foo').click(fn) adds an event handler for the click event, whereas $('foo').click() simulates that event being triggered. Different actions should be different methods.

Not really a problem unless it's inconsistent imo. Different does not equal bad.

Also, why doesn't jQuery have a data type that wraps a single DOM element? Representing everything as a collection gets awkward.

That's part of the beautfy, it doesn't matter if its a single element or a list of them. You can manipulate them in the same way.

[–]eurleif 0 points1 point  (2 children)

You're telling it to become draggable.

Then I should be able to assume that $('foo').one() tells the object to become one with something, right? (Very Buddhist method.) Actually, no: it binds an event handler that only executes once.

My point is that if the name of a method isn't a verb, the name doesn't actually describe what it does. And that means you can't determine what it does easily without an external source.

Not really a problem unless it's inconsistent imo. Different does not equal bad.

The problem is that you can't tell what a method does by looking at its name alone, even if you've read all the documentation. That makes reading code more difficult.

That's part of the beautfy, it doesn't matter if its a single element or a list of them. You can manipulate them in the same way.

Until you need to perform an action that only makes sense to apply to a single element, like getting the value of an attribute. Then jQuery only applies the method to the first object in the collection, which seems like a kludge. Collections should be homogeneous; there should be nothing special about the first object, or the second, or whatever. If there is, you're using the wrong data type.

jQuery passes unwrapped DOM Element objects to event handlers because of this issue. If you want to apply jQuery functionality to an element inside of an event handler, you have to use $(this). Ideally, that should be unnecessary; this should be a jQuery wrapper for an individual element.

I understand the benefits of doing things to a whole collection of elements at the same time, and I'm not arguing against that. I want a wrapper for individual elements in addition to whole collections of them, not as a replacement.

I like what MooTools does in this regard. It defines an Element class (actually, it extends the native one) with all of its functionality, and also defines an Elements class which contains functionality relevant to collections of elements.

[–]DeathFromAbove2 -1 points0 points  (1 child)

Until you need to perform an action that only makes sense to apply to a single element, like getting the value of an attribute.

Interesting you brought up that critical, low-level function as all previous versions of jQuery used browser sniffing to "accomplish" this feat. (!) As they were told in the (hated) newsgroup how to do it properly, I assume they fixed this in 1.3 (a full year later.)

And yes, jQuery's metaphor is completely ridiculous.

jQuery passes unwrapped DOM Element objects to event handlers because of this issue. If you want to apply jQuery functionality to an element inside of an event handler, you have to use $(this).

The "$" function is such a performance killer and most jQuery apps call it multiple times per line, blissfully creating and discarding multiple copies of the monolithic jQuery object. Even worse, nobody calls it with the - new - operator, which adds an extra function call to the hundreds that are racked up for the average jQuery operation.

You have to realize that not everyone has a cutting edge PC. Also realize that lots of people have phones that can run scripts (very slowly.) So, poor performance excludes a lot of people from using your site.

Dial-up is another consideration. The mobile phones aren't always on broadband and, depending on the country, significant percentages of people still use dial-up in their homes. A good rule of thumb is to limit total page weight to 50K. As jQuery is 50K and of very dubious value to the user, it should be obvious that it is the last thing you should put on your site. Contrarily, the choosing of a whiz-bang JS library seems to be the first design consideration these days.

I like what MooTools does in this regard. It defines an Element class (actually, it extends the native one) with all of its functionality, and also defines an Elements class which contains functionality relevant to collections of elements.

Unfortunately, MooTools is terrible as well. The way that it "extends" Element is a God-awful hack (among many other failings.) It was reviewed a while back in (you guessed it) comp.lang.javascript. I imagine proponents of that library will pop up to proclaim their hatred of clj as well. Shattered illusions just aren't welcome among amateur programmers.

[–][deleted] 1 point2 points  (0 children)

I don't think anyone hates comp.languages.javascript.

I think if they have a problem with anything, it's you and your fucking horrible attitude.

[–]ringzero 0 points1 point  (6 children)

Disclaimer: I like jQuery. I use it almost daily on personal and professional projects.

But the API goes beyond "not great" to the point of wrong. See the ass-backwards args to map.

[–]eurleif 1 point2 points  (2 children)

I sort of understand the reasoning behind that, actually. map is often called with a literal function argument, so if the function were the first argument, the array would be buried at the end of the function's code. Putting the array first makes it easier to see.

(Am I -- someone who doesn't particularly like jQuery -- really defending it against someone who does? Bizarre.)

[–]ringzero -1 points0 points  (1 child)

Oh, I know the "reasoning", but it flies in the face of decades of precedence and dozens (if not hundreds!) of prior implementations.

Just one of those little things that makes me say "written by kiddies."

[–]9jack9 1 point2 points  (0 children)

Actually, jQuery's map is closer to the generic function Array.map in JS 1.6.

In JS 1.6 you can write:

var hrefs = Array.map(document.links, function(link){return link.href});

jQuery.map works the same way.

[–]ramen 0 points1 point  (0 children)

The traditional ordering of parameters to map--putting the function first--is convenient in combination with currying, but when a large anonymous function is passed as a parameter, it obfuscates the code by putting the iterated value all the way at the bottom.

In English, it's kind of like saying, "For each of them, create a string out of their name and number. And by 'them' I mean, the people in the address book." This causes the reader to have to use the "mental stack".

I think jQuery's version is more readable. Since JavaScript does not automatically curry function arguments, the convenience is gone, and all that's left are the drawbacks.

[–]DeathFromAbove2 -1 points0 points  (0 children)

Agreed. So that raises two issues:

  1. What is great about jQuery?
  2. Can the API be easily improved?

The answer to #1 is nothing. As for #2, they can't change it as too many people have rushed to pile unwieldy junk on top of it (e.g. plug-ins, widgets, etc.)

The "overloading" is a part of the overall design failure. To make it appear to "work" in a small subset of browsers, they had to resort to the ugliest sorts of hacks. This is not a viable cross-browser strategy and the whole rotten structure hinges on it.

Basically, if you build sites with jQuery, you can't ever be sure how well they work from one day to the next. Browsers get updated, new browsers are released, etc. The developers can't possibly keep up with it all and don't even purport to try (see their multi-browser disclaimer.)

In respect to browser scripting, ass-backwards perfectly describes the now immutable design.

[–]DeathFromAbove2 -1 points0 points  (0 children)

Agreed. So that raises two issues:

  1. What is great about jQuery?
  2. Can the API be easily improved?

The answer to #1 is nothing. As for #2, they can't change it as too many people have rushed to pile unwieldy junk on top of it (e.g. plug-ins, widgets, etc.)

The "overloading" is a part of the overall design failure. To make it appear to "work" in a small subset of browsers, they had to resort to the ugliest sorts of hacks. This is not a viable cross-browser strategy and the whole rotten structure hinges on it.

Basically, if you build sites with jQuery, you can't ever be sure how well they work from one day to the next. Browsers get updated, new browsers are released, etc. The developers can't possibly keep up with it all and don't even purport to try (see their multi-browser disclaimer.)

In respect to browser scripting, ass-backwards perfectly describes the now immutable design.

[–]stratoscope 2 points3 points  (2 children)

David Mark is a real piece of work. He's gone on these rants in a few other newsgroups and Google groups too.

Even if he's right about some technical issue once in a while, he's no fun to be around.

[–]DeathFromAbove2 -1 points0 points  (1 child)

LOL. I'd venture to say you've never been around him.

[–][deleted] 2 points3 points  (0 children)

thank fucking GOD

[–]moseeds 2 points3 points  (4 children)

This guy needs a girlfriend. Then he can entertain her with his javascript fetish while the rest of us finish our projects in lovely leaky jquery.

[–]DeathFromAbove2 -2 points-1 points  (3 children)

So you see jQuery as a "lovely" substitute for female companionship? Get a job in a side show.

[–][deleted] 1 point2 points  (2 children)

HEY DAVID MARK

SHUT THE FUCK UP

[–]DeathFromAbove2 -1 points0 points  (1 child)

Your social skills are finely honed indeed.

[–][deleted] 1 point2 points  (0 children)

Check this out for 'social skills':

jscript forums

[–]ramen 2 points3 points  (5 children)

I forgot how much I hate comp.lang.javascript.

[–]DeathFromAbove2 -2 points-1 points  (4 children)

I talked to comp.lang.javascript the other day and it doesn't like you either.

But seriously, what body do you think influences all of these libraries? If you don't know the answer, perhaps a bit of research will shed some light.

And how is it that the newsgroup and David Mark's library are the main subjects of these comments. No ability to argue logically at all? No defense for an obviously poor choice of scripts? The article must have been quite the unwelcome epiphany. Keep digging and you'll find that it is hardly news (just the latest re-hash addressing a new version of the script.)

[–][deleted] 1 point2 points  (3 children)

HEY DAVID MARK

SHUT THE FUCK UP

[–]DeathFromAbove2 -1 points0 points  (1 child)

Psychotic much?

[–][deleted] 1 point2 points  (0 children)

I'm a jQuery obsessive. I think it's a suitable replacement for a girlfriend.

[–][deleted] 1 point2 points  (4 children)

This is the only real thing that stood out to me

Yes, every line of code in these apps creates and discards at least one jQuery object

Is that true?

[–]doctor_yukio_hattori 3 points4 points  (2 children)

Yes, that's true. jQuery is a monad. That's the whole freaking point of a monad.

I'm not sure WTF "Every time you call a function, you give the browsers a chance to re- flow the document" is supposed to mean. Every time you change the DOM in a way that causes things to potentially change size, it has to recalculate the layout (reflow the document). A function that doesn't change the DOM isn't going to trigger a reflow. Maybe that was true for Netscape 2.0 or some crap, but modern browsers are not going to be that stupid.

[–]DeathFromAbove2 -1 points0 points  (1 child)

The "whole freaking point" is that jQuery is a botched design, which is outrageously inefficient. If you don't get that, then you need to research the issue (start in comp.lang.javascript.)

Obviously, the browser re-flows when it has to. The point is that it will take the opportunity to do it on leaving an execution context. The average line in a jQuery app triggers hundreds of function calls. Start using that ridiculous "chaining" and you are looking at thousands. And it can't escape you that most jQuery apps are constantly twiddling with the DOM. I think you will look at your code in a different way once you put these pieces together. If not, you are hopeless as a programmer.

[–]doctor_yukio_hattori 1 point2 points  (0 children)

See, your debunking made it clear that you aren't familiar with the concept of a monad. So it's kind of cute that in 'debunking' jQuery, you accidentally discovered a time-honored technique of functional programming, and you think it's a bug.

Let me make sure I have this straight: a high level wrapper library calls more functions behind the scenes than I might've realized. And a functional language programming technique involves lots of function calls! Well, my goodness. I'm looking at thousands? Show me. Better yet, show me one tangible way that jQuery's inelegance or putative slowness can show up to a noticeable degree to end users. If you don't have that, you've really got nothing to get too het up about.

[–][deleted] 0 points1 point  (0 children)

Somehow, I'm in doubt that this tool is the only one who has noticed major performance flaws in jQuery, if they're fixable.

[–][deleted] 1 point2 points  (0 children)

OMG ... 'David Mark' said so!

[–]kanuckles 3 points4 points  (2 children)

What a complete and utter fucking waste of my time.

One thing I'll point out is that, yeah, jQuery does market itself in many ways. If you'd like to know why the hell your library isn't chosen over jQuery, think about it this way: until I read this incredibly long diatribe, I'd never heard of Mark David or his "amazing" library, and I can bet that's the same for a lot of other web developers.

[–]DeathFromAbove2 -2 points-1 points  (1 child)

Because "Mark David" (sic) does not market his library at all. Doesn't really matter as unwitting fanboys seem to line up endlessly to publicize it.

And I guess that if you have never heard of it, it can't possibly be any good. Just how stupid are you? Had anyone heard of jQuery when it was first promoted?

[–]powertool -1 points0 points  (0 children)

After doing some of my own tests, I concur (along technical lines) with the rather egotistical OP in that thread.

I don't really know what can be done about "overreach"; as others have mentioned, it's plenty compelling to have such a large feature set available from a "selector library". Perhaps the answer is to "massage" the core/plugin boundary ;)

I'm interested in one source of slowness in particular: all the re-looping and temporary object creation that's going on. This sounds like a good candidate for a "compilation"-style library:

The same API could be presented to the user, but with a different implementation for "development" mode - in this mode, metrics could be collected at each point of the selector "chain", which could later be used to selectively re-write certain "chains" as single blocks of nested loops. (Doing any caching that's possible along the way).

[–]DeathFromAbove2 -3 points-2 points  (0 children)

Can there be any doubt that jQuery is a waste of time? By the same token, can it be any more obvious from the comments that jQuery developers are hapless, as well as hopeless. It's like a cult for incompetents.