Angular JS Kinda Sucks
okmaya.com
okmaya.com
"Get the job done" got replaced with "its cool to use xyz".
Each time I've thought 'there has to be more to do than that'.
If I were doing JQueries - there would be an entire stack of event driven DOM updates still to code.
But it depends on the complexity and size of a project and how many developers are involved. I prefer frameworks too, but for a small WebApp, it is overkill to use frameworks like angular/backbone/whatever.
Of course this means that for simple jobs jQuery may be better suited, unless you're trying to LEARN Angular, in which case it makes sense to struggle through trivial apps with complex tools until it clicks. None of this supports the article's thesis, of course, which is something akin to "I dont understand this, it must be lame!"
Which is funny because it started out as a way for web desginers (not developers) to learn how to write apps.
Within 5-10 years we'll be transitioning to a world where SPAs/native-like apps are the norm.
The way I see it at the moment is:
1. SPAs/native-like apps are really hard to do well still and the reserve of the coders with lots of skill/time to play
2. Javascript is still very hard to manage when writing anything non-trivial. Unfortunately, it's not getting better but actually becoming relatively worse when compared to the speed/innovation of other languages.
3. Browsers will carry on refusing to let us use any language but javascript[1] because 'standards'.
4. As javascript/the DOM are too unwieldy to write complex apps, we need the equivalent of jQuery for SPAs/native-like apps
5. Enter backbone, ember, angular, etc. They are our saviours against the mess of the w3c and javascript. They are presently in the early stages where jQuery/MooTools/prototype were in the mid-2000s
6. Anyone who doesn't get with the program, like this fella, will find themselves suddenly sorely lacking in a key skill almost overnight, as happened with jQuery
[1] Most shamefully Firefox, the ones who should have lead the charge 4 or 5 years ago to drop javascript as the one-true-way, will refuse to innovate past js. So much for 'free' or 'open'. Imagine if all Linux distributions suddenly conspired to only allow PHP 4 to be written. Or Windows only allowed you to write VB. It's such a bizarre situation we're in. The web is like the operating system of the internet but we're being denied the freedom to choose our preferred language.
Things like coffescript, backbone and angular are attempting to provide a cleaner interface to the memory management which we could equate to the Dom. High level, abstract models, and allowing us to think of things in much more elegant ways.
jQuery wasnt anything new, we had seen others similar, none however got the ease of use down quite like jQuery, and certainly none of them got the market share.
While this guys post isn't all that useful to me, maybe even a bit odd to find on HN, I still am greatful for this thread and will definitely be taking another pass of angular this weekend. Seems like it's a bit better understood and I think I'm clearer on its intent. Discl: I was previously in the camp that felt angular was taking us many steps back into coupling of ui to js. It sure seems that way but it may have been the case we were just doing it wrong way back then (on click=)
Edits: new phone, autocomplete, hasn't adjusted yet.
http://stackoverflow.com/questions/14994391/how-do-i-think-i...
Well done.
When I started using Angular I had really no experience with jquery or any other js framework, and I felt Angular was intuitive.
I'm somewhat surprised that it's so popular with the JS crowd right now.
Big enterprise has had this problem for a long time in their big multi window monster apps they use for stock trading, etc. JS webapps have been very simple for a long time and haven't really needed it until recently. Now that they're getting complex, JS devs are looking into how to solve the problem and it generally comes down to MVC OOP style or FP style. You can see these two derivatives in AnglularJS and ReactiveJS.
A big point about angular's tutorial is that it isn't really explicit enough is how everything links together. It's a lot easier to learn angular by taking some sort of class or going to some presentation, because the tutorial in its current form does not explain general architecture.
Another issue is a lot of people present angular as this sort of "oh hey, check out the data-binding stuff!" , when that is just a small part of the entire mechanism. Angular's big advantage is that it allows you to organize your javascript into nice little modules, and it gives you deterministic behavior about how these load (with the dependency resolution and whatnot).
I don't really know JQuery either, so I can't say he is right or wrong with that criticism but currently Angular seems to be hyped up a lot in my opinion. (Or am I just too spoiled by the decent development tools we have backend?)
It's exactly the same as the all-flash or flash-heavy sites of the early 2000s and I can't wait until javascript-only sites are consigned to the same dustbin of "why did we ever think this was a good idea?".
Edit: It also breaks search engine indexing.
But the browser is the new OS, complex applications are written for the web as a platform/runtime and this is not a bad thing. This is where Angular can help. It's not built to help you show/hide a few dom elements, it there to give you a powerful structure for developing web applications.
"Architect it how? Are there examples? Some nice examples would be of projects that are relevant to the outside world. Data manipulation?"
Without documentation or at least full examples of architecture, not just toy samples, it's difficult to justify spending time working out what a good architecture _would_ be, because it would take so long to figure this out.
I keep following tutorials, watching PluralSight videos, etc. but so far I haven't seen any example that's even close to showing a real world app with complex forms and validation, complex entities to store, retrieve and manipulate, how to manage large test suites, etc. etc.
Still I'm persisting in trying to get started with Angular as it really does look great!
jQuery have enough third party lib to solve most problems.
I have done 2 big application and I'm still convincing my boss that angularjs must be deprecated immediately.
Directives and Services have too much workaround to solve the problems we already have defeated and they cast the spell to bring the undead back.
Problems I see:
* fast development * easy way to build reusable components (see AngularStrap source code) * few lines of code with real problems (like a huge form) * form validations * testing is pretty crap to do, a new born framework (karma) is already obsolete. * to much problem with $scope needed to workaround with setTimeout(fn, 0)
Features is does have:
* build a quick to do list * build a quick hello world sample
What kind of spaghetti does this guy and his colleagues build where there is such strong back-end and front-end interdependency that the server-side code cares what the front-end is doing for DOM manipulation or client-side-MV* like this, I wonder.
Secondarily, jQuery and angular.js don't serve the same use cases and are not directly comparable. Not all tools need to be general purpose. It's OK for a lathe to be a lathe, a drill press to be a drill press, a soldering iron to be a soldering iron. Complaining that a soldering iron makes a poor hammer just means you don't know how to use a soldering iron, it doesn't mean it's a poor tool.
So first no one should tell you that Angular is better than jQuery since they have different purposes. Angular is an MVW framework while jQuery is a javascipt library. Another thing is you think something sucks back it up with data. I see no concrete examples just some guesswork. And lastly: I can bet that if you try to read through SICP you'll say that LISP is crap and useless because it does not look like jQuery. If you don't take the time to understand something properly you'll never learn anything new. The world is full of diverse programming languages/libraries which simply don't compare to each other.
Third: You won't get the actual idea behind Angular without some good tutorials indeed. This one gave me the best insight and i've been churning out my own angular based chrome extension with behaviors, services and modules within a week.
http://www.ng-newsletter.com/posts/chrome-apps-on-angular.ht...
Fourth: There's a new book in progress (with some free chapters) that explains how to build Angular.js from scratch and explains everything in-depth (Something that was indeed lackin from angular.
Site: http://teropa.info/build-your-own-angular/
Sample: http://teropa.info/build-your-own-angular/build_your_own_ang...
This is an apples to oranges comparison.
I wouldn't use Angular for a small'ih average website where you want some minor JS-based UI functionality. But I found Angular much more suited than jQuery for big sites that are maintained by more than just one developer. You can look at some piece of HTML and you can tell from the list of directives what's going on. No stray click handlers and whatnot.
One of my more recent clients had used jQuery for ~8 years, the HTML had changed a lot in that time and the JS had grown like a cancer due to developer fluctation and people just adding code to fix their current problems. Quite frankly, it was a mess. I believe that with a framework like Angular it wouldn't have gotten out of hand like this, mostly due to its modular approach to everything.
I disagree completely and in every possible way. This has been the hallmark of every new language/framework/coding philosophy/rant that has ever been made about coding in the last 30 years. And it's always wrong. It's wrong because it doesn't get the real issue:
Your code is bad because you have multiple untrained developers just adding code to fix their current problems. It doesn't matter which framework you use - just adding in some code to fix something over a number of years will destroy your code base. It will destroy your jquery codebase, it will destroy your angular codebase, and it will certainly destroy even your ML codebase.
I wish the coding community will one day wake up to this fact and realize it's not a technology problem, but I'm pretty sure in 10 years time I will read a post about how you need to switch your horrible old messy AngularJS app to XYZ which will fix all your problems.
More likely given the rapidity of churn in the JavaScript world, in about 10 weeks.
Yes, definitely! That is the core problem. My point, the one I obviously failed making, is that it's easier for an untrained dev to just add a line or two to a codebase where everything looks the same due to a lack of clear boundaries (modules, classes, whathaveyou).
I had to sift through ~10k lines of JS code that had accumulated over a span of several years. There was no modularity, no real clear-cut structure, which made everything hard to read, so noone really bothered—they just layered crap on top, done.
Having a JS thing called `HerpDerpCtrl` where you can tell from searching your HTML whether or not it is still in use would have made the job of cleaning up much easier. That's why I like frameworks, they provide a structure.
It won't solve the problem of having bad developers in your team, or a lack of meaningful code reviews, or missing tests, but I believe it'll make it harder for people to screw things up.
I have only one thing to say to the poor future maintainers of AngularJS apps in the future. Godspeed.
I think the distinction is more nuanced, Angular isn't intended for producing web sites, so much as web applications.
Ultimately, I don't think bad docs (which aren't actually all that bad...) are the reason newcomers find it difficult. After all, there's a bunch of resources by now, on various blogs, stackoverflow and even books were written on the subject. It's just that people are looking for quick wins and something they can start hacking on now, while completely ignoring the long-term benefits of adopting something as sturdy as Angular.
I've been working with Angular for about a year and a half now, and it's been very worthwhile going through the initial learning process.
"First of all, I can do anything in jQuery, and have full control. Full control of the selectors, HTML, the DOM. I like that."
This could be rewritten as "First of all, I can do anything in Assembler, and have full control. Full control of the stack, registers, the memory. I like that."
In that sense I agree. After being burned multiple times by opaque, hard to debug frameworks, I'm now firmly in the libraries camp. I'd much rather piece together a number of small self-contained libraries that each do one thing and one thing only, and glue it all together myself.
My experience with frameworks has always ended in frustration and disappointment. Sooner or later you will reach the limit of what the framework was designed to do and it's at that point that the true pain begins.
I used to be mesmerized by framework automagic now its an instant red flag for me.
I made the mistake of looking at another post: http://okmaya.com/clean-php/clean-php-step-10/ Separating business logic, data models, and views.. yeah I bet that kinda sucks too huh? The author has clearly not worked on large scale software projects where a framework like Angular could pay big dividends in structure and testing.
If you want to compare, compare it with something like Backbone.
But creating a data-driven, non-trivial web app in pure jQuery is probably going to take much, much more.
AngularJS Fundamentals In 60-ish Minutes by Dan Wahlin:
http://www.youtube.com/watch?v=i9MHigUZKEM
Introduction to Angular JS by David Mosher:
but if you are software developer etc. and you are creating a web-application you should angular or some other beefier framework, backbone/knockout/ember/whatnot.. or you can just re-invet the wheel
Get a book, read it, understand it, spend some time working with it. Then compare Angular to JQuery, I bet a lot of your 'its complicated' complains will have disappeared..
If you have one page with one complex interactive form, with a calculator, that grabs prices from out there on The Web, then it’s a one page design, but complexity of that one page is way high, depending on all of the features on it. Calculator, 2 points. Search 3 points. Connecting to databases and APIs, 5 points. You get the idea.
Both projects can be about 100 points. One more complex than the other, and one more pages than the other. And now for the prices:
$125 – $250 per point.
That’s it. Why the wide range? Depends on a lot of things. But, on average, I can do about 39 points in two weeks. Considering the overhead, taxes, etc, that comes to about $60-$120 per hour."
"Adding frameworks and shortcuts to your development will only make you hurt later on."
Then in another post he has written his own framework.If you know PHP, you know that you shouldn't be doing it like that. He sounds like a novice. There's nothing wrong with that, but when looking at that kind of thing I would take an opinions as a grain of salt