r/webdev • u/AllThingsSmitty • Nov 06 '14
AngularJS: The Bad Parts (Subtitled: How Web Devs Once Again Painted Themselves into a Corner with Popular Fanboy Frameworks)
http://larseidnes.com/2014/11/05/angularjs-the-bad-parts/1
u/nsquimby Nov 06 '14
Angular is definitely not without it's flaws, however I think the author is quick to throw it underneath the bus because it's not perfect, and it didn't work exactly how he wanted it to. Angular is a large application framework, and is inherently complex--you can make easy things easy, and hard things possible, but not hard things easy. I feel like the author is just raking in the karma/page views for taking commonly accepted criticisms of angular, and declaring them to be the folly of angular.
It's still javascript, so there are still some javascript-y issues (e.g. the 'dot' issue on scope form issue #1). Google was trying to modernize a language that was supposedly written in 10 days, and make it work for their purposes. It's a very ambitious endeavor: Google made angular in part to take advantage of what is clearly in the pipeline for webdev and create polyfills (shadow dom, web components, ECMAscript 6 features like object.observe()), but Google simply couldn't wait for those to become spec (HTML 5 anybody?)
It's still just another framework - you shouldn't use it when it doesn't meet your needs (namely, large, advanced, single page applications). Angular 2.0 will hopefully address many common criticisms, which I think are more inconveniences rather than actual roadblocks. Check out the post by @Tom Hook, who I think addresses the author's points, without making mountains out of mole hills, and putting those concerns without scope. Or execution context, or angular execution context or whatever :P
1
u/bumblechuckle Nov 06 '14
Meh - I've just starting using Angular.js on a Django project. I'm not a frontend dev but I've built a succint and complex UI in just a few days of messing around and without reading any tutorials. The finished product is leagues better than the sort of kludge I might have produced using jQuery.
Yeah, Angular is imperfect but it's important to see it in the context of now. Ie, it's an improvement over jQuery and it's helping web developers in the trenches get stuff done. Also, what else am I going to use?!
From the research I've done, I'd probably use ember.js on a big project (ie one that needs routing) but Angular does seem to fill a sweet spot where you might need a small piece of discrete heavy lifting.
In short, not least for lack of good alternatives, I can accept imperfections in angular and place full faith in their team to deliver a product I'd want to use for 2.0.
1
u/JX3 Nov 06 '14
Can I ask about your implementation? Are you using Angular in conjunction with Django's own template language? I imagine you're using the Django REST framework as well? I'm trying to steer away from jQuery, but quite a few of the resources around these frameworks focus on solutions where they consume the whole frontend. I'm looking for a more hybrid approach and was interested in how well Angular does in that role.
2
u/bumblechuckle Nov 06 '14
For this implementation yes we use Angular in Django templates. Django delivers the page with some base information and using this, Angular makes some ajax calls to json views to get the data it needs. There was no need to use REST framework as it's just one really complicated page in a larger application which doesn't have any other JSON views.
django-angular is really good for things like resolving your views in js (no need to hardcode url's) and also for setting up Angular so you can correctly verify the post with CSRF.
In many ways it's not much different to using jQuery because there isn't any routing to think about. It's a lot easier than you think.
1
1
Nov 06 '14
what else am I going to use??
Backbone, Ember, React and Knockout all immediately spring to mind.
Comparing Angular to raw jQuery will always make it look good. But compared to the others it isn't anything great
1
u/bumblechuckle Nov 10 '14
As I already mentioned, I'd use Ember on a project with routing. The reason why I wouldn't use either Knockout, React or Backbone is simply there aren't the packages to tie them into Django. As I mentioned, with django-angular I don't have to hardcode url's and it's super easy to post forms etc. Also, in this context I'm not sure backbone would be all that helpful on it's own anyway..
3
u/rich97 Nov 06 '14
A lot of this seems like nitpicking to me. Like this sentence referring to dependency injection:
Because sometimes it you need a lot of dependencies injected and the declaration gets really damn long and it's better to make it it's own thing.
Regarding terminology, language is complicated. There is nothing wrong with using established terminology to describe similar concepts. Take "constructor function", re-read the documentation:
So, it's a function that runs to set up the initial state of the object in the given scope. Seems pretty damn close to constructor function to me. They even clarify in the very next sentence.
It's a large, monolithic framework for building rich web applications. If the documentation requires 2000 words to explain then I highly doubt that your two sentence solution covers all of the situations it is trying to cover.
I'm saying this as a developer that recently has had to push Angular as I far as I could push it, originally knowing nothing about Angular 3 months ago. There have been some serious pains along the way, mostly to do with the DOM and making sure that things are loaded in the correct order, but you know what? It held up. Calling it a bad framework as a whole is just plain dumb.