Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

avoiding jQuery for SPAs?  RSS feed

 
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear, I'd like to hear your take on this article. I admit the article is a bit over my head.

Do you think this is something that just affects Embers apps or is this something that all jQuery developers need to watch for?
 
Author and ninkuma
Marshal
Posts: 66727
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not being very familiar with Ember, I didn't delve deeply into the examples and problem descriptions enough to give a detailed analysis. On the surface, my impression is that there could be an issue with unneeded code hanging around a page too long (as if that's never been the case) when using component-based Ember or similar frameworks.

A case for whether it's particularly applicable in other environments was not made.

But the point that modular code should be able to be easily removed when no longer needed on long-lived pages is an accurate one. It's something that we need to be thinking about.

But singling out jQuery specifically as a culprit seems a tad witch-trialish -- most code written up to this point for any environment hasn't given much thought to this. The "the sky is falling" tone of the article is a bit put-offish as well.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear. I haven't used Ember or looked at SPA frameworks, so this is new to me, but I use jQuery and various plug-ins every day so I was a little concerned by this article.

btw, by addressing Bear, I didn't intend to exclude any one else from the conversation. If anyone has anything else to add, please chime in.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know Ember.js but for the time being it should be the least jQuery hostile framework as Ember's code base seems to occasionally use jQuery itself (https://github.com/emberjs/ember.js/search?utf8=%E2%9C%93&q=jQuery, which isn't that surprising). That being said there seems to be some suggestion that jQuery shouldn't necessarily be the first tool to reach for when you are using Ember: jQuery to Ember: How to Make the Jump Without Falling - YouTube and

No, really, Let Ember handle things!


The Top Mistakes Developers Make Using Ember & Rails - 4 Ember isn't jQuery, either
Basically jQuery is safe as long as nothing else is competing for access of the DOM - things change once a framework wants (preferably) exclusive control of the DOM. In general once you are using a framework you should always find out whether there is a way to do something through that framework first before you get another library involved (even if you already know how to do it with that other library) or even use the browser API. Unfortunately every framework/library "has its own way of doing things" so there is always yet another learning curve to deal with (discovering what your tools are doing for you under the hood can sometimes help flatten the curve the next time around).

In the end the question that really needs to be asked much more often: "Is implementing this web application as a Single Page Application the best solution?"

For the time being counter-movements like ROCA (Resource-Oriented Client Architecture) are being largely ignored (where jQuery libraries are listed among others under ROCA JavaScript Libraries). But there are cases where organizations have gone from front-end page generation back to rendering pages on the server side:
Improving performance on twitter.com | Twitter Blogs
Delicious Changes | The Official Delicious Blog

... so in some instances the issue should be more about avoiding SPAs - though be prepared for accusations of being "anti-progressive" and "stuck in the past".
Why I hate your Single Page App — Medium
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!