r/coding • u/Vburyi • Aug 19 '15
Why you should not use AngularJS
http://www.devbattles.com/en/sand/post-1640-Why+you+should+not+use+AngularJS56
u/armornick Aug 19 '15
The article is very opinionated (though I'm willing to concede that Angular is pretty bloated). However, this:
Just think to yourself, would they rewrite the framework if it already was good?
is an absolutely ridiculous sentiment. Sometimes, things just need a good rewrite to get rid of all the legacy baggage.
7
Aug 19 '15
Especially considering that Angular 2 is addressing some of the very objects the author is raising. I was concerned when Angular 2 news fist started appearing (compatibility breaking, new syntax) but I've made peace with it now. And with the new router it sounds like there will be a way to bridge old & new worlds.
The author finally advocates using something else entirely. And Angular 2 is something else entirely. Of course, if you want to use something else, today, then angular2 isn't a good idea. One day it will be, and people will be touting it as the newnew thing and dissing react. Or they'll be ignoring angular2, dissing react, and advocating for the NewFluxCapacitorEnhancedJSNewNewThing that doesn't even exist today. The idea that what is in vogue today will still be a thing is a stretch of the imagination.
3
u/Randolpho Aug 19 '15
Sometimes, things just need a good rewrite to get rid of all the legacy baggage.
And take advantage of new features not previously available in browser environments.
2
u/nidarus Aug 20 '15
While generally, you'd be right, I don't think it applies to Angular 2. It wasn't just a "get rid of legacy crud" rewrite. It's a completely new framework, with a radically different architecture and API. When the creators of a framework collectively abandon it, to create a completely different framework, it certainly does say something about the old framework (or at the very least, its creators).
29
u/RAL_9010_POWER Aug 19 '15
Don't read articles that start with "Why you should".
15
u/Notnasiul Aug 19 '15
But for that one called "Why you should not read articles that start with 'Why you should'"
9
18
u/MrSpontaneous Aug 19 '15
Some of these are legitimate criticisms (e.g. scope inheritance, for which there are workarounds), but others (Angular 2) are just plain disingenuous. AngularJS's codebase has been around for 5 years. The web was a pretty different place back then. JavaScript has advanced, and it's great that they're building the new version over the latest and greatest.
2
u/fakehalo Aug 19 '15
What has advanced with Javascript (as a language) in the last 5 years?
2
u/MrSpontaneous Aug 19 '15 edited Aug 19 '15
ES5 landed (as did 5.1), and ECMAScript 6 has just landed, which is a pretty hefty update to the language. Additionally, features from ES7 have started appearing in browsers, most notably
Object.observe.2
u/pxpxy Aug 19 '15
Which won't help you if you have to support a legacy app though
4
u/MrSpontaneous Aug 19 '15 edited Aug 19 '15
I agree that going from AngularJS to Angular won't exactly be a walk in the park. That being said, the Angular devs have listened to concerns about the lack of an upgrade path from 1.x to 2.x - certain components will be made available for 1.x so devs can start in that direction. However, the linked site just hurls hyperbole at this:
Soon the next major version of the framework will come out, which breaks backward compatibility.
True. That's why it's a major release.
Apparently, even developers of the framework realized that there is something wrong and decided to rewrite the framework almost from scratch.
False. [Edit for clarity: I wouldn't say that there's something "wrong" that necessitated a rewrite. Just that certain Angular features/semantics aren't needed now that we have ES6/7-y stuff today. Why reinvent the wheel?]
They don’t add new functionality, breaking backward compatibility a little, they rewrite almost everything.
False. Some things they haven't ported over because you get that from evergreen browsers/JS now.
It means that if you start a new project with the current version of AngularJS, then in the future you definitely will be overboard.
Depends on your definition of "overboard". Borderline statement.
Just think to yourself, would they rewrite the framework if it already was good?
Wat.
-2
u/redalastor Aug 19 '15
If they didn't realise something is deeply wrong with version one before they started to write version two then it is even more damning.
7
u/MrSpontaneous Aug 19 '15
I would disagree that something is "deeply wrong" with version 1. I would say that, if one were to write a forward-looking JS framework in 2015, they wouldn't develop v1.
-2
u/redalastor Aug 19 '15
I don't see how any of the listed shortcomings in the article were acceptable at the time it was created.
5
u/MrSpontaneous Aug 19 '15
"Deeply wrong" is more hyperbole. I'd say there were decisions (like with the whole factory/service/provider model) that may have seemed like good ideas, but haven't panned out now that the framework is in the wild. Those could easily be removed in a v2 without necessitating a rewrite. The OP, however, is arguing that these issues are the reason for the huge break.
-2
u/redalastor Aug 19 '15
Having worked on a non-trivial app with this framework, I disagree. It is wrong on a fundamental level.
4
u/MrSpontaneous Aug 19 '15
Having built several non-trivial apps with this framework, and developed several nontrivial apps prior to it existing (w/ jQuery, Knockout & Backbone), I disagree with your disagreement ;-) Looks like we're at an impasse.
4
Aug 19 '15
well, no, but neither will the author's rant. Although if you can get past the POV, it's certainly a decent distillation of some of the bad practices and lessons learned. so perhaps that can help a person
Once upon a time I was writing state of the art, ultra modern c# web forms. And a coworker was like "hey have you heard of ajax? it's this newnew thing?" Things change. Somewhere there's probably some unlucky soul who's got to support that legacy app from 10 years ago, or they're going to rewrite it in react and mongo, shrug, who knows
1
u/dauchande Aug 23 '15
I was doing "ajax" back in the ie5/asp classic days. The technology has been around a long time.
Webforms was a travesty and set the microsoft stack back a decade.
2
Aug 23 '15
Still don't think they've recovered really. Razor was an attempt to do as right, and it was, and it's really great. But for me is solving the wrong problem. Their browser-side offerings are nil, and they ignored it for so long trying to create magic server-side solutions the last few months, with the project I'm on now, deleting all the mvp i can see so we can do it all client side. Angular ui routing is what mvc always wanted to be, is my opinion.
Though perhaps I shouldn't sat client side is nil... I'm using typescript and liking it quite a bit! And visual studio code, the text editor, shows quite a bit of promise.
But part of me keeps wondering what the alternate reality would be like, where there was no Web forms and Microsoft had spent all that time and effort making something that fit with what everyone else was doing instead of seemingly to resist it.
Ah well, we're here now, and I do love it when Microsoft is playing catch-up, they tend to produce some really great stuff when they're in that mindset and these days they seem much less evil
1
u/dauchande Aug 23 '15
Agreed, the .net core is very cool and the capability to spin up an aspnet docker container is awesome in so many ways.
You're right that Microsoft does their best work when they're behind, and man are they behind.
I'll stick to atom until vscode gets vim support.
1
u/Randolpho Aug 19 '15
You don't actually need that help, given that it's a legacy app. Don't update Angular and you won't need to deal with changes to Angular.
But, at some point, every legacy web app will need an update. The technologies that make the web are constantly changing. Browser change, new features come in, old features deprecate. Such is the nature of our industry
6
u/skeeto Aug 19 '15
What a truly awful website, especially for one focused on web development. In Firefox using the pgup/pgdown/space keys scrolls the content of individual elements in the page, not the page itself. In Chrome/Chromium, pgup/pgdown/space doesn't work at all unless I use the mouse to focus the main article. Finally, while I'm in the middle of reading, it throws a popup in my face and blocks me from reading.
5
u/Randolpho Aug 19 '15
I'd feel bad about giving that horrible article advertising revenue if there were any ads on the site that I could see.
As it is, I just feel bad that I wasted the minute it took me to realize it was junk.
5
u/fenduru Aug 19 '15
This guy is a bit angsty, but I agree with him on most of the points.
I think the biggest problem with Angular is that it does not scale for real/complicated applications. It holds up very nicely when you're evaluating it and creating a todo list, but once complexity is added in it is hard to keep things clean/nice.
This is especially true if you are, like myself, supporting other teams within the context of a larger enterprise application. There is a constant struggle between doing something the "angular way" which is declarative and generally prettier, or the "not so angular way" and get some actual performance.
I think Angular is great for simple websites with some dynamic behavior, forms, or the occasional widget. I would not advocate it for any full-featured applications.
17
Aug 19 '15 edited Aug 19 '15
wait, hold up... somebody decided to write an article in the second half of 2015 why not to use Angular 1 AngularJS? Wow.
Btw, don't use PHP4.
8
u/armornick Aug 19 '15
Angular 1 is still the best known, though. Most of the tutorials on the web are about v1 and the official website doesn't even reference v2.
3
Aug 19 '15
oh i get it, trust me. one of the bigger issues while project hunting for me right now is having only "Angular" as a job description even though they mean AngularJS. I put down AngularJS projects but would love to work with Angular.
Regarding no reference, "Angular" and "AngularJS" are two separate products so referencing it would be kind of useless... But yeah, kinda confusing if you want to start with Angular now.
2
u/SlowRolla Aug 19 '15
Just to be clear. You're saying that Angular 2.0 is good and Angular 1 for JS is bad, right? I'm using the nomenclature from the first Angular site you've linked.
2
u/foobar_dev Aug 19 '15
On phone so can't easily find the reference, but someone on the core team explained in a podcast that they are moving away from having JS in the name in general. Including it was an SEO based decision that proved unnessecary. Both projects are referred to as angular it's just easier to change references in the new version. I imagine when 2 is released the sites will be merged and this will be less confusing.
5
u/rok3 Aug 19 '15
No, someone decided to plagiarize the content of an article written in January.
https://medium.com/@mnemon1ck/why-you-should-not-use-angularjs-1df5ddf6fc99
2
u/anlutro Aug 19 '15
I can't tell if the PHP4 comparison is sarcasm or not...
3
u/Randolpho Aug 19 '15
Well.. you shouldn't use PHP of any version, but PHP moved from 4 to 5 more than a decade ago.
OP's point is that time marches on.
3
3
u/chillaxtv Aug 19 '15
This article broke all the Angular hipsters hearts :( only joking lol
Have you seen his conclusion? Either use Polymer; a library which is only compatible with evergreen browsers, and not to mention that web components aren't even a standard yet. Or use ReactJS; which only provides a view for a barthing up HTML. No controller. Probably a better router though.
9
u/Raptros Aug 19 '15
Oh, look! Another "why you should not use x" article.
Here's a tip:
Use what you feel is suitable for what you're trying to do. Do your research before you even start.
20
u/ThisIs_MyName Aug 19 '15
And these articles are a great place to start research. If you just google the framework name, you'll only get tutorials.
9
u/hearwa Aug 19 '15
Yes, I don't understand why this article is getting so much hate. The author is just highlighting issues he saw and as a beginner with angularjs I appreciate articles like this. I don't want to spent six months of my time working with a framework only to be burned by one the points he has outlined.
3
u/blood_bender Aug 19 '15
This is a very fair point, but in this case most of his points are moot if you follow best practices. I've never had any of the issues he's describing by following John Papa's style guide, with the exception of worrying about performance. If you need a lightning fast application, two-way data binding is probably not for you.
That said, for me, it's exhausting to have to google all the negative/positive articles on frameworks and mentally balance which came out net positive when deciding between them. I dislike this article because he provides no alternatives until the end when he just names all of the others you could've found by googling. An opinionated article on use x when.., use y when is one that's actually helpful to the community.
4
u/0ba78683-dbdd-4a31-a Aug 19 '15 edited Aug 29 '15
We all know the dangers of ill-advised decisions based on prescriptivism, so maybe we should write articles that start with "When you shouldn't use x" instead.
EDIT: Spelling
3
u/Raptros Aug 19 '15
I fully support this notion. Unfortunately, it's not the clickbait that these kinds of sites look for. :/
1
u/bart2019 Aug 19 '15
But how are we supposed to do our research if we're not allowed to read any of these "why you should not use x" articles?
4
u/m4tchb0x Aug 19 '15
Javascript is a weird language, Angular1 was build for javascript of today, Angular2 was build for javascript of the future. Thats why they rewrote it.
2
1
u/defpearlpilot Aug 19 '15
I'm surprised that whenever I see these types of articles, nobody ever mentions the name mangling. For me, the most difficult thing was managing the name changes when going from the html to the directives. The context switching that I had to do got incredibly difficult when my app started growing in complexity. Combining components was a nightmare.
1
u/KnifeFed Aug 19 '15
This article is written in such a weird way that I couldn't even finish reading it. Either the author doesn't have English as his first language or he's just not very good at forming coherent sentences.
-1
34
u/[deleted] Aug 19 '15
The text was posted at medium.com in january, written by a Egor Koshelko.
Why is this link just a copy of that text, credited to some "Steve Anderson", and why is there no mention of or link to the original article?