TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Complexity Creeps: Why I'm Concerned for the Future of Angular.js

96 pointsby bcrawfordabout 11 years ago

13 comments

wprlabout 11 years ago
I too think Angular is overly complex and &quot;magical.&quot;<p>The JavaScript world should be learning from the mistakes of monolithic and semi-monolithic frameworks such as ASP.NET and SEAM not trying to recreate them.<p>For my part I&#x27;d like to see separate libraries for events, views, models, syncing models to persistent storage, and binding models to forms. Small micro-libraries allow maximum flexibility and efficiency, and facilitate more maintainable code.<p>The way that Angular violates separation of concerns between presentation and view is another symptom of a monolithic approach, and a step backwards in HTML client software design.
评论 #7418776 未加载
评论 #7418710 未加载
评论 #7418628 未加载
edanmabout 11 years ago
While I do the think author makes too big a deal about this, I <i>very much agree with them</i>.<p>The main issue is whether or not we should be teaching people, as a first brush with Angular, to code things with &quot;automatic Dependency Injection&quot;, where the types are inferred from variable names. The alternative, and only way to code a &quot;real&quot; application, is to pass the names of things you want injected as strings.<p>For people unfamiliar with Angular, this difference means turning: myFunction(Dep1, Dep2) into myFunction([&#x27;Dep1&#x27;, &#x27;Dep2&#x27;, Dep1, Dep2) (more or less).<p>Doesn&#x27;t seem like a big deal, does it? But I think the decision to teach people the &quot;bad&quot; way to do things, all for the sake of making things &quot;simpler&quot;, is completely wrong, and misunderstands what kinds of complexity people have a problem with.<p>Complexity isn&#x27;t telling people &quot;write the same word twice, cause that&#x27;s how it works&quot;. Complexity is telling people &quot;here&#x27;s <i>another thing</i> you have to learn about this framework&quot;.<p>This is a small matter, but it isn&#x27;t trivial, and is a common mistake with Angular.js (hiding the wrong kinds of complexity).
评论 #7418581 未加载
AdrianRossouwabout 11 years ago
This is part 3 of this series of articles<p>1. i was wrong to be afraid of angular.js <a href="https://news.ycombinator.com/item?id=7384937" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7384937</a><p>2. why i was wrong to be afraid of angular.js <a href="https://news.ycombinator.com/item?id=7394959" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7394959</a><p>This is where i discovered the exact thing about angular that freaked me out the most, and how I was finally to get down in words what I felt about it.<p>I made a github issue about it, and the devs acknowledged the issue, saying it was no longer part of angular 2.0
评论 #7418564 未加载
ilakshabout 11 years ago
As far as the particular issue he picks on, he is making a big deal about something that&#x27;s not, at least if you accept the general premises of Angular, and trying to pin the core of his whole argument on that. Which is dumb.<p>Anyway, I have used many, many different UI frameworks on different platforms over the years. Including different .NET systems, Backbone, Angular and to some degree web components. And many other lightweight and heavyweight systems.<p>I am actually amazed that developers are not immediately seeing the obvious advantages of Web Components (with Polymer for now).<p>I am amazed that people are still trying to master AngularJS when we have Polymer. (At least the people who can tell their users to use a new version of Firefox or Safari, which is actually quite a lot of web apps these days, although obviously not all).<p>Angular is very obviously more complex than necessary.<p>Very few people are going to be with me on this, but this whole idea of separating out scope and avoiding global variables at all cost has got to the point where it is just ludicrous. And the only explanation is that this stigma about global variables has a religious and un-questioned association with incompetence. Unfortunately that particular cargo cult can lead to things like Angular DI.<p>Why aren&#x27;t more web developers excited about Polymer and Web Components? Because many web developers, despite experience with Angular, get distracted by DI and other over-complex topics and somehow fail to completely grasp the basic concepts and advantages of what a user interface component is and does.
评论 #7420200 未加载
评论 #7420182 未加载
评论 #7420850 未加载
carsongrossabout 11 years ago
It isn&#x27;t ready yet (another few weeks until a 0.1) but I&#x27;m working on a simpler UI framework that lets you bind HTML elements directly to REST-ful URLs, cutting out a big swath of complexity for many apps:<p><a href="http://intercoolerjs.org/" rel="nofollow">http:&#x2F;&#x2F;intercoolerjs.org&#x2F;</a><p>Again, <i>this is not ready yet and I&#x27;m actively changing things</i>, but if you are interested in an AJAX framework that is concerned with keeping complexity to a minimum, it might be worth checking out. Comments and criticisms very welcome.
评论 #7419212 未加载
badman_tingabout 11 years ago
I think DI in Angular should be an opt-in thing, too confusing otherwise. I&#x27;ve had moments where I thought I was just writing a regular function, and then Angular started throwing exceptions because it was trying to inject dependencies based on the argument names. (And the solution was to write a function with no arguments that returned the actual function with arguments!)<p>There are conventions around what string maps to what thing, so that sometimes strings like &quot;controller&quot; or &quot;provider&quot; are inferred and not required to be specified. This is bad -- things should just be referred to by their full names.<p>It would be nice to have the ability to ask for things directly in require-style function calls instead of having them be parameters to a function. It&#x27;s actually sort of crazy that you can define a controller (for example) with angular.controller(&#x27;MyController&#x27;, function(){}), but then you can&#x27;t ask for it back with angular.getController(&#x27;MyController&#x27;), or whatever.<p>All this makes it a lot harder to try things out in the console, and lengthens the feedback loop of determining what works and what doesn&#x27;t.<p>And I didn&#x27;t even know about the minification thing. That is legitimately terrible.
评论 #7418478 未加载
apinsteinabout 11 years ago
It&#x27;s interesting that he has a visceral reaction to the &quot;hackiness&quot; of Angular&#x27;s clever way to do runtime DI but no visceral reaction to the fact that the problem was created by a third-party program which was instructed to purposefully obfuscate the actual source code of his program before delivering it to the runtime... the JavaScript world is indeed a funny place.<p>That said, I am empathetic to his argument. But as a very happy Angular user, the benefits that are gained by having a runtime DI layer that works such that it can be built into the entire platform so far outweigh the one-time tooling change that it doesn&#x27;t bother me at all.<p>The rest is a slippery-slope argument that I don&#x27;t think is fair. If you trust Angular as a project, then you have to trust to some extent that they&#x27;ll make sane decisions. Since this particular clever hack is the only one that won&#x27;t get &quot;better&quot; over time as runtimes improve, I think that they deserve the trust so far.
评论 #7418355 未加载
camus2about 11 years ago
AngularJS is not complex , when I think complex , I think SpringMVC or Struts complexity. AngularJS has problems ,but complexity is not one of them, definetly.<p>Seems like JS programmers who only know JS think they can get away with ignoring patterns like dependency injection, Guess what, in order for code to be maintainable and testable it needs it.<p>Front-end is about GUI dev,and that&#x27;s where OOP shines. It&#x27;s high time for JS folks to read classics like &quot;Design Patterns&quot; books, and embrace SOLID principles , or AngularJS wont even help when developping their so called &quot;fairly large&quot; apps.
评论 #7420906 未加载
mericabout 11 years ago
The author is concerned about <i>the future</i> of Angular because of the idiosyncrasies of <i>one method</i> of including dependencies. I mean, really? Is it so bad, the stench of automatic dependency injection, it overcomes all other beneficial features of Angular, it would jeopardise it&#x27;s future as a web framework, such that it would lose compatibility with future browsers and your web app built in angular will stop working, with no support available? IMO it&#x27;s a bit hyperbolic to suggest this is the case.
评论 #7420869 未加载
jcampbell1about 11 years ago
This seems like a one-sided overthinking of the auto dependency injector (which is like 30 lines of code).<p>1. The auto DI means beginners can get to &quot;Hello World&quot; in angular without learning some wonky injector syntax. If Angular&#x27;s goal was to bring some of the jQuery crowd on board, then it was a smart move.<p>2. The auto DI doesn&#x27;t survive minification, so not all code can be copy-pasted, and there are two different syntaxes. Unnecessary complexity?<p>I see no reason to make a bunch of analogies to argue on one side.
评论 #7418553 未加载
grumblestumbleabout 11 years ago
- AngularJS is a tool for building complex single-page web applications, not brochureware. - If you&#x27;re building complex SPAs, you&#x27;re going to require a decent level of tooling. - If you have a decent level of tooling, the points in this article are meaningless.<p>As an aside, ngMin is the most trivial thing in the world to set up, and if you can&#x27;t figure it out, array notation is slightly painful but well worth it for all of the tools Angular provides.
klochnerabout 11 years ago
I still can&#x27;t decide if angular dependency injection is more amazing or revolting.<p>It&#x27;s magic, it&#x27;s non-intuitive, it breaks the standard paradigm that function arguments have no external significance, and it doesn&#x27;t add much real value by just saving one extra line per function - <i>inject(fn, ...)</i><p>On the other hand, it&#x27;s elegant if you ignore all the above criticisms.
评论 #7419603 未加载
Bahamutabout 11 years ago
I&#x27;m a huge fan of dependency injection, it makes life infinitely better when designing your code &amp; testability.<p>That said, I&#x27;m somewhat sympathetic to this complaint - it turns me off towards Backbone. However, I argue that it isn&#x27;t nearly as bad as views with Backbone. In addition, this is changing in 2.0 with a much cleaner injection mechanism.
评论 #7418797 未加载