jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by Mitchell Waite-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


What do you guys think of this critique of jQuery I found on Simon
Willison's site (which is good reading).

http://simonwillison.net/2007/Aug/15/jquery/

<quote>
jQuery is definitely a popular utility function library, but the sheer
amount of dual/triple/quadruple special-case uses for both function
calls and method names is an instant turnoff for me.

The jQuery object itself can perform a selector query, embed a DOM
element, create a DOM element from HTML and assign a DOMContentReady
event handler - and probably more. Event handling is separated into
separate methods for each event type. Some method names make no
immediate sense, like .one or .eq, and you can't immediately tell if a
method acts on the first element in the collection or all of them.

I can't recommend jQuery to the developers I am mentoring because it
is in itself a completely separate abstraction, and a muddy one at
that. They will end up having to learn jQuery instead of having to
learn DOM, CSS and JS, and when being considered as a direct
replacement for those it fails both due to complexity and
inconsistency."

</quote>

Mitch


Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by John Resig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I don't understand this argument at all. So this guy is proposing that
we change all the jQuery methods to:

$Array([array of elems])
$Selector("str")
$HTML("html")
$Element(DOMElement)

and:

.appendElement(DOMElement)
.appendHTML("html")
.appendArray([array of elems])

what on earth does that gain you? What's the purpose of using a
language that can overload arguments and not actually using that
feature? What's the advantage of increasing the size of your API
4-fold?

Incredibly weak argument, obviously someone who's never used the library.

> Some method names make no
> immediate sense, like .one or .eq, and you can't immediately tell if a
> method acts on the first element in the collection or all of them.

These arguments are slightly more valid. Although .eq() is going away
in 1.2. I really don't know what to say, in this case it was simply a
design decision. We could've had:
.val() (return nothing, do nothing useful)
.val("val") (set value)
.getVal() (get value)
.getVal("val") (return nothing, do nothing useful)

But why have a state of a method perform nothing useful at all? Why
not overload it to actually do something? Why double the size of the
effective API with half-useful functions?

--John

On 8/16/07, Mitch <goofy167@...> wrote:

>
> What do you guys think of this critique of jQuery I found on Simon
> Willison's site (which is good reading).
>
> http://simonwillison.net/2007/Aug/15/jquery/
>
> <quote>
> jQuery is definitely a popular utility function library, but the sheer
> amount of dual/triple/quadruple special-case uses for both function
> calls and method names is an instant turnoff for me.
>
> The jQuery object itself can perform a selector query, embed a DOM
> element, create a DOM element from HTML and assign a DOMContentReady
> event handler - and probably more. Event handling is separated into
> separate methods for each event type. Some method names make no
> immediate sense, like .one or .eq, and you can't immediately tell if a
> method acts on the first element in the collection or all of them.
>
> I can't recommend jQuery to the developers I am mentoring because it
> is in itself a completely separate abstraction, and a muddy one at
> that. They will end up having to learn jQuery instead of having to
> learn DOM, CSS and JS, and when being considered as a direct
> replacement for those it fails both due to complexity and
> inconsistency."
>
> </quote>
>
> Mitch
>
>

Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by Stephan Beal-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Aug 16, 7:39 pm, Mitch <goofy...@...> wrote:
> <quote>
> jQuery is definitely a popular utility function library, but the sheer
> amount of dual/triple/quadruple special-case uses for both function
> calls and method names is an instant turnoff for me.

This also turns me off to some degree. The main problem i have is that
jQuery(...) can take so many different argument types. In fact,
jQuery(function(){...}) as a shortcut for $(document).ready(function()
{...}) bugs me the most.

> immediate sense, like .one or .eq, and you can't immediately tell if a
> method acts on the first element in the collection or all of them.

i agree that gt(), lt(), eq(), get(), etc, could/should have been more
verbosely named. Shortcuts like lt, gt, etc. may be familiar to people
who use the Unix shell (test 4 -lt 3), but they're simply opaque to
anyone else.

> I can't recommend jQuery to the developers I am mentoring because it
> is in itself a completely separate abstraction

An interesting point - don't recommend jQ IF the point of your work is
teaching JavaScript.

>, and a muddy one at
> that.

Probably over-stated.

> They will end up having to learn jQuery instead of having to
> learn DOM, CSS and JS, and when being considered as a direct
> replacement for those it fails both due to complexity and
> inconsistency."

Again, over-stated.

Summary:

The author has apparently let a couple of relatively minor details get
on his nerves, to the point that he can no longer reconcile his
feelings. i can relate to this - i hate/despise/refuse to use Python
because whitespace is significant in that language (and whitespace
should rarely, if ever, be significant), and its completely naive
approach to implementing package-private data. Technosophically
speaking, i simply cannot excuse those failings of the language, and
refuse to learn it on those grouds. Simon Willison apparently has a
similar hang-up about jQuery. And, like i am in my hate-hate
relationship with Python, he's in the minority.



Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by Andy Matthews-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


John...

To be fair...it's very easy to learn the basics of jQuery, but it's quite a
lot of work and time to learn the really cool stuff. I've never used eq() or
if() and those other because I simply don't understand what they do. I'm
sure some of them could improve my code dramatically but I don't even know
WHEN I might use them, so I don't know when to look for them. Does that
makes sense?

andy

-----Original Message-----
From: jquery-en@... [mailto:jquery-en@...] On
Behalf Of John Resig
Sent: Thursday, August 16, 2007 12:53 PM
To: jquery-en@...
Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case
uses for both function calls and method names


I don't understand this argument at all. So this guy is proposing that we
change all the jQuery methods to:

$Array([array of elems])
$Selector("str")
$HTML("html")
$Element(DOMElement)

and:

.appendElement(DOMElement)
.appendHTML("html")
.appendArray([array of elems])

what on earth does that gain you? What's the purpose of using a language
that can overload arguments and not actually using that feature? What's the
advantage of increasing the size of your API 4-fold?

Incredibly weak argument, obviously someone who's never used the library.

> Some method names make no
> immediate sense, like .one or .eq, and you can't immediately tell if a
> method acts on the first element in the collection or all of them.

These arguments are slightly more valid. Although .eq() is going away in
1.2. I really don't know what to say, in this case it was simply a design
decision. We could've had:
.val() (return nothing, do nothing useful)
.val("val") (set value)
.getVal() (get value)
.getVal("val") (return nothing, do nothing useful)

But why have a state of a method perform nothing useful at all? Why not
overload it to actually do something? Why double the size of the effective
API with half-useful functions?

--John

On 8/16/07, Mitch <goofy167@...> wrote:

>
> What do you guys think of this critique of jQuery I found on Simon
> Willison's site (which is good reading).
>
> http://simonwillison.net/2007/Aug/15/jquery/
>
> <quote>
> jQuery is definitely a popular utility function library, but the sheer
> amount of dual/triple/quadruple special-case uses for both function
> calls and method names is an instant turnoff for me.
>
> The jQuery object itself can perform a selector query, embed a DOM
> element, create a DOM element from HTML and assign a DOMContentReady
> event handler - and probably more. Event handling is separated into
> separate methods for each event type. Some method names make no
> immediate sense, like .one or .eq, and you can't immediately tell if a
> method acts on the first element in the collection or all of them.
>
> I can't recommend jQuery to the developers I am mentoring because it
> is in itself a completely separate abstraction, and a muddy one at
> that. They will end up having to learn jQuery instead of having to
> learn DOM, CSS and JS, and when being considered as a direct
> replacement for those it fails both due to complexity and
> inconsistency."
>
> </quote>
>
> Mitch
>
>



Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by John Resig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Sure, that makes sense - and it's obviously difficult. I think the
burden may lie on us to write better examples - although, it's hard to
think of ones that aren't complex that also aren't contrived.

At this point, I look for fringe cases in jQuery where, simply, a
plugin is unable to duplicate functionality (or where a plugin would
be hugely bloated, where the result in core would be quite simple,
instead).

That being said, I'm still advancing the library with some fun methods
like .andSelf() whose uses won't become commonly apparent until far
down the line.

--John

On 8/16/07, Andy Matthews <lists@...> wrote:

>
> John...
>
> To be fair...it's very easy to learn the basics of jQuery, but it's quite a
> lot of work and time to learn the really cool stuff. I've never used eq() or
> if() and those other because I simply don't understand what they do. I'm
> sure some of them could improve my code dramatically but I don't even know
> WHEN I might use them, so I don't know when to look for them. Does that
> makes sense?
>
> andy
>
> -----Original Message-----
> From: jquery-en@... [mailto:jquery-en@...] On
> Behalf Of John Resig
> Sent: Thursday, August 16, 2007 12:53 PM
> To: jquery-en@...
> Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case
> uses for both function calls and method names
>
>
> I don't understand this argument at all. So this guy is proposing that we
> change all the jQuery methods to:
>
> $Array([array of elems])
> $Selector("str")
> $HTML("html")
> $Element(DOMElement)
>
> and:
>
> .appendElement(DOMElement)
> .appendHTML("html")
> .appendArray([array of elems])
>
> what on earth does that gain you? What's the purpose of using a language
> that can overload arguments and not actually using that feature? What's the
> advantage of increasing the size of your API 4-fold?
>
> Incredibly weak argument, obviously someone who's never used the library.
>
> > Some method names make no
> > immediate sense, like .one or .eq, and you can't immediately tell if a
> > method acts on the first element in the collection or all of them.
>
> These arguments are slightly more valid. Although .eq() is going away in
> 1.2. I really don't know what to say, in this case it was simply a design
> decision. We could've had:
> .val() (return nothing, do nothing useful)
> .val("val") (set value)
> .getVal() (get value)
> .getVal("val") (return nothing, do nothing useful)
>
> But why have a state of a method perform nothing useful at all? Why not
> overload it to actually do something? Why double the size of the effective
> API with half-useful functions?
>
> --John
>
> On 8/16/07, Mitch <goofy167@...> wrote:
> >
> > What do you guys think of this critique of jQuery I found on Simon
> > Willison's site (which is good reading).
> >
> > http://simonwillison.net/2007/Aug/15/jquery/
> >
> > <quote>
> > jQuery is definitely a popular utility function library, but the sheer
> > amount of dual/triple/quadruple special-case uses for both function
> > calls and method names is an instant turnoff for me.
> >
> > The jQuery object itself can perform a selector query, embed a DOM
> > element, create a DOM element from HTML and assign a DOMContentReady
> > event handler - and probably more. Event handling is separated into
> > separate methods for each event type. Some method names make no
> > immediate sense, like .one or .eq, and you can't immediately tell if a
> > method acts on the first element in the collection or all of them.
> >
> > I can't recommend jQuery to the developers I am mentoring because it
> > is in itself a completely separate abstraction, and a muddy one at
> > that. They will end up having to learn jQuery instead of having to
> > learn DOM, CSS and JS, and when being considered as a direct
> > replacement for those it fails both due to complexity and
> > inconsistency."
> >
> > </quote>
> >
> > Mitch
> >
> >
>
>
>

Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by Andy Matthews-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


John...

I should have added on to my OP. Better examples are really what is needed,
not changes to the language. Let me read through and see possible RW
examples of eq() or is() and let me say "hey I did that very thing last
week, but with 10 more lines of code)".

andy

-----Original Message-----
From: jquery-en@... [mailto:jquery-en@...] On
Behalf Of John Resig
Sent: Thursday, August 16, 2007 1:48 PM
To: jquery-en@...
Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case
uses for both function calls and method names


Sure, that makes sense - and it's obviously difficult. I think the burden
may lie on us to write better examples - although, it's hard to think of
ones that aren't complex that also aren't contrived.

At this point, I look for fringe cases in jQuery where, simply, a plugin is
unable to duplicate functionality (or where a plugin would be hugely
bloated, where the result in core would be quite simple, instead).

That being said, I'm still advancing the library with some fun methods like
.andSelf() whose uses won't become commonly apparent until far down the
line.

--John

On 8/16/07, Andy Matthews <lists@...> wrote:

>
> John...
>
> To be fair...it's very easy to learn the basics of jQuery, but it's
> quite a lot of work and time to learn the really cool stuff. I've
> never used eq() or
> if() and those other because I simply don't understand what they do.
> I'm sure some of them could improve my code dramatically but I don't
> even know WHEN I might use them, so I don't know when to look for
> them. Does that makes sense?
>
> andy
>
> -----Original Message-----
> From: jquery-en@... [mailto:jquery-en@...]
> On Behalf Of John Resig
> Sent: Thursday, August 16, 2007 12:53 PM
> To: jquery-en@...
> Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple
> special-case uses for both function calls and method names
>
>
> I don't understand this argument at all. So this guy is proposing that
> we change all the jQuery methods to:
>
> $Array([array of elems])
> $Selector("str")
> $HTML("html")
> $Element(DOMElement)
>
> and:
>
> .appendElement(DOMElement)
> .appendHTML("html")
> .appendArray([array of elems])
>
> what on earth does that gain you? What's the purpose of using a
> language that can overload arguments and not actually using that
> feature? What's the advantage of increasing the size of your API 4-fold?
>
> Incredibly weak argument, obviously someone who's never used the library.
>
> > Some method names make no
> > immediate sense, like .one or .eq, and you can't immediately tell if
> > a method acts on the first element in the collection or all of them.
>
> These arguments are slightly more valid. Although .eq() is going away
> in 1.2. I really don't know what to say, in this case it was simply a
> design decision. We could've had:
> .val() (return nothing, do nothing useful)
> .val("val") (set value)
> .getVal() (get value)
> .getVal("val") (return nothing, do nothing useful)
>
> But why have a state of a method perform nothing useful at all? Why
> not overload it to actually do something? Why double the size of the
> effective API with half-useful functions?
>
> --John
>
> On 8/16/07, Mitch <goofy167@...> wrote:
> >
> > What do you guys think of this critique of jQuery I found on Simon
> > Willison's site (which is good reading).
> >
> > http://simonwillison.net/2007/Aug/15/jquery/
> >
> > <quote>
> > jQuery is definitely a popular utility function library, but the
> > sheer amount of dual/triple/quadruple special-case uses for both
> > function calls and method names is an instant turnoff for me.
> >
> > The jQuery object itself can perform a selector query, embed a DOM
> > element, create a DOM element from HTML and assign a DOMContentReady
> > event handler - and probably more. Event handling is separated into
> > separate methods for each event type. Some method names make no
> > immediate sense, like .one or .eq, and you can't immediately tell if
> > a method acts on the first element in the collection or all of them.
> >
> > I can't recommend jQuery to the developers I am mentoring because it
> > is in itself a completely separate abstraction, and a muddy one at
> > that. They will end up having to learn jQuery instead of having to
> > learn DOM, CSS and JS, and when being considered as a direct
> > replacement for those it fails both due to complexity and
> > inconsistency."
> >
> > </quote>
> >
> > Mitch
> >
> >
>
>
>



Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by John Resig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


That'd be excellent - thanks!

--John

On 8/16/07, Andy Matthews <lists@...> wrote:

>
> John...
>
> I should have added on to my OP. Better examples are really what is needed,
> not changes to the language. Let me read through and see possible RW
> examples of eq() or is() and let me say "hey I did that very thing last
> week, but with 10 more lines of code)".
>
> andy
>
> -----Original Message-----
> From: jquery-en@... [mailto:jquery-en@...] On
> Behalf Of John Resig
> Sent: Thursday, August 16, 2007 1:48 PM
> To: jquery-en@...
> Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case
> uses for both function calls and method names
>
>
> Sure, that makes sense - and it's obviously difficult. I think the burden
> may lie on us to write better examples - although, it's hard to think of
> ones that aren't complex that also aren't contrived.
>
> At this point, I look for fringe cases in jQuery where, simply, a plugin is
> unable to duplicate functionality (or where a plugin would be hugely
> bloated, where the result in core would be quite simple, instead).
>
> That being said, I'm still advancing the library with some fun methods like
> .andSelf() whose uses won't become commonly apparent until far down the
> line.
>
> --John
>
> On 8/16/07, Andy Matthews <lists@...> wrote:
> >
> > John...
> >
> > To be fair...it's very easy to learn the basics of jQuery, but it's
> > quite a lot of work and time to learn the really cool stuff. I've
> > never used eq() or
> > if() and those other because I simply don't understand what they do.
> > I'm sure some of them could improve my code dramatically but I don't
> > even know WHEN I might use them, so I don't know when to look for
> > them. Does that makes sense?
> >
> > andy
> >
> > -----Original Message-----
> > From: jquery-en@... [mailto:jquery-en@...]
> > On Behalf Of John Resig
> > Sent: Thursday, August 16, 2007 12:53 PM
> > To: jquery-en@...
> > Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple
> > special-case uses for both function calls and method names
> >
> >
> > I don't understand this argument at all. So this guy is proposing that
> > we change all the jQuery methods to:
> >
> > $Array([array of elems])
> > $Selector("str")
> > $HTML("html")
> > $Element(DOMElement)
> >
> > and:
> >
> > .appendElement(DOMElement)
> > .appendHTML("html")
> > .appendArray([array of elems])
> >
> > what on earth does that gain you? What's the purpose of using a
> > language that can overload arguments and not actually using that
> > feature? What's the advantage of increasing the size of your API 4-fold?
> >
> > Incredibly weak argument, obviously someone who's never used the library.
> >
> > > Some method names make no
> > > immediate sense, like .one or .eq, and you can't immediately tell if
> > > a method acts on the first element in the collection or all of them.
> >
> > These arguments are slightly more valid. Although .eq() is going away
> > in 1.2. I really don't know what to say, in this case it was simply a
> > design decision. We could've had:
> > .val() (return nothing, do nothing useful)
> > .val("val") (set value)
> > .getVal() (get value)
> > .getVal("val") (return nothing, do nothing useful)
> >
> > But why have a state of a method perform nothing useful at all? Why
> > not overload it to actually do something? Why double the size of the
> > effective API with half-useful functions?
> >
> > --John
> >
> > On 8/16/07, Mitch <goofy167@...> wrote:
> > >
> > > What do you guys think of this critique of jQuery I found on Simon
> > > Willison's site (which is good reading).
> > >
> > > http://simonwillison.net/2007/Aug/15/jquery/
> > >
> > > <quote>
> > > jQuery is definitely a popular utility function library, but the
> > > sheer amount of dual/triple/quadruple special-case uses for both
> > > function calls and method names is an instant turnoff for me.
> > >
> > > The jQuery object itself can perform a selector query, embed a DOM
> > > element, create a DOM element from HTML and assign a DOMContentReady
> > > event handler - and probably more. Event handling is separated into
> > > separate methods for each event type. Some method names make no
> > > immediate sense, like .one or .eq, and you can't immediately tell if
> > > a method acts on the first element in the collection or all of them.
> > >
> > > I can't recommend jQuery to the developers I am mentoring because it
> > > is in itself a completely separate abstraction, and a muddy one at
> > > that. They will end up having to learn jQuery instead of having to
> > > learn DOM, CSS and JS, and when being considered as a direct
> > > replacement for those it fails both due to complexity and
> > > inconsistency."
> > >
> > > </quote>
> > >
> > > Mitch
> > >
> > >
> >
> >
> >
>
>
>

Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by Karl Swedberg-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andy, 

I realize these are contrived examples, but if you're interested in seeing what those selectors/traversal methods (e.g. :lt or .lt() ) can be used for, here are a few links that might be helpful:


http://book.learningjquery.com/3810_03_code/traversing.html


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Aug 16, 2007, at 3:02 PM, Andy Matthews wrote:


John...

I should have added on to my OP. Better examples are really what is needed,
not changes to the language. Let me read through and see possible RW
examples of eq() or is() and let me say "hey I did that very thing last
week, but with 10 more lines of code)".

andy 

-----Original Message-----
From: jquery-en@... [mailto:jquery-en@...] On
Behalf Of John Resig
Sent: Thursday, August 16, 2007 1:48 PM
Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case
uses for both function calls and method names


Sure, that makes sense - and it's obviously difficult. I think the burden
may lie on us to write better examples - although, it's hard to think of
ones that aren't complex that also aren't contrived.

At this point, I look for fringe cases in jQuery where, simply, a plugin is
unable to duplicate functionality (or where a plugin would be hugely
bloated, where the result in core would be quite simple, instead).

That being said, I'm still advancing the library with some fun methods like
.andSelf() whose uses won't become commonly apparent until far down the
line.

--John

On 8/16/07, Andy Matthews <lists@...> wrote:

John...

To be fair...it's very easy to learn the basics of jQuery, but it's 
quite a lot of work and time to learn the really cool stuff. I've 
never used eq() or
if() and those other because I simply don't understand what they do. 
I'm sure some of them could improve my code dramatically but I don't 
even know WHEN I might use them, so I don't know when to look for 
them. Does that makes sense?

andy

-----Original Message-----
From: jquery-en@... [mailto:jquery-en@...] 
On Behalf Of John Resig
Sent: Thursday, August 16, 2007 12:53 PM
Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple 
special-case uses for both function calls and method names


I don't understand this argument at all. So this guy is proposing that 
we change all the jQuery methods to:

$Array([array of elems])
$Selector("str")
$HTML("html")
$Element(DOMElement)

and:

.appendElement(DOMElement)
.appendHTML("html")
.appendArray([array of elems])

what on earth does that gain you? What's the purpose of using a 
language that can overload arguments and not actually using that 
feature? What's the advantage of increasing the size of your API 4-fold?

Incredibly weak argument, obviously someone who's never used the library.

Some method names make no
immediate sense, like .one or .eq, and you can't immediately tell if 
a method acts on the first element in the collection or all of them.

These arguments are slightly more valid. Although .eq() is going away 
in 1.2. I really don't know what to say, in this case it was simply a 
design decision. We could've had:
.val() (return nothing, do nothing useful)
.val("val") (set value)
.getVal() (get value)
.getVal("val") (return nothing, do nothing useful)

But why have a state of a method perform nothing useful at all? Why 
not overload it to actually do something? Why double the size of the 
effective API with half-useful functions?

--John

On 8/16/07, Mitch <goofy167@...> wrote:

What do you guys think of this critique of jQuery I found on Simon 
Willison's site (which is good reading).

http://simonwillison.net/2007/Aug/15/jquery/

<quote>
jQuery is definitely a popular utility function library, but the 
sheer amount of dual/triple/quadruple special-case uses for both 
function calls and method names is an instant turnoff for me.

The jQuery object itself can perform a selector query, embed a DOM 
element, create a DOM element from HTML and assign a DOMContentReady 
event handler - and probably more. Event handling is separated into 
separate methods for each event type. Some method names make no 
immediate sense, like .one or .eq, and you can't immediately tell if 
a method acts on the first element in the collection or all of them.

I can't recommend jQuery to the developers I am mentoring because it 
is in itself a completely separate abstraction, and a muddy one at 
that. They will end up having to learn jQuery instead of having to 
learn DOM, CSS and JS, and when being considered as a direct 
replacement for those it fails both due to complexity and 
inconsistency."

</quote>

Mitch









Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by Andy Matthews-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Karl...
 
Where would be the best place for my company to purchase your book so that you will get the maximum benefit?


From: jquery-en@... [mailto:jquery-en@...] On Behalf Of Karl Swedberg
Sent: Thursday, August 16, 2007 2:15 PM
To: jquery-en@...
Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

Andy,

I realize these are contrived examples, but if you're interested in seeing what those selectors/traversal methods (e.g. :lt or .lt() ) can be used for, here are a few links that might be helpful:


http://book.learningjquery.com/3810_03_code/traversing.html


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Aug 16, 2007, at 3:02 PM, Andy Matthews wrote:


John...

I should have added on to my OP. Better examples are really what is needed,
not changes to the language. Let me read through and see possible RW
examples of eq() or is() and let me say "hey I did that very thing last
week, but with 10 more lines of code)".

andy

-----Original Message-----
From: jquery-en@... [mailto:jquery-en@...] On
Behalf Of John Resig
Sent: Thursday, August 16, 2007 1:48 PM
Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple special-case
uses for both function calls and method names


Sure, that makes sense - and it's obviously difficult. I think the burden
may lie on us to write better examples - although, it's hard to think of
ones that aren't complex that also aren't contrived.

At this point, I look for fringe cases in jQuery where, simply, a plugin is
unable to duplicate functionality (or where a plugin would be hugely
bloated, where the result in core would be quite simple, instead).

That being said, I'm still advancing the library with some fun methods like
.andSelf() whose uses won't become commonly apparent until far down the
line.

--John

On 8/16/07, Andy Matthews <lists@...> wrote:

John...

To be fair...it's very easy to learn the basics of jQuery, but it's
quite a lot of work and time to learn the really cool stuff. I've
never used eq() or
if() and those other because I simply don't understand what they do.
I'm sure some of them could improve my code dramatically but I don't
even know WHEN I might use them, so I don't know when to look for
them. Does that makes sense?

andy

-----Original Message-----
On Behalf Of John Resig
Sent: Thursday, August 16, 2007 12:53 PM
Subject: [jQuery] Re: jQuery negatives: dual/triple/quadruple
special-case uses for both function calls and method names


I don't understand this argument at all. So this guy is proposing that
we change all the jQuery methods to:

$Array([array of elems])
$Selector("str")
$HTML("html")
$Element(DOMElement)

and:

.appendElement(DOMElement)
.appendHTML("html")
.appendArray([array of elems])

what on earth does that gain you? What's the purpose of using a
language that can overload arguments and not actually using that
feature? What's the advantage of increasing the size of your API 4-fold?

Incredibly weak argument, obviously someone who's never used the library.

Some method names make no
immediate sense, like .one or .eq, and you can't immediately tell if
a method acts on the first element in the collection or all of them.

These arguments are slightly more valid. Although .eq() is going away
in 1.2. I really don't know what to say, in this case it was simply a
design decision. We could've had:
.val() (return nothing, do nothing useful)
.val("val") (set value)
.getVal() (get value)
.getVal("val") (return nothing, do nothing useful)

But why have a state of a method perform nothing useful at all? Why
not overload it to actually do something? Why double the size of the
effective API with half-useful functions?

--John

On 8/16/07, Mitch <goofy167@...> wrote:

What do you guys think of this critique of jQuery I found on Simon
Willison's site (which is good reading).

http://simonwillison.net/2007/Aug/15/jquery/

<quote>
jQuery is definitely a popular utility function library, but the
sheer amount of dual/triple/quadruple special-case uses for both
function calls and method names is an instant turnoff for me.

The jQuery object itself can perform a selector query, embed a DOM
element, create a DOM element from HTML and assign a DOMContentReady
event handler - and probably more. Event handling is separated into
separate methods for each event type. Some method names make no
immediate sense, like .one or .eq, and you can't immediately tell if
a method acts on the first element in the collection or all of them.

I can't recommend jQuery to the developers I am mentoring because it
is in itself a completely separate abstraction, and a muddy one at
that. They will end up having to learn jQuery instead of having to
learn DOM, CSS and JS, and when being considered as a direct
replacement for those it fails both due to complexity and
inconsistency."

</quote>

Mitch









Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names

by Andy Matthews-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message