Why junior developers are learning bad habits from Angular(javascriptkicks.com) |
Why junior developers are learning bad habits from Angular(javascriptkicks.com) |
Second and worst of all - it is a monolithic framework. As long as you just do things the "Angular Way" - you are fine. If you want to change or override something, you are in a world of pain.
If you are learning Angular - you are hardly learning JavaScript. The knowledge learned from it is hardly transferable to the next framework down the line.
To me it looks a lot like SOAP. Everybody is acting like they understand what is going on. But nobody really does.
I'm also confused how something like that is a top comment on HN and makes me wonder what is so different about me and the everybody else who felt the need to upvote that comment.
Makes me think back about that dev Klabnik made cry after making fun their open source project. I can't get over that last sentence of kuni-toko-tachi's comment.
> There is simply no way that you can say that you know Javascript and at the same time support Angular. None.
How does someone say something like that and not feel like an asshole afterwards.
It is a bit annoying though that there's so much misinformation on the web. About the only source I trust right now is http://shop.oreilly.com/product/mobile/0636920033486.do
Specifically, the builtin "stuff" makes it actively hard to XSS, and in SPAs that's job #1.
Is it an issue on an intranet app with a controlled stack?
I've been doing JS since Netscape and Angular since before Google. I support Angular. Guess I don't know anything about JavaScript though. Nothing.
If your goal is to nitpick about the reasons why a specific framework is not right for the job, then "mission accomplished".
If your goal is to create amazing products / services. And are willing to do anything to accomplish that, then sadly I think you're on the wrong side of the argument.
Angular may be monolithic and less flexible, but if a young company gets to prototype faster with it and as a result survives to second- and third- funding rounds, they can afford the engineering hours to re-implement their UI from scratch.
Success (and its associated revenue) solves all engineering problems in the long run.
These kind of statements always make me think the author is trying to be dramatic because they don't know enough about the subject to try to get their strong feelings across in any other way.
I've watched many ASP and ASP.NET developers struggle with more modern web methodologies such as restful web apis, client side MVC, etc and it's because they never took the time to understand the web, the browser, or javascript and let ASP take care of it for them since everything is server side and postbacks.
I fear it will be the same mistake again but made with frameworks such as angular where we have a generation of developers who have no idea how the underlying technology works.
I have yet to see an Angular project that doesn't qualify as tiny. For that purpose -- banging out some internal CRUDish app -- if it allows people to create working success, then it's a success. Instead people are busy arguing over the semantics of over-engineering a couple of text boxes, and that really is what leaves me boggling. Though of course, as is the nature of these things, there are over-dramatizing camps, and one month Angular is the greatest thing ever on HN, the next it's the demonstration of all that is wrong in the world. The reality, as always, is somewhere in between.
It wasn't that many years ago when people didn't even understand basic concepts like closures in JavaScript, or the power they bring. Now people are viciously arguing about the edges. It's all very surreal.
There is simply no way that you can say that you know Javascript and at the same time support Angular.
One of the most common features pushed by just about every framework (just saw it about React yesterday) is desperately, and leakily, trying to abstract Javascript into some sort of classic OOP language. Some of the most popular tools allow you to write in various compiled-to-JavaScript languages (TypeScript, CoffeeScript, GWT, etc). It's all very strange. But again, if JavaScript is treated just as a runtime, and if it works for a team, there is some measure of success.
Which is wrong. And, I think, stems from the way CS is taught. Everyone starts with Java and learns that programming is all about knowing that a dog and a cat are just subclasses of the 4-legged-creature class, which is itself inherited from the mammal class. Wait no, that's not right now is it?
But it's how people learn.
JavaScript is a beautiful glorious language when you realise it's a weird hybrid between functional and OOP and is messy enough to let you do just about anything. It reminds me a lot of what I hear about Scala ...
You missed the point of yesterday's React announcement.
It's not at all about OOP.
See this:
JavaScript uses prototype inheritance and can fake classical inheritance, but it has its limitations.
I had the pleasure to learn about Pascal, C, C++, Smalltalk, Caml Light, Prolog, Algol, PL/SQL and Java, as well as, their respective paradigms.
Microsoft tried to fight back with Silverlight, but given up.
Well thats the thing, they don't because thats what the senior devs are for, and learning that stuff is part of becoming a senior dev. I just don't see angular making any more developers who don't really know the core of their technology than any other "generation"... I bet the exact same things were said about jQuery 8 years ago.
"JavaScript originally didn't have a built-in class system. Every popular framework built their own, and so did we."
I was not making a comment on any new development or change in direction, just that React (a tool I don't use) admitted to also jumping on the pretend-OOP thing.
To be fair though, React never allowed inheritance (even in its own class system) so it's a bit misleading to compare it to other frameworks where (pseudo-)inheritance is one of the valid ways to reuse UI code.
Of all OOP, in my experience it's inheritance that doesn't play well with UI code at all—and React never allowed it in the first place.
Everything is possible. One step at a time. C++ and JS belong with COBOL.
Are there non-monolithic frameworks? I believe that's the main value proposition of using a framework: you don't need to think about how to organize things because it's the framework's job to provide you with square and round holes, all you have to do is provide the square and round pegs. I am not saying that framework is better than N libraries. I am saying that that is the framework's value proposition. Honestly, I tried helping someone with a Backbone project a while ago. The first thing you have to do when using Backbone is apparently learn a dozen or two of really random names (I swear JS project names are generated as `englishNouns[randInt(englishNouns.length)]`).
The knowledge gained from using Angular is as transferrable as the knowledge of jQuery: it's not straight JS, but if you understand what it does under the hood you can switch to a different library rather quickly.
Lastly, Angular has something that many other frameworks don't: a commercial backer. This means that it's not likely to just bitrot on GitHub for years when the original author loses interest.
Google's track record is hardly impeccable in this regard.
Bootstrap is not the "open web stack," whatever that is supposed to mean. And it's a little amusing to hear that the past six months I've spent using Bootstrap in Angular didn't actually happen.
> If you are learning Angular - you are hardly learning JavaScript.
Of course. But nobody says, "Hey, learn this Angular thing, and then you'll understand JavaScript." You must know JavaScript first, and learn Angular second.
I am curious what you consider to be the open web stack and why you think that Angular is not "compatible" with them. In my mind, it includes things like Linux, Apache, possibly Nginx, MySQL, languages that begin with a "P" and some other letters, etc. None of these remotely have incompatibilities with Angular. You want to sprinkle in some jQuery with Angular on the front-end? That's fine too, if you want.
As for moving off of Angular causing a world of pain, the same could be hypothesized as likely if moving from any set of patterns to a new set of patterns. I would not discredit it for providing a set of patterns, it is a framework and that is the point. Also, as for learning Angular versus learning JavaScript -- the same goes for most frameworks. You can learn the framework, and you can also learn the underlying, lower-level details that implement the framework. The two are not the same.
Doesn't work with Bootstrap? What? Sure it does. You can use any CSS classes you like, and as for the Javascript components, although not necessary there are even these native directives from the AngularJS team to make things easier:
http://angular-ui.github.io/bootstrap/
I am not going to touch your last statement. :)
We have had shit like this circa 2005 - when jQuery started hitting the mainstream.
And monolyths had to cede their ground to small specialized frameworks that would be built for fast deprecation and mixing with other stuff. Sort of the UNIX way.
Angular is causing just as much damage as GWT, ASP and others did in their day. IMHO.
To address your comment about knowledge not carrying over to the next framework down the line, what framework isn't like this? You always spend time learning the nuances of a framework that are never transferable.
That having been said, the criticisms about it being an enterprise framework that's hard to move off of are spot-on. But lots of people prefer a one-stop solution to cobbling together an open stack---less flexibility, more out-of-the-box functionality.
2: What do you need to do in the front end that can't be accomplished the 'angular way'? I'm not sure you understand what monolithic really means. The beauty part of angular is that you can use it as little or as much as you'd like in your web applications.
3: Angular 2 is going to be preeeetty much only ecma6. Also, understanding angular means you understand AMD, digest cycles, etc... totally applicable to other frameworks.
4: What are you even talking about?
Why in the world would you say that
Regarding your other statements - you are saying the same things I am. I can do everything I could do otherwise, just at the expense of a lot of overhead I would not have if I didn't use Angular in the first place.
[1]: When it materializes.
Edit: > understanding angular means you understand AMD This is a load of bullcrap. __Nobody__ understands AMD, it is a cargo cult. Just like the SOAP was. And yes I think Angular (in its present form) is a cargo cult. That's what I meant with the SOAP thing.
For the record I use RequireJS on pretty much every project nowadays, but not because I like it - merely because my clients want to use it.
No I haven't and will refrain from doing so. Although I am tempted to invest more of my time in it, because I can smell some phat consulting opportunities from everybody and his dog having a big, slow, badly architectured Angular app and searching for an "Angular Expert" to help them get their shit in order.
However I am not ignorant about it I have invested nearly a month into it and worked on implementing my usual TODO Demo App, which I gave up on eventually, because it became clear to me that it has nothing to offer that I would want from it.
Yup, I don't get it. I guess not only am I eternally doomed to be a junior dev but also am being compared to a child, a monkey typing at a typewriter, but also someone who doesn't know JS at all. Feels good man.
Other than some horribly obtuse undefined checking, there's no explanation of what the problem is. The argument seems to be that the controller depends on $scope. I... I thought that was the point. From the first line of documentation on controllers:
>In Angular, a Controller is a JavaScript constructor function that is used to augment the Angular Scope.
If the idea is that this is a bad habit to bring elsewhere, fine. Some more explanation would be nice, but whatever. But the implication is that this is a trap within the context of Angular dev itself.
Dismiss this article. It's a waste of time and energy. In fact, I really shouldn't even be wasting my time commenting on it.
Seems pretty evident from the horrible jankiness of this blog. Heavy as shit and it loads on the 5th try.
$scope.displayName = function () {
if ($scope.anonymous()) {
return;
}
$scope.displayName = $scope.name;
};
I have no idea how that's related to Angular, though. It looks like it's just bad programming practice.Angular has some great stuff, and some really necessary ideas and principles that were sorely needed in Javascript. I love working with it, most of the time. But it also has some serious design errors.
This blog post is pretty horrid though.
I find myself moving more of my code into pure JS & borrowing concepts from languages like Java (interfaces, abstract classes, etc.) to increase agility in the event I want to move towards using a different library/framework. I gave a talk related to this idea of a frontend SOA about a week ago - here are the slides: http://slides.com/wesleycho/soa-angular
Here's a good writeup: http://toddmotto.com/digging-into-angulars-controller-as-syn...
"Overuse of the eventing system ($watch, $emit, $broadcast) leading to performance problems and memory leaks and not realizing it or being able to debug it"
Blindly overusing most features in frameworks or libraries can cause performance problems. Which memory leaks?
"Writing Controllers and Directives that take dependencies which make them nearly impossible to test."
Doesn't dependencies in general make any code harder to test?
"Views that are heavily dosed with logic - but more on that later"
I certainly don't feel my views are dosed with logic? Which kind of 'logic' are you referring to here? Is there something preventing you from moving your logic outside of the view?
"Their first experience of DI is quite often that in Angular and it's horribly broken. Since the "patch" which fixed the minification issues, it's still really just a square peg in a round hole with woeful support for scope and lifetime and features which most DI gives you for free such as child containers. They end up hating DI and shy away from it on other projects."
This seems like wild speculation here, as well as not being very specific (how is it broken?). I'm sure DI in Angular could have been done in a more elegant way (I have no idea how), but I don't seem to run into any problems.
"Strange bugs that (when called over) have us all scratching our heads until one of use realizes - oh yeah, sorry we forgot to mention that pretty much everything passed around is global, and Directives etc. aren't namespaced, so I see what's happened - you've got a naming collision there"
Not sure what to respond here - you had a bug in your code and discovered it was due to naming collision. Do you run into this daily? I've run into 'strange bugs' or at least hard-to-diagnose bugs in almost every framework or library I've used.
None of these issues seem especially unique to Angular. I'm not saying Angular is a perfect framework, but my own experience have been mostly pleasant, and I don't feel that there is anything in particular in Angular vs. other frameworks or libraries that encourage bad behavior - juniors or seniors.
Cool page, bro. I guess you don't really want people to read it.
edit: seems to be working anyway.
One of the big motivators for this follow-up post is due the the cries of FUD. Of course it's just my opinion, but I like to back my opinion up with facts if possible and it seems there were some questions cropping up around how much of a problem it geniunly is versus me just having a whine about it.
In all fairness I'm excited about Angular 2.0, but it's just too far off to quantify its use just yet. So it's not that I'm anti-Angular, I'm just anti-Crap, and there is a lot of that in the first incarnation I'm afraid, and it's biting too hard to ignore.
I hope my next post will be a lot more cheerful :)
AngularJS has an amazing success/failure story. The developers have managed to get their technology used by so many web development teams whilst being extremely over-engineered and having a very steep learning curve. Why did so many of us get enamored with it in the first place? The power of Google?
I was not part of the crowd that made this comment at the outset of the first article but I would say that the second article only confirms the suspicions of these readers.
Identifying a treacherous design pattern is one thing. To say that a particular pattern says one thing or another about the skill or scale of a particular developer is another. Especially in the land of Javascript frameworks where the flexibility to do and incorporate anything can be a serious poison pill.
I have worked on and lead two teams that implemented angular projects, on the first we moved into it as a group of relatively experienced developers. In the second we on-boarded a number of junior developers. My experience with the junior developers was that they took their queues pretty quickly from the work of the senior developers.
In particular I have never seen this particular pattern in our code. I have found that the tendency to want to break the angular paradigm with outside JavaScript or angular library injection overkill are much more common practices that we end up needing to spend time quashing.
I tried learning Angular because people at work started using and hyping it beyond measure. So I thought 'ok' this got to be really good stuff.
And it was good, _if_ experienced people held my hand. Otherwise I got lost in a soup of what seemed like unnecessary terminology -- $scopes, controllers, digest cycles, dependency injections, directives, and so on.
It kind of brought back memories of first generations of Enterprise Java frameworks (you know the factoryfactorymanager joke...)
So I have seen Angular work easily for already experienced devs who knew web front-end development very well. For me, what I really like is React. Ever since watching Peter Hunt's video one or two years ago, the idea of the virtual DOM and how events propagate made sense and was small enough to fit in my brain. I was able to go through some tutorial and do a few toy project in my spare time.
Anyway, if you care for another data point, there it is.
I think the difficulty of Angular is largely you have so many tools available but it's hard for a junior developer (like myself) to recognise when each should be used.
Don't blame the tool blame the fool :).
I have come to learn that the majority of people who say they work in a particular system have actually only ever dabbled in it.
It is painful to read articles like this where even the author misunderstands the pattern and failed to read some of the standard literature on the topic. Just because MVVM is hip now does not mean everyone needs to reinvent wheels.
I almost wonder if it was made like that as a joke.
DI in Angular was the first time DI made sense to me. And it makes testing really staightforward: test the component you're on top of, mock and fake the rest. Lots of boilerplate, but no actual hassle.
Binding to event emitted by an object on another object, then deleting the receiver, can cause a memory leak if you don't unbind first.
From what I've seen, consistently across frameworks that support the pattern, that you need to de-register your listener before releasing it from memory.
Pretty funny to think, I'm a "junior" developer and even I know that you have great power, but also responsibility, in the observer pattern.
I strongly suspect people were writing those blog posts because Angular worked for them in a way that alternatives had not; I hear that's how things get popular sometimes.
I didn't even try to mount a serious inquiry or evaluation - it was like an opinion steamroller. I really hated that feeling, but I was actually okay with the choice at the time because I wanted to learn Angular. I just remember being spooked by the total consensus that it was what we would use.
The weird terminology almost helps, especially if you're coming from a server-framework background where your Ms, Vs and Cs are pretty different (due to the difference between request/response and UI design) from the same terms in a client-side framework. I am not going to confuse $scope with an ActiveRecord model. Most of it, in any case, works a bit like this (or did for me when I was very junior) - 'if it has a dollar in front of it, it does Magic Stuff with little or no human intervention.
No, the learning curve is very flat - until, as the OP says, you hit a brick wall.
All that said, IME it is possible to properly organise code in an Angular app, get logic out of views and so on. But it is dependent on you knowing a bit about application design. The easy option is to turn scope into a god object and have a 500 line spaghetti controller.
Similarly, if you haven't tried for 100% test coverage, dependency injection seems needlessly complicated, and if you haven't had to nest dozens of HTML templates written by different developers using different patterns, directives seem way over-engineered.
The claim that's being lobbied against Angular, however, is that they were schizophrenic in their choice of implementations for all of their patterns, or to state it another way, that the same advantages could have been gained with much, much simpler patterns. Instead of building a nice clean framework, they built an auto-magical framework, and declared you must learn every workaround in the "Angular Way" to use it.
There are plenty of js frameworks now, many of which have analogous components to directives and controllers and views, etc. But while most, if not all of them, allow for the same advantages you've mentioned, few of them do so in such a complicated, boilerplate, and arbitrary manner.
And this is scary, because it looks like they're continuing this trend with a completely new "Angular 2.0 Way".
I'm going to go off the deep end here for a moment, but, back when I was in college, I took some marketing class where they discussed in depth the idea of user interface as a method of product lockin. The idea was if you built a product simple enough, but then obfuscated the correct method of usage correctly, you could make a product that was simple enough that new comers would be drawn to your product, but complicated enough that it would take so much time to master, that most who did so would actively desire never to leave as they were now the local experts. SharePoint really is a poster-child for this sort of dark design. And I think of this every single time I use angular, not because the ideas are wrong, but because of what simple things were implemented in a complicated manner, and what others were made auto-magical.
COM wasn't the last word on binary cross-communication either; for various reasons I see that sort of thing done a lot more often these days via building a RESTful HTTP service, even when the intent is localhost-only communication.
And now it says 500
> Error details are currently disabled. Please set StaticConfiguration.DisableErrorTraces = false; to enable.