4 ms·
This answer convinces me to prefer jQuery for apps that aren't Facebook or Gmail. It has an "architecture astronaut" feel (explicitly eschewing graceful degrad
by gohrt 13y ago
This answer convinces me to prefer jQuery for apps that aren't Facebook or Gmail.
It has an "architecture astronaut" feel (explicitly eschewing graceful degradation!), which most web pages don't need.
I'd be interested in "controller" plugins for jQuery, so I can opt into upgrading from trigger->DOM to trigger->controller->DOM as my app grows.
- axelf 13y agoI consider Separation of Concerns, Dependency Injection, and TDD to be basic software engineering principles. Sure if you have a mostly static page with a few dynamic components jQuery will work fine, but with a larger project that you really need to consider a more maintainable architecture.
- mattmcknight 13y ago"Separating configuration from use" is the principle, and dependency injection is one of many patterns used to aim for that... http://www.martinfowler.com/articles/injection.html#SeparatingConfigurationFromUse http://www.martinfowler.com/articles/injection.html#Separati...
- smrtinsert 13y agoAbsolutely. Honestly it seems to fly really far with the node youngsters who want to code all night for some reason. What you're talking about is event delegation. It's a one liner practically, but shh, we're talking about "architecture" now.
- macspoofing 13y agoAngularJS is an MVVM framework. It's fairly new to JS and front end web development, but not that new for UI development in general (it's been around since 2005 in WPF and used in Silverlight and Flex applications, and possibly others). It isn't just 'event delegation'.
- macspoofing 13y agoIt shouldn't. AngularJS should work great in most situations, even for simpler pages. I'm a big fan of MVVM pattern as it lends itself to a hard separation between the nitty-gritty view details (e.g. effects, transitions, styles, etc.) and the rest of your business logic. Create your view, declare how it should behave based on view-model values and then hook it up to your core business logic that is now completely agnostic to your view details. jQuery, on the other hand, forces you down the path where your business logic needs to care about how the view should render the content, and those ugly view details are sprinkled all over the place.
- wwweston 13y agoForces? Angular is pretty cool, but it's hardly the only neat way of seperating and offloading view detail work. And jQuery is just a (much) nicer-than-native DOM/browser API. It doesn't provide an application architecture or data bound view handling layer because that's not what it's for, and it no more forces an application style than your text editor does. This isn't to say that Angular isn't nice for projects short of Gmail's scale (I would/am considering it for some small scale stuff), it just doesn't make much sense to say jQuery forces people a direction by not providing features that aren't really part of its purpose.
- macspoofing 13y agoYou can write maintainable code in any language, but certain languages, frameworks, and libraries lend themselves to certain patterns. It's very easy to do the wrong thing with jQuery.