|
-
Bearded (M|G)od
argonauta, not to really cause an argument, but have you ever used jQuery?
Code formatting depends on the person writing the code. Yes, things can be chained together and in "one line". But that one line, can be neatened up and broken up across lines. Most programming languages and other libraries can be written in a messy way. It's all in the user.
Selectors in jQuery are extremely fast. So far that it's basically irrelevant.
Any plugin is written in it's own namespace. They won't conflict with other libraries.
And jQuery is ~19k.
-
poet and narcisist
 Originally Posted by MyFriendIsATaco
argonauta, not to really cause an argument, but have you ever used jQuery?
yup, in about every project i have.
Code formatting depends on the person writing the code. Yes, things can be chained together and in "one line". But that one line, can be neatened up and broken up across lines. Most programming languages and other libraries can be written in a messy way. It's all in the user.
I'm kinda playing devil's advocate here, as I do like and use jquery. Yes, it's up to the programmer to create good code, clean code, readable code, but jquery is easy to learn and use, and makes it easy to write code that is harder to understand, and sometimes bad code.
For example:
Code:
function activateBomb(){
alert('hello');
}
var mylink=document.getELementById('mylink');
mylink.onclick=activateBomb;
not exactly good code there, but the more verbose version gives you a better idea of what you're doing: " get an element by id mylink, and when it's clicked, activateBomb is triggered"
Compare that to jquery:
Code:
$('#mylink').click(function(){
alert('hello');
});
For someone that has never seen jquery, that code is a bit harder to understand at first (although once you learn to read it, it is very easy). Now, let's say that the onclick function is more complicated than an alert, and has 100 lines. In the non-jquery version you can ignore all of the code of activateBomb, because the function name might be self explanatory. In the jquery version, it'd take longer for you to understand that the function will activate the bomb. Of course, you can either add a comment, or create the function somewhere else, so that you can read the code faster.
Code:
//i like this one the most
var activateBomb=function(){
//100 lines of code
}
$('#mylink').click(activateBomb);
However, for what I've seen other people do, people using jquery will still use lots of anonymous functions, not organizing the code well. Again, it's not jquery's fault, it's the coder....but jquery makes it easy to code fast and not well.
Selectors in jQuery are extremely fast. So far that it's basically irrelevant..
And selectors in jquery are very powerful, but saying they're fast, it's not an excuse not to use them right. If you need to select one element, use by id, if you need to select several, limit your search (select the parent by id and the children by class). Besides the fact that it might be just a tiny bit faster (unnoticeable anyway)...the next person that sees your code will have a better idea of where will this divs be.
It's details, really, and again, it depends on the coder. But when the library makes it easy to be careless, any good coder will get lazy.
Any plugin is written in it's own namespace. They won't conflict with other libraries.
yes, mostly the conflicts come from the use of the $ function, which other libraries use as well. Jquery has the noConflict method, which is great. But still, specially because there's no quality control on jquery plugins (anyone can release a plugin anywhere for anyone, with good or bad code), you can't say it won't conflict with anything.
There can be conflicts: http://modxcms.com/forums/index.php?topic=33038.0
easy to solve, but they exist nevertheless.
oops, my bad...I guess google code is wrong, because they say jquery is 55.9kb
http://code.google.com/p/jqueryjs/do...s&downloadBtn=
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|