jQuery makes things almost too easy. As a result it gives confidence and power to a lot of people to write code that despite all sillines will still work. A professional JS developer would've debounced the scroll events and cached the selector results.
Learning from Twitter
31–37 of 37 posts
Re: Learning from Twitter
#32jQuery makes things almost too easy. As a result it gives confidence and power to a lot of people to write code that despite all sillines will still work. A professional JS developer would've debounced the scroll events and cached the selector results.
jQuery promotes bad practices. People assume $('something') is a cheap variable access, when in fact it could be pretty slowly executing several functions. So they don't bother caching anything.
This is true of just about any API. Nobody blames the API when their ORM layer generates a massive SQL query based on complex query input. Understanding the performance characteristics of the 'backend' is assumed.
Re: Learning from Twitter
#33This sort of thing is one reason I hate websites which use a lot of Javascript when they don't need to. Another reason is that it breaks expectations of how websites should work.
Re: Learning from Twitter
#34Earlier quoted context omitted.
jQuery promotes bad practices. People assume $('something') is a cheap variable access, when in fact it could be pretty slowly executing several functions. So they don't bother caching anything.
I think by "promote bad practices" you might mean "abstracts complexity away from the developer". This is true of just about any API. Nobody blames the API when their ORM layer generates a massive SQL query based on complex query input. Understanding the performance characteristics of the 'backend' is assumed.
$FOO in php is cheap.
$('FOO') in jquery is expensive.
I don't think using $ to signify "Run some load of jquery code" was a wise choice. Newcomers who don't know what is going on under the hood will regularly write loops with $('FOO') inside them, which is crappy code.They're doing what they think is best, so I don't blame them. I blame jquery for making it look cheap.
Re: Learning from Twitter
#35Earlier quoted context omitted.
I think by "promote bad practices" you might mean "abstracts complexity away from the developer". This is true of just about any API. Nobody blames the API when their ORM layer generates a massive SQL query based on complex query input. Understanding the performance characteristics of the 'backend' is assumed.
$FOO in php is cheap. $('FOO') in jquery is expensive. I don't think using $ to signify "Run some load of jquery code" was a wise choice. Newcomers who don't know what is going on under the hood will regularly write loops with $('FOO') inside them, which is crappy code. They're doing what they think is best, so I don't blame them. I blame jquery for making it look cheap.
Re: Learning from Twitter
#36Earlier quoted context omitted.
$FOO in php is cheap. $('FOO') in jquery is expensive. I don't think using $ to signify "Run some load of jquery code" was a wise choice. Newcomers who don't know what is going on under the hood will regularly write loops with $('FOO') inside them, which is crappy code. They're doing what they think is best, so I don't blame them. I blame jquery for making it look cheap.
Why on Earth you assume that someone starting to use jQuery will come from PHP background, and more over, why should that person think that $FOO in PHP is cheap? I guess anyone thinking in terms of performance cost will be smart enough to understand what $() does in jQuery, especially when advice to cache selectors is on every wall.
Re: Learning from Twitter
#37This sort of thing is one reason I hate websites which use a lot of Javascript when they don't need to. Another reason is that it breaks expectations of how websites should work.
To be fair, the expectation of how websites work is changing. Lots of small touches in applications aren't strictly necessary(animation, transparency), but they do make for an overall nicer experience. People have come to expect these things from modern websites.
I can't offhand think of a single example where they've improved my experience. (With the exception of things like Google Maps where the JS is an important part of the user interface.) When, for example, a menu or picture animates open instead of appearing instantly, at best I feel mild irritation.
Maybe I'm just a cumudgeon.