7 ms·
Why junior developers are learning bad habits from Angular
- robertthegrey 12y agoApologies to those of you who might be having trouble viewing this on mobile - it's high up on the list to fix in the coming days
- warfangle 12y agoSo... Are they learning bad habits like serving 500 errors to mobile devices? ;)
- jasonwocky 12y agoHah! Shows what you know. I've got a 500 on my laptop, too ;)
- 300bps 12y agoYeah doesn't load on my Lumia 928 either. I bet OP is sorry he is missing out on the traffic from the 2.6% of mobile users that use Windows Phone.
- coldcode 12y agoCan't view it on Safari/Mac either, also 500 error.
- robertthegrey 12y agoThere was a lot of commentary on my first post https://javascriptkicks.com/stories/2657 https://javascriptkicks.com/stories/2657 about not detailing enough why I think Angular isn't good for junior programmers asking for more detail. Here it is. 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 :)
- colund 12y agoThe page is not loading properly for me (on a Windows laptop with Chrome). When I use the given link I get "500 - InternalServerError Something went horribly, horribly wrong while servicing your request. We're sorry :-(" and when I go via javascriptkicks.com it keeps loading and never completes.
- ishansharma 12y agoSame here. Windows 8.1, Firefox 35.
- ceeK 12y agoI somewhat assumed that the 500 error was evidence of the post's title, heh.
- sfjailbird 12y agoSeriously. Why do you need to run a shitload of JavaScript just to display a damn article.
- ExpiredLink 12y agoBad habits. Those JavaScript kids nowadays ...
- lohengramm 12y agoThought the same thing for the fun.
- V-2 12y agoIt's not the browser, it's a server error.
- igl 12y agoRefreshing the page worked for me.
- tragic 12y agoAfter I turned off µBlock, it loaded alright(Chrome/OSX 10.8). I know a lot of people here love them an adblocker, so that might be the problem. It seems to be blocking a JSONP call somewhere, and thus the loader spins forever...
- kuni-toko-tachi 12y agoThe central problem with Angular is what is says about the software industry in general - that a framework so fundamentally and ridiculously flawed could invite such wide appeal suggests that many people have absolutely no idea what they are doing. The thousand monkeys approach to engineering has wide implications for security and safety of systems that we rely on. There is simply no way that you can say that you know Javascript and at the same time support Angular. None.
- cozuya 12y agoThats a little hyperbole. I "support" it in that its an easy way for someone to make a typical web application without having to know the details of call vs apply, arguments, prototypes, etc, or writing a lot of boilerplate. So in that way I guess angular is for people who don't want to learn "javascript" - and thats what you see it being used for generally anyways.
- snarfy 12y agoAnd how do those developers deal with issues such as XSS, injection, untrusted JSON, etc if they don't know JavaScript? I agree with the OP. At some point it will come back to bite you. 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.
- cozuya 12y ago>And how do those developers deal with issues such as XSS, injection, untrusted JSON, etc if they don't know JavaScript? I agree with the OP. At some point it will come back to bite you. 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.
- yummybear 12y ago(sorry if this comes off a bit snarky) "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.
- eyko 12y ago"Blindly overusing most features in frameworks or libraries can cause performance problems. Which memory leaks?" 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.
- 12y ago
- radicalbyte 12y agoIs there a way to open this full-screen? I find the pop very distracting.
- robertthegrey 12y agoyes I'm working on that this weekend - also in an effort to fix the mobile issues. Full posts will display on the page on their own instead of the side bar like link stories appear
- davexunit 12y agoI wish I could go back in time and strongly oppose AngularJS at the last place I worked. Knowing what I know now, it was such a bad idea. I also made the mistake of adding it to a resume, too, so I have gotten too many recruiter emails about AngularJS jobs. 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?
- woah 12y agoThe overengineering actually led to success, as it resulted in a batch of non-JS devs thinking that they had discovered some secret magic. They went on to write a bunch of blog posts, which made people think it was good.
- fixermark 12y agoEnabling non-JS devs to create a rich experience website (even if it has performance and future-proofing flexibility issues) is secret magic. Never underestimate the number of non-web engineers who desperately want to make browser-accessible frontends to their tools without having to learn the "hell" that is Javscript. 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.
- Svenstaro 12y agoI agree with you on so many very painful levels. :/
- tragic 12y agoI don't think it does have a steep learning curve, really. I first tried it when I was a real greenhorn, having played around with backbone and ember and not really enjoyed the experience; with Angular you can be doing something cool in about 10 minutes. 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.
- deleted 12y ago[deleted]
- mcmillion 12y agoIt's like Kinja, but somehow worse.
- milankragujevic 12y agoIf anybody is having issues loading the page, here's a really long screenshot of the text... http://milankragujevic.com/uploads/2015-01-29_151409.jpg http://milankragujevic.com/uploads/2015-01-29_151409.jpg
- Matheo05 12y agoSorry but I got an "Error 1011, access denied"
- milankragujevic 12y agoFixed it. Probably.
- istorical 12y agoIt seems like what junior Angular devs really need is a post showing examples of both what NOT to do and also what to do INSTEAD. 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.
- thecolorblue 12y agoI agree, and this article does not really help. I feel that part of calling yourself a senior developer is teaching junior developers how to write great software.
- robertthegrey 12y agoAs I said in the post, you just need to google for it. Here's one I found that helps you with $scope: http://csharperimage.jeremylikness.com/2014/11/the-top-5-mistakes-angularjs-developers.html http://csharperimage.jeremylikness.com/2014/11/the-top-5-mis...
- guiomie 12y agoAnyone has an exemple on how to use the $scope properly ...? He only shows the wrong way of using it, but has no code for the right way.
- colund 12y agoYeah I personally think the page has shown bad habits much worse than Angular. I think AngularJS makes it REALLY easy to make SPA applications with data binding. I find it ironic that they bash AngularJS while their own site has (had) sever loading issues. Don't blame the tool blame the fool :).
- staticelf 12y agoInteresting, the title tells something about bad habits but as soon as I try to visit it I just get a "loading" message that never seems to complete. If something is a bad habit, that's how it looks like.
- jere 12y ago>Many would not even see the problem here, and just as children don't know cars can hurt, juniors don't know just how destructive this anti-pattern can be to performance, separation of concerns and long term code base maintenance. 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.
- cejast 12y agoagreed, some explanation on what's actually wrong here would be nice
- poxrud 12y agoOne thing that definitely can be improved is using "Controller As" syntax. It solves most of the $scope issues. Here's a good writeup: http://toddmotto.com/digging-into-angulars-controller-as-syntax/ http://toddmotto.com/digging-into-angulars-controller-as-syn...
- bphogan 12y agoThis article only did one thing for me - demonstrate that the author himself doesn't understand Angular or the problems. I don't know Angular that well myself, but the author knew anything more than I did, he'd be able to spend the extra 30 seconds to write the refactored code. 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.
- crdoconnor 12y ago
- v512 12y agoseriously, the website design sucks.
- MiddleEndian 12y agoAgreed. If you click out of the weird popup the article is in, you get a list of articles. If you click on one of those articles, a new window/tab opens in your browser, with a similar setup (article in weird popup), and if you click to the left of that, now you have two windows/tabs with lists of articles. I almost wonder if it was made like that as a joke.
- cpursley 12y agoIn other news "How junior developer was able to quickly ship their first SPA using Angular, satisfy client requirements and get paid."
- wnevets 12y agoWhy junior developers are learning bad habits from <insert anything here>.
- moron4hire 12y ago> the second camp, those that said I was just spouting FUD because I didn't explain myself in detail, which surprised me a bit because those are developers who presumably have been working on Angular and in my opinion should already know about the pitfalls and their effect on juniors. 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.
- rdtsc 12y agoI am not a web developer but I have been trying to keep up with the technology. 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.
- fixermark 12y agoUnfortunately, that issue isn't limited to angular: it falls under the general category of "If you haven't gotten burned by the problems a pattern is trying to solve, a pattern looks like unnecessary complexity." I'm reminded of when I had to learn COM back in the day; as a developer who had cut their teeth on programming on Macintosh followed by Debian, it seemed like needless complexity until I grasped the zen of the problem it tried to solve: providing a common protocol for different binaries compiled by different C++ compilers to share data structures and do inter-process communication in an object-oriented fashion without sharing source code. COM seemed way too complex to me because (a) in the Mac world, there was only one compiler that mattered (at least by the time I got into it), so binary incompatibility was essentially a non-issue, and (b) in the Linux world, if you needed two modules to inter-operate, you could meld their source code together. 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.
- ep103 12y agoI strongly disagree. The idea of a directive isn't unnecessarily complex because it isn't needed. And yes, there should be a pattern to force their use, for exactly the reasons you specified. 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.
- city41 12y agoI find it interesting that most negative Angular articles are so vague. Why is it so tough to articulate what is wrong with Angular? I agree Angular is not the best, but I don't have such strong negative feelings for it. I've used it successfully in the past and as long as you keep things simple and don't go overboard with all that it offers, you can create a decent website with it.
- treerunner 12y agoHmm. I think I'll check out what my boss blogged about today..
- yoanizer 12y agoI see a lot of hate, but I can't see the arguments.
- MrDosu 12y agoMVVM has been around for years and years. It's just newish to the JS scene. 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.
- lcfcjs 12y agoFix the site! this sounds interesting
- simlevesque 12y agoThe mobile site it is totally broken
- batoure 12y ago>those that said I was just spouting FUD 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.
- alblue 12y agoThe blog rambles and disables native scrolling. It's not worth your time reading it.
- cheshire137 12y agoI wish he had clarified what was wrong with stuff. This article wasn't helpful for me at all.