r/programming • u/joaojeronimo • Jan 14 '15
The problem with Angular
http://www.quirksmode.org/blog/archives/2015/01/the_problem_wit.html85
Jan 14 '15 edited Jan 14 '15
Wow. I have a ton of respect for PPK, but he quite obviously has a "personal" issue with Angular.
Although there are front-enders that are enthusiastic about Angular, I have the feeling that their number is surprisingly low for a major framework. I expected Angular to gain more traction than it has.
This couldn't be further from the truth. Angular is far and away the most popular front-end framework, like it or not, and has been for 2 years.
Angular is aimed at corporate IT departments rather than front-enders ...
What a ridiculous thing to say. So he's saying, "It's not cool, people don't like it and it's designed for people who aren't cool anyway". Like someone on the wrong side of a popularity contest.
I agree on some of the performance issues. Manipulating the DOM is slow and there is a limit to the scale in these frameworks (Angular having less limitations than Ember et. al., in my experience) but the rest of it suggests that he just doesn't like client-side templating. Says that stuff should be on the server... it makes him sound like a technologically backwards curmudgeon.
25
u/bkrebs Jan 14 '15
I was looking for a comment like this so I didn't have to type the words myself. I've seen many articles and polls about Angular's grip on the front end especially over the last year or so. Just anecdotally, it seems to be introduced into every new software project I've run into lately. On top of that, as a developer with strong Java experience, I don't see how Angular is aimed at Java folks. Not even close. If I'm a project manager and I want my back end Java developers working on the front end for whatever reason, Angular isn't even in my short list. The award goes pretty immediately to something like JSF or GWT.
→ More replies (1)16
Jan 14 '15
The award goes pretty immediately to something like JSF or GWT.
Yep. If you want to start making large internal websites quickly and you have nothing but Java devs, GWT (or Vaadin) is the way to go.
Bu pure chance and coincidence, GWT was developed by Google to make front end development appealing to Java developers. Which the blog author seems oblivious to.
→ More replies (2)15
u/developer-mike Jan 14 '15
Agreed!
Its funny how many people are out there validly complaining about how angular can't do server-side template rendering in tandem, and meanwhile this guy seems to be saying its a problem that angular has a templating engine in the first place.
Templates aren't hard to understand, spaghetti code is. That's why backbone caught on and angular one-upped it.
9
Jan 14 '15
Also the performance implications. client-side templating shifts massive load from server and creates a faster, smoother overall experience. The whole idea of "single page" (one page load) is better UX and offloading needless server cycles... So right, it get's silly sometimes when people criticize newer frameworks. Some of the arguments are wrong-headed critiques on client-side templating itself.
3
u/nickguletskii200 Jan 15 '15
I am currently rebuilding my project's frontend to use Angular. It had almost zero Javascript before that. Why? Because otherwise, it's a pain in the ass to test.
I just wish Angular 2 would come sooner. I hate every second of working on the frontend and Angular 2 would make things much easier.
21
u/NuttGuy Jan 14 '15
Saying that stuff should be on the server totally blew me way. In my opinion front-end devs (like myself) need to take more advantage of the awesome javascript engines we get in the browser and use the awesome machines that everyone has today. I couldn't agree more that it just sounds technologically backwards.
9
u/r3m0t Jan 14 '15
Yep, it would bring us back to those painful ASP.NET applications where every user interaction performs a server round trip.
→ More replies (1)4
u/NuttGuy Jan 14 '15
To be fair to ASP.NET they've been trying to be really tech forward recently and taking advantage of good Javascript (ex: jQuery being included by default) but there are good examples of what your talking about in the past yes. Shudder...
8
u/iopq Jan 15 '15
I don't want my phone to run out of battery trying to run JS on your site. Please spend the resources server-side where you're hooked up to an outlet.
5
u/m0haine Jan 15 '15
Connecting to the plugged in server is not free in terms of battery life. I would be surprised if negotiating an http request over wireless uses less power then most locale Dom updates.
3
u/iopq Jan 15 '15
Considering my phone sometimes takes SECONDS to do the Javascript on the page, I somehow doubt that assertion. The older phones really have difficulty with javascript-heavy pages.
→ More replies (1)7
u/shared_ptr Jan 15 '15
I actually think you should look at the cost of transmitting data. Any CPU computation is typically dwarfed by activating a transceiver. Mobile Devs would do well to keep processing on the device and use network communication as the last resort- I think you can get several million CPU cycles in for the same cost of a single broadcast byte.
→ More replies (5)7
u/PandemoniumX101 Jan 15 '15
Whenever I see a "Problems with Angular" blog post, it always winds up to be the same tired BS with the root cause being the readers personally issue with the framework.
As you suggested, this case is no different.
As someone who has been happily using angular for 18 months, it has been my favorite framework to date as it blends perfectly with my design philosophies and micro component approach.
4
u/Capaj Jan 14 '15 edited Jan 14 '15
Says that stuff should be on the server...
Exactly. How do you expect to provide any sort of user experience that people are accustomed today on the web without heavy clientside JS? Mobile phones are fast enough today already, in a few years all this talk about slow performance will be just useless trolling.
2
u/strattonbrazil Jan 14 '15
far and away the most popular front-end framework, like it or not, and has been for 2 years.
Far and away the most searched for at least. When I search for backbone, for instance, sometimes I type "backbone ...", "backbone", "backbonejs", and "backbone.js". It's easy to say all those searches for angular are really for angular because it's uniquely used for that library, but the data is a little misleading just based on search. It maybe be the most popular, but I'd like to see a better analysis.
→ More replies (5)1
u/makkynz Jan 15 '15
High Google trend stats doesn't really indicate how popular a technology.
It's more likely shows how often people have to resort to google searching to find answers to problems they having using that technology.→ More replies (1)
10
u/jonwayne Jan 14 '15
He lost me at criticizing Angular's template syntax as "for the server side". It completely ignores the entire purpose of dynamic applications that don't have to ask the server to re-render every thing when one item in a list changes. What else are we supposed to do? Manipulate the DOM directly? That worked out really well in the past...
45
u/zomgwtfbbq Jan 14 '15
Okay, I love quirksmode. I've been reading it forever and his browser compatibility tables have saved me many times. But come on man -
"Google does not use Angular in production for their flag apps like Gmail or Gplus."
Ouch. Thou shalt eat thy own dogfood.
Wtf is this lazy crap? Doubleclick is built on Angular. That is literally their bread and butter; that is what they make their money on - ad revenue. Here is one of many sources
I'm not here to say Angular is perfect or that it's above criticism, but it's hard to take your article seriously when you can't even chase down a simple fact like - yes, Google does use Angular on its own projects.
1
u/strattonbrazil Jan 14 '15
Doubleclick isn't an app, maybe? Or maybe on the client side double-click with angular handles far less data than a large email box or Gplus page so maybe it's a fair point that they don't use it in apps with a lot of client-side data. Just throwing that out there.
→ More replies (1)18
u/zomgwtfbbq Jan 14 '15
Actually, the doubleclick app is a pretty freaking big app. They gave an entire presentation about building "massive angular apps" at ng-conf - https://www.youtube.com/watch?v=62RvRQuMVyg
Additionally, there are other presentations where the Angular guys say there are over 1,000 google apps written in Angular. I just used doubleclick as an example of how freaking easy it is to learn that Angular is being used by Google on big applications with just the tiniest bit of research..
0
Jan 14 '15
[deleted]
12
u/zomgwtfbbq Jan 14 '15
Doubleclick was just one easy to find example. There are over 1,000 apps at Google written in Angular. The doubleclick app is huge, it is not a simple client login.
Also doubleclick is a subsidiary so they're their own company owned by Google and likely have the freedom to make some of their own choices.
Google bought doubleclick in 2007. They chose to re-write the doubleclick app in AngularJS in 2012. If you think they aren't keeping a close watch on something they spent over 3 billion dollars on and receive a ton of revenue from, you're crazy.
6
u/Capaj Jan 14 '15
Gmail is an old app which works fine, I am an avid Angular dev, I am not a business person but it seems to me that they would not gain anything by rewriting it in Angular. They would only alienate bitchy users who hate changes even more.
27
6
u/rpgFANATIC Jan 14 '15
Enterprise IT managers want well-maintained code backed by a large company so that they don’t have to worry about a sudden lack of support.
This is exclusive to Enterprise IT managers?
I'm having trouble imagining any real project that doesn't want their core libraries / frameworks to be alive many moons after the project's in Prod.
6
u/vivainio Jan 14 '15
I took a moment of actual keyboard time to write a blog post on this, more for therapeutic reasons than anything: https://medium.com/@vivainio/angular-is-ok-49bfd7924fc1
2
u/pkt-zer0 Jan 15 '15
Let me throw in my counter-counter-points, because why not.
1.) If you have multiple options, but all of them except one are fairly painful, that's still a form of lock-in. Specifically, bolting AMD/Browserify on top of things gets silly, especially with RequireJS (examples here). Wrapping complex jQuery plugins in directives is not a trivial task either, and it was actually one of the most problematic aspects of an Angular project I worked on recently.
2.) The term "framework" implies tight coupling, so when things change as unpredictably as in the JS world (see: angular 2.0), you should probably avoid using a framework to begin with. A bunch of loosely coupled libraries can do the job as well. React, by comparison, is just a view layer, though maybe not as thin as it could be. Still a step up from Angular.
3.) "Sacrificing my youth on a dead-end framework" is exactly how I feel about Angular. Knowing about Angular's numerous pitfalls and the corresponding workarounds may be a skill that's valuable to employers, but not to me as a programmer. Learning the distinction between attribute/two-way/callback bindings in isolate scopes is not what I want to spend my limited brain capacity on.
1
u/vivainio Jan 15 '15
Thanks for the feedback. Browserify works great w/ Angular IME, integrating AMD may be less so (but you could argue it's a bad idea in the first place ;-)
1
u/backdoorsmasher Jan 19 '15
The term "framework" implies tight coupling, so when things change as unpredictably as in the JS world (see: angular 2.0), you should probably avoid using a framework to begin with.
I'm sorry, but this is a painfully poor argument.
By this logic, you should have never have bothered with using Java, .net, or PHP or anything else for that matter, as the framework may change. You should have specced out your own chips and written your own assembler or C to start with, then you'd never have any issues with the framework implementation changing.
Most of these anti framework arguments miss the major purpose of these frameworks: to get shit done.
Real world projects have budgets and costs, and have actual deadlines. They have stakeholders and project sponsors that need to be kept happy. The purpose of a framework is to help you get there - they are there to reduce your development time, and to be a tool to help you get the job done to a good standard in a timely manner.
→ More replies (1)
4
u/Mr-Yellow Jan 14 '15
The cost of application maintenance should not be offloaded onto all their users’s browsers (we’re talking millions of hits per month here) — especially not the mobile ones. This job belongs on the server.
Why?
You want to pay for and maintain millions of hits worth of processing for something that can be done on the client?
The problem is that there is no way for Angular to discover these instructions except by parsing the entire DOM
I'm not sold on the idea of {{}} style templates either. Looks like too much string parsing work. Seems they aren't either, good.
Each update spent a lot of time creating and destroying DOM elements.
Also I'm not sold on the idea of an infinite loop being the best way to look for changes.
Picking Angular means you’re learning Angular the framework instead of how to solve problems in JavaScript.
Angular2, which to me looks like Durandal2 more than Angular should shake it all up and make things pretty clean.
As it stands I believe the best route might be Durandal with the observable plugin, avoiding Angular syntax altogether and creating clearner javascript models for future migration.
7
u/Invinciblegdog Jan 14 '15
So if Angular is so bad what is the "proper" way of doing front-end development? This is one of the reasons I have stayed away from front-end dev work as no matter what framework/style you look at there are always articles saying why that approach takes you on the road to hell.
8
u/Mr-Yellow Jan 14 '15
what is the "proper" way of doing front-end development?
On the backend according to this it seems......
3
2
1
u/backdoorsmasher Jan 19 '15
You've basically highlighted the key problem with all of these framework detracting posts.
They highlight what they perceive to be problems, and don't offer any viable alternative.
0
Jan 14 '15
[deleted]
10
Jan 14 '15
There's a reason spotify rather develop native for every platform rather than rely on web only and that's because web apps are largely shit even for something as basic as browsing and playing music.
Hmm..
→ More replies (2)
3
u/DOKKA Jan 14 '15
Angular may have problems, but every framework has flaws. I have been using Angular for almost a year, and I have had very few problems with it. I think most developers just get too caught up in the search for "the right way" of doing something. Instead of worrying about the right way, you could simply jam everything into the controller and slowly learn how to fix it. This goes for any framework though. Put code wherever it works, then organize it later. Chances are, you'll figure it out faster, because you'll have something that works immediately. Also, if performance is that critical, why would you use Angular anyways. It primarily relies on plugins. If performance is your ultimate goal, then programming will definitely take longer anyways.
18
u/KumbajaMyLord Jan 14 '15
Ok, so the problem after all this directionless rambling is that Angular is not a silver bullet and that it caters to "Enterprise IT" and not "frontenders" (whatever that distinction may include).
Great. Big News. More at eleven.
0
Jan 14 '15
[deleted]
15
u/youre_a_firework Jan 14 '15
The problem with the article is that it's so full of anecdotal evidence and opinion-presented-as-fact. The only good section in the post is the one on performance, everything else is nonsense. The claim that "Angular is preferred by server-side devs" is pulled out of his ass.
6
u/zomgwtfbbq Jan 14 '15
My anecdotal evidence is contrary to his anyway. Server-side devs see angular and are more-or-less, "hello. yes, this is dog" at the controls. Our front-end guys like it a lot.
I can't argue with the performance. Everyone knows there are things you have to do a "certain way" in angular to avoid serious problems.
2
u/darkpaladin Jan 14 '15
I've seen front end guys like it because it moves a lot of logic off the server and gives UI guys more direct control.
→ More replies (1)2
u/darkpaladin Jan 14 '15
I don't think angular ever claimed to have excellent performance, it claimed to make things easier. I've used it and enjoyed working with it but after the 2.0 stuff came out, I've stayed away from it. There's no clear upgrade strategy between 1 and 2 so basically I'd be building on what is a dead product.
5
10
u/KumbajaMyLord Jan 14 '15
The post is directionless ranting. I stand by that opinion. The few factual points (performance) are hidden in a circlejerkesque quotefest. The rest of it is mumbojumbo about frontenders and corporate IT without at any point clarifying or even atempting to characterize what these categories mean, or offering any factual evidence that the corporate IT influence on Angular is even the root of the performance problems.
Finally, the article offers no solution or alternative but merely shits all over the future roadmap while simultaneously dishing out a subliminal jab at the aforementioned unspecified corporate IT users "Either Angular 2.0 will still suck or it will become awesome and corporate IT users will not understand it".
So in summary, the author doesn't like structured frameworks, because he is too frontendy for them.
→ More replies (2)
2
u/ProdigySorcerer Jan 15 '15 edited Jan 15 '15
every company wants some Angular but there's so few devs that it's hard to find one ergo it's a shit framework
Perfect logic \s
Bearing in mind that the plural of anecdote is not data, I've worked on a lot of projects which used Angular with the back-ends being both Java and .Net the same patterns repeats the back end devs are meh at best about Angular while the front end devs are all over it.
Granted I started off as a back end dev and I think this has helped me with angular but I can still see a lot of goodies for the front end in the framework.
2
u/vz0 Jan 15 '15
This code reminds me of a simple server-side scripting language such as JSP or ASP that’s used to fill HTML templates with database content. These languages have their place in the web development stack — but on the server, not in the browser.
What? This makes no sense. Offloading the view processing closer to web browser is an excellent idea. From a performance point of view the server is less loaded. And you have some sort of API (either Json or some other) to send variables to the view.
Is like rendering a real time 3D application on the server. Maybe in the future, but today and from a performance pov it makes no sense.
2
u/sime Jan 15 '15
This makes no sense. Offloading the view processing closer to web browser is an excellent idea.
In think that the problem is more that all this string and template processing make sense when the browser and the server are separated by a network. Rendering templates on a server and sending strings across the network to the browser is easy.
When UI rendering and updating is done inside the browser you have direct access to the contents of the page and can manipulate it any way you like. The same way that a desktop application can talk to, and manipulate the parts that compose its UI. But instead of doing that these template based JS frameworks have dragged the old string-slinging ASP and PHP template approach across the network and into the browser itself. And there we are rendering strings and tearing down and rebuilding the DOM like crazy as though the data was coming in from the network.
Can't we do better?
1
u/Mr-Yellow Jan 15 '15
But instead of doing that these template based JS frameworks have dragged the old string-slinging ASP and PHP template approach across the network and into the browser itself
Can't we do better?
It's just encapsulation isn't it? Is there any way other than wrapping/encapsulating the reusable bit...
6
u/username223 Jan 14 '15
Also, their tutorial is a "super-powered" turd salad.
1
u/cybercobra Jan 14 '15
Is that lynx, or links2?
2
u/username223 Jan 14 '15
ewwinside Emacs, actually. But it's just as good at taming horrid websites.
2
u/kainsavage Jan 14 '15
The thing that bugs me is that Angular takes a simple concept like macro-esque mustache templating (where all {{foo}} are replaced by the value of foo) and completely shits the bed.
Example: let's say you want to have a default image in the case where a dynamically built image source is driven by a user's id:
<img src="/users/{{userId}}/avatar.png" onerror="this.src=/images/{{dynamicDefault}}.png />
Easy right? Using plain mustache templating (handlebars or some equivalent) this would just work. NOPE, because Angular is searching each dom node and replacing in known attribute tags (instead of the entire document) it simply doesn't check the onerror tag. You lose.
tl;dr - angular is worse than burger king
7
u/KumbajaMyLord Jan 14 '15
Angular is opinionated in some ways and one of those ways is how to add behavior to your app (and a fallback 'onerror' image is just that). Your example is not doing it the angular way, so it doesn't work. But claiming that this makes the framework bad is a bit like getting into a car with manual transmission and complaining that it won't accelerate like a automatic when you are not using the clutch.
3
2
u/holy_paladin Jan 14 '15
You shouldn't use src attribute of an image like that if you're using angular. Try ng-src
0
u/kainsavage Jan 14 '15
That's another gripe I have about angular - the angular-ism is to NOT use standard dom elements and their corresponding attribute tags (like
imgandsrc) but to use theng-model instead.When I want a simple static image, I should use the
ng-srcon animg? That is asinine.9
u/KumbajaMyLord Jan 14 '15
They are not doing it because of the heck of it, but because the unparsed markup is send to the browser and interpreted by it before Angular can swoop in and parse and replace the binding expressions correctly. So will first try to locate your image under the URL with the mustache-expression still intact. E. g. it will send an HTTP request to http://yourhost/users/{{userId}}/avatar.png instead of http://yourhost/users/12345/avatar.png
Angular uses special ng-* directives when using the standard HTML attributes causes some bug or if they need to enhance the default behavior.
6
u/awj Jan 14 '15
They are not doing it because of the heck of it, but because the unparsed markup is send to the browser and interpreted by it before Angular can swoop in and parse and replace the binding expressions correctly.
That seems like a perfectly valid complaint about angular, though. Other frameworks are able to handle this situation more elegantly because they don't send templates as raw html markup. This literally isn't a problem in any other framework I've seen, so it's a bit rich to imply that the source of the problem is anything but angular's design decisions.
4
u/KumbajaMyLord Jan 14 '15
Never said it wasn't due to angular's design. But I would disagree that it is a bad design.
Other pure client side frameworks do send the unmarked templates as well but they avoid using the native HTML attributes all together or have their own template language
2
u/holy_paladin Jan 14 '15 edited Jan 14 '15
You can use the src tag but your browser doesn't understand angular. It understands html/js/css. So as soon as it identifies a src attribute, it tries to load the image with the curly braces. That's just how browsers work. If you want to take advantage of what angular has to offer, learning its syntax is a small price to pay. You should be able to get a good grip on most of its concepts in a few hours. Edit: Shen'd. What Kumbaja said.
2
u/MaSaHoMaKyo Jan 14 '15
We've stopped using mustache-style templates entirely in the application I work on - everything gets an ng-bind or ng-model. Makes it much easier to find those elements in Protractor tests.
→ More replies (1)3
u/developer-mike Jan 14 '15
And using onerror is an anti pattern. It takes two seconds to make this a directive
angular.module('yourapp') .directive ('imageBackup', function() { return { scope: true, link: function($scope, $attr, $elem) { var index; var srcs; $scope.$watch($attr.srcs, function () { srcs = v; index = 0; $elem[0].src = srcs[0]; }, true); $elem[0].onerror = function () { $elem[0].src = srcs[++index]; }); } }; }); <img srcs="[url1 + '/' + userId, url2 + '/' + userId]">There is some boilerplate in the directive is, but vim snippets generates it for me. Additionally, this isn't an inextensible usage of a callback attribute in my HTML, this is an extensible and tailored tag for having as many image fallbacks as you'd like, retrying the top priority images whenever the array bound in the tag changes. Try doing that with onerror.
Don't use {{}} templating within tags, except for in rare occasions. Directives are easy to write and far superior because they allow the creation of complex custom behaviors which (unlike in jquery world) are used declaratively and have their complexity 100% isolated from the rest of your code.
4
u/kainsavage Jan 14 '15
I get that I'm not doing it the angular way, but my
onerror="this.src={{}}"addition is a few keystrokes versus having to add a directive to my app for a simple fallback image.That's part of my complaint - angular takes something that has been well established and simply implemented and makes a huge issue out of it.
4
u/developer-mike Jan 14 '15
Your example is less code, but inherently limited. How would you make it retry the original image when the user id changes?
If you really want the fair example you can use
onerror="this.src='http:...' + angular.element(this).scope().userId"And it would be a terrible way of doing it
Integrating angular with non angular requires these (usually) thin little directives. But in my experience usually someone has already done the integration and made it available on bower. Its a limitation for sure but its never given me many problems.
3
u/kainsavage Jan 14 '15
Why would a user's id change?
Again, angular seems over-architected to handle these 0% edge-cases gracefully.
Yeah, I guess if a user had the ability to change his identifier somehow with an ajax request, I would need to easily change his avatar src attribute... but that's not ever going to happen.
4
u/developer-mike Jan 14 '15
A preview box showing details of the user you highlighted, for instance. Or a 'login as this user' button for administrators where the icon in the top corner immediately changes to reflect their acting role.
Perhaps I should've said if the user changes.
3
Jan 14 '15
I'm a Moodle administrator and one of my most used features is logging in as a user and seeing what they see.
Now Moodle doesn't use Angular, but it is an example of a project where changing user id's is important.
2
u/kainsavage Jan 14 '15
Whoa, I'm just saying that I have API-driven user data that angular supports via
{{foo}}markup, but only in select UNDOCUMENTED instances.Why support
<img src="{{userAvatar}}"/>but not<img onerror="this.src={{userAvatar}}"/>? No one knows because it's undocumented and seemingly arbitrary.2
u/developer-mike Jan 14 '15
Sorry, I got overly reactionary in the beginning. By the time I cooled off to concede over the last point, I should've reread and edited my more accusatory comments...and yes, you are right here too. 90% of problems are because things aren't being done "the angular way" which begs the question of why they had to create "the angular way". But personally I've worked through to understanding it and why it exists, and swear by it. Long process though.
3
1
u/sacundim Jan 15 '15
It takes two seconds to make this a directive:
angular.module('yourapp') .directive ('imageBackup', function() { return { scope: true, link: function($scope, $attr, $elem) { var index; var srcs; $scope.$watch($attr.srcs, function () { srcs = v; index = 0; $elem[0].src = srcs[0]; }, true); $elem[0].onerror = function () { $elem[0].src = srcs[++index]; }); } }; }); <img srcs="[url1 + '/' + userId, url2 + '/' + userId]">Wow, you can type over 1,200 WPM?
2
2
u/Creativator Jan 14 '15
When AngularJS was first created, almost five years ago, it was not originally intended for developers. It was a tool targeted more at designers who needed to quickly build persistent HTML forms. Over time it has changed to accommodate a variety of scenarios and developers have picked it up and used it to build more and more complex applications.
This really is the core issue. The design of the framework is not for developers.
We still hold the myth in programming that we can design a system ex nihilo, completely independent of any context from which it should emerge and be shaped by.
This is why I think Backbone is the best new thing in JavaScript since jQuery. It was first proven to solve problems in a large web app, then later turned into an open-source framework.
5
u/KumbajaMyLord Jan 14 '15
This really is the core issue. The design of the framework is not for developers.
It also couldn't be further from the truth. Angular was picked up by Google because an existing team there used it to rewrite their app from the ground up in a few weeks. Previously it was a hobby project by one of the developers of that team.
0
u/Creativator Jan 14 '15
Angular was picked up by Google because an existing team there used it to rewrite their app from the ground up in a few weeks.
How often does that problem arise? A good framework should demonstrate development velocity over the long term, not just at the start.
The rewrite culture is what is creating the crisis of Angular 2. If people rewrote their apps once, why not twice?
Is this not Bootstrap for apps?
4
u/KumbajaMyLord Jan 14 '15
The point I was trying to make was that Angular wasn't designed ex nihilo, but in a real project. It is used by hundreds of internal and external facing applications at Google. It was not targeted at designers, but at developers. It has shown that it solves real problems at Google, otherwise it wouldn't get funded after such a long time.
1
0
u/danogburn Jan 14 '15
The problem with Angular
Javascript
7
Jan 14 '15
Wow, someone just arriving from 2005. I would love to know how it feels to jump 10 years into the future. Is it all you hoped it would be?
5
1
-1
Jan 14 '15
Angular is like a php-library for javascript.
It has content & code intermixed.
17
5
u/strattonbrazil Jan 14 '15
No much more so than something like knockout. Both have bindings in the template and both can have the majority of the code in a separate file so code in the content is minimal.
4
0
u/ns0 Jan 14 '15
So eloquently put. I find angular to be a step backwards in webdev, it reminds me of the horrid old dates of Coldfusion, JSP and ASP. All of which are considered terrible practices now and even those still using .NET avoid using ASP's built in repeater or list or any of that non-sense.
At least the messed up Coldfusion, JSP and ASP systems would produce somewhat SEO compatible semantic code. Angular just outputs jibberish for search engines, and as said as I know its supposed to be used "only for single page applications", it's not, i see it on simple content websites way too much.
2
u/spacejack2114 Jan 15 '15
I don't know how you'd not mix code and content for anything more complex than inserting a few values. That's why templating languages have their own mini programming languages.
You can either introduce a new templating language or write your logic in whatever you're writing everything else in.
1
Jan 14 '15
I'll admit I gave up really quickly on Angular when I saw the output and couldn't sleep at night.
1
u/CadenceBreak Jan 15 '15
OK, so this is a site by a "mobile platform strategist" that doesn't launch with a mobile theme from android, effectively making it unreadable?
Credibility gone, didn't read.
-1
u/_pixie_ Jan 14 '15
Man I wish I could go back a year ago to all the Angular fanbois I had to deal with and say, "I told you this framework sucked, and it weren't for the 'created by people at Google' sticker it would of never been popular."
0
u/makis Jan 15 '15
you will be downvoted, because a lot of people are exploiting the fact that angular sucks to get high pay checks and won't let it go.
but they are ruining the life of all the rest of us.
I had to fight to NOT CHOOSE angular in a project I'm working right now inside a big corporate environment because they saw "a lot of examples" where "angular is great" and they all were some kind of todo app.
they didn't have a single clue on what they were talking about, just googled "web framework that will make me look smart in the eye of my boss"1
u/DuoThree Jan 15 '15
What'd you end up choosing?
1
u/makis Jan 15 '15
meteor
1
u/DuoThree Jan 16 '15
I've heard of meteor, and have tried angular and ember but I think I like ember better (mostly bc of its similarities to Ruby on rails in terms of structure and opinions). What is it about meteor that made you choose it?
→ More replies (1)
-1
u/frixionburne Jan 14 '15
Oh Christ this bullshit again.
The only problem with Angular JS is Angular 2.
0
u/cheeeeeese Jan 14 '15
i personally like a distinct separation of frontend/backend.
also, 90% of the load time on our projects is frontend. there just is no reason to offload responsibility from the server to the client.
-7
u/Ginden Jan 14 '15
Angular isn't widely used by any big IT company. Compare to superior framework like Ember.js that is used by Yahoo, Twitch.tv, TED, CodeSchool.
5
Jan 14 '15
Google isn't a big IT company?
0
u/Ginden Jan 14 '15
Google does not use Angular for any critical application.
4
Jan 14 '15
Adsense is their most critical application. That's where all their money comes from.
Also, you don't think their internal processes are critical to their business? Hmm, that's an interesting thought.
0
Jan 14 '15
[deleted]
14
Jan 14 '15 edited Jan 14 '15
How can anyone reasonably say that a framework that uses modern idioms such as REST, promises, etc. is targeted at Java users of all languages? Ask a Java developer what a "closure" is and he'll probably give you a blank stare.
You were doing so well until you reverted to stereotypes. We're well aware of what closures are (although if you asked us what one was, we'd have to check that you didn't say Clojure). As for REST and promises... for reals? Anyway, Java devs often write plenty of JS by hand, the server-side-only dev is a bit of a red herring in my (admittedly limited) experience.
But I can tell you why Java devs I've talked to like Angular JS
It has templating
It makes complex client side widget interactions trivial
It does that without a bunch of trips back to the server
It is designed for unit testability from the get go with its dependency injection
So basically, it's faster, simpler and testable.
5
u/stormblaast Jan 14 '15
The guy who wrote the article is just a fucking troll who doesn't understand jack shit of what web frontend developement past 1998 is like.
The cost of application maintenance should not be offloaded onto all their users’s browsers (we’re talking millions of hits per month here) — especially not the mobile ones. This job belongs on the server. This job belongs on the server.
I didn't get that memo, but if this guy says so, then we're screwed, all of us.
The problem is that there is no way for Angular to discover these instructions except by parsing the entire DOM, including all text nodes and attribute values — a very expensive process if there ever was one, especially on mobile.
It's not "parsing" the DOM, it's "traversing". Subtle difference there. As if a full server roundtrip + parsing and loading the entire HTML structure + running some freakish jquery stuff every request is "cheap". Everybody on mobile is on 4G these days anyways, right? I better go rewrite my code even though people are getting a good user experience even on slow network links.
We really shouldn't be spending energy on this guys ramblings, but fuck.
1
u/Eleandor Jan 15 '15 edited Jan 15 '15
It's not "parsing" the DOM, it's "traversing".
It's both. Angular may discover directives by traversing the dom after it's parsed by the browser (this cost is unavoidable, whether you render html server or client-side), but the actual directives still need to be parsed to figure out what {{remaining()}} is supposed to do. More often than not, angular will also need to create html nodes on the fly (ng-repeat).
I don't know how angular works internally, so I'm going to guess it's mostly a one-time cost, after which it's compiled into more efficient data structures, so I can't really tell what the real cost of re-rendering data is. My impression was that it's still pretty inefficient, all things considering. Then again, so is jQuery but nobody's complaining about that.
As if a full server roundtrip + parsing and loading the entire HTML structure
I can't know quirksmode's intent, but I don't think he's advocating a 90's style synchronous web either. Instead of sending JSON and then updating all those directives, you could just as well send HTML asynchronously and replace the outdated html. Still single-page, and only updates the parts of the UI that need updating.
I strongly believe - even if for no other reason than philosophical - templating belongs on the client side, but don't be so quick to dismiss his criticism as old man ramblings... Don't think that because it works well on your i7 quadcore that it's going to work well on my crappy mobile. I'm still a customer too.
0
Jan 14 '15
[deleted]
13
12
Jan 14 '15
React, mixed with Reagent, is looking like a decidedly good approach.
3
u/Enzor Jan 14 '15
I'm getting "Uncaught ReferenceError: React is not defined" and an infinite load animation in Chrome for: http://getprismatic.com/story/1405451329953 works fine in Firefox though.
2
u/skratlo Jan 14 '15
Could be because they're (stupidly) loading react.js from fb.me. It happened to me in the past.
1
4
u/ItsNotMineISwear Jan 14 '15
You can always use ScalaJS. It would integrate nicely with the rest of your scala
3
u/ponytoaster Jan 14 '15
Whatever works for your project and approach. Using one framework (or believing you can) for every project is bad practice. You should never say "I'm going to use x because its a good framework", you should be saying "I'm going to use x because it has y feature that we can utilise".
Edit: this isn't meant as a dig, more a general observation around angular (or any framework) that its the golden hammer and is "best"
1
0
u/ns0 Jan 14 '15
Straight static HTML and javascript with CSS...
If you need data from a server go grab it from a custom built API, those which can be built in any language you choose and isolated from views/rendering.
For example; largest online retailer? Has a script that generates and writes the HTML from a bunch of server side includes very build cycle. Then just uses javascript to pull from a heavily protected API, the API manages all user security, system security and the like.
For performance they regenerate html pages on insert into the DB for things like user comments or ratings. This kicks off a queue to rebuild the static HTML file and rewrite it. The Javascript API only needs to fetch what isn't already pre-cached.
It's simple, works with caching mechanisms on every OSI level, is well defined, easy to separate concerns. Dead simple.
The world is over-engineering too much, time to move back to something more sensible.
1
u/Seeders Jan 14 '15
None of that works if you need SEO. You can't generate content after the page loads or spiders wont see it.
4
u/redleader Jan 14 '15
Google can run js on their crawlers now. You can also serve a rendered version to bits.
1
u/lestofante Jan 14 '15
Google is a big fish, but not the only one. I also like to pretend they take account of js load and execution time
1
1
u/centurijon Jan 14 '15
Whatever you like and are comfortable with.
This is software, it is constantly changing. And everyone has their own opinion on frameworks, change, and the direction of change.
Just go with what feels right and solves your problems.
28
u/[deleted] Jan 14 '15
"In the last six months or so I talked to several prospective clients that had a problem finding front-end consultants"
I'm right here, where are you located?