4 ms·
I never understood how JQuery and JS were just dumped the past 3-4 years in favor of all thse complex frameworks like AngularJS, Ember, etc... is there somethin
by AznHisoka 13y ago
I never understood how JQuery and JS were just dumped the past 3-4 years in favor of all thse complex frameworks like AngularJS, Ember, etc... is there something these frameworks can do that JQuery can't? Can they make fancy single page apps and JQuery can't? I need to be enlightened.
Or is it simply ppl need to exercise their mental creativity?
- atrk 13y agoPersonally, the two big draws to me of Angular were "free" (as in, I don't have to write much code) DOM<->data binding, and the explicit goal of testability. As a learning exercise, I wrote a page using just jquery, rewrote it in backbone, and then rewrote it in angular. Backbone helped me separate concerns; Angular helped me do that while writing _way_ less code, since I didn't have to manage keeping the DOM and the JS model in sync.
- chucknelson 13y agoAgreed - data-binding and "magic" automatic updates to the view when the model changes are key to what make Angular attractive. The focus on testing is nice too, though.
- Glide 13y agoI had the same experience as well. I redid a relatively trivial CRUD interface from backbone to Angular. The amount of code that I didn't need in Angular was ridiculous. Most of the code in backbone was moving stuff from the DOM into JS. Like var x = $('#elem').val(); kind of things over and over just did not need to be there in Angular. I think that these kinds of interfaces hit a really good sweet spot with Angular and other databinding frameworks.
- Hovertruck 13y ago"I never understood how JQuery and JS were just dumped the past 3-4 years in favor of all thse complex frameworks like AngularJS, Ember, etc..." Well, you can't have Angular without JS so we'll focus on the point of jQuery here. jQuery does a few things really well – so well that Angular itself uses jQuery (or jqLite by default). angular.element(selector) returns a jQuery object. Angular also does a few things well. Code reusability and testability are much easier to achieve with Angular, in my opinion. Features like data-binding also help to reduce boilerplate code.
- seabrookmx 13y ago> Well, you can't have Angular without JS Well you certainly can use it without writing any JS: https://github.com/angular/angular.dart https://github.com/angular/angular.dart However, you're going to compile it to JS when you're done.
- ulisesrmzroche 13y agoOk, cool. if Angular returns a jQuery object then its proof that it uses jQuery quite extensively. So does Ember.
- nobleach 13y agojQlite is a pretty small subset of jQuery. Many things are left out to keep it lean. For example $(el).offset()/height()/width() etc. Mostly only the DOM methods are left as they do still need a bit of normalization across browsers.
- bmm6o 13y agoThere was a similar discussion last week. What I said then was that a lot of the things you would use jQuery for have a different solution in Angular: https://news.ycombinator.com/item?id=7396016 https://news.ycombinator.com/item?id=7396016.
- uniclaude 13y agoAmong other things that Angular, Ember & others bring, what you should understand here is that JQuery does not help you to structure your code. Those frameworks offer the type of structure that makes it easier to reason about how an app should be built, and it helps a lot when you're working in a team. JQuery and JS were certainly not dumped, it is just that people writing single page apps moved on and are now using tools that help them.
- ulisesrmzroche 13y agoYes, there are a tons of things that jQuery cant do out of the box, like handle state in your application or keeping your client and server data reliably in sync, list goes on. Also, lots of frameworks haven't ditched jQuery, for instance, Ember.$ is a reference to Embers copy of jQuery.
- coldtea 13y ago>* is there something these frameworks can do that JQuery can't? Can they make fancy single page apps and JQuery can't? I need to be enlightened.* jQuery has nothing to do with whether the app is single page or not. Those frameworks make writing single page apps very easy.