Live data from Hacker News

The reason Angular JS will fail

okmaya.com

41–50 of 85 posts

Re: The reason Angular JS will fail

#42
I agree with this post. The worst thing about Angular is how confusing it is, particularly when it does not have to be at all. There are at least 10 things I can think of off the top of my head that are so confusing about Angular that could easily be much simpler that it tells me the framework creators must not care about understandabiltiy at all. I think for a JS framework this is a death wish, but we'll see.

Just some examples:

1. When you create a directive you initialize it with one of three different kinds of scopes. A parent scope (which is the actual controller scope object), a child scope (which prototypically inherits from the controller scope), or an isolate scope (which is an isolated scope with inheritance only to rootScope). If you don't explicitly define a scope you get a parent scope. If you write `scope: true` you get a child scope. If you write `scope: {}` you get an isolate scope. This is so fucking confusing for beginners. Why not just explicitly define what kind of scope you want so it's clear?

2. Every single example of learn AngularJS online, even examples from the 'official documentation' (that's in quotes because Angular's documentation is so atrocious that referring to it as documentation would be bastardizing the English language) give you examples of defining services, controllers and directives directly on the top-level ng-app module when in reality doing this is catastrophic and will make your app IMPOSSIBLE to unit test. You need to define services in their own modules that get aggregated into the ng-app module so you can unit test them, but there are no examples of that anywhere.

3. Speaking of unit testing, because it's supposed to be so easy in Angular right? You have this thing called angular.mock.module that's the key to everything. Now 'angular.mock.module' is different from 'angular.module' but is for some reason aliased to 'module' because that's not confusing or anything. Now you would expect for angular.mock.module to be just that, a mock module. BUT it's actually a module that depends on the angular 'ng' module meaning that it's not really a mock module at all, it's a module that includes the ENTIRE working Angular library. So you can use the 'mock' module to get the REAL injector and use that to get your REAL services which you put into the mock module to use in your tests. The entire flow is so confusing and non-descriptive that it's a wonder a beginner is ever even able to write a working unit test much less a good one. The funny part is all you hear about is "unit testing is so easy in Angular omgz" when really it's confusing as fuck but the Angular crew seems completely oblivious to that fact.

--- I could honestly write a book about my Angular rants, this is just barely skimming the surface, but the point is, Angular makes things hard and confusing when they don't need to be. I like the way Angular organizes code, but I'm willing to switch at the drop of a dime if something simpler comes along.

Re: The reason Angular JS will fail

#45

I think the author is right, if Angular stays how it is today. I've spent a lot of time trying to learn and believe in Angular. I've failed to be persuaded that it's the end-all, be-all that many people think it is. Nothing I've read--not the docs, nor ng-book--have successfully given me the mental model for what the heck is going on behind the scenes. I think directives are a horrible hacky mess. I recently struggle…

You've further reinforced my gut feeling of staying away from Angular at the time.

I'm a data guy, and I only mess with web apps to present my stuff. Recently I wanted to do a realtime map app to display tweets processed by some ML stuff I had built.

I started to look at Angular, got a headache, and then built it with Meteor. It was ridiculously, almost embarrassingly easy. I felt like it was 1996 and I was sneakily using Microsoft Frontpage to build my web page instead of hand coding it.

Now, I'm not an idiot. I understand that Angular is a toolkit for building things which are much, much bigger and more complex than anything I touch. But if they can make it easier with version 2, I'll wait until then.

Re: The reason Angular JS will fail

#46
post #32

We found that the Angular learning curve was steep and was difficult to bring new devs up to speed quickly. Our solution was to migrate from Angular to ReactJS. Much simpler, faster and better.

Simpler, yes, but simplicity often comes at the expense of power. What happens in a year, when you have a bunch of experienced developers, struggling to overcome the limitations of ReactJS? Most likely you'll end up reinventing many of the things that Angular provides out of the box.

It is always tempting to take short-term gains over long-term costs, and in some situations, it may be the right thing to do. A company that gets a product out of the door in a couple of months using ReactJS may beat a company that spends 12 months building a "better" one with AngularJS. But the reverse may happen instead: The company that adopted a simpler technology may become bogged down trying to extend beyond its limitations, giving their competitors a chance to accelerate past them.

It's the old story of the tortoise and the hare. Except, as with any fable, real life is never so clear-cut, and gains in one area will almost always be countered by losses in another.

Re: The reason Angular JS will fail

#47
Its an advanced framework for building larger scale sites. I've found that it scales well and my projects can be successfully transferred to other developers and they can jump right in.

Angular 2.0 addresses many of my complaints. I have a few legitimate ones.

Dependency Injection is being made simpler and I hope less fragile. If something goes wrong in the minimization phase you can easily get the dreaded module not found and your whole app/site is broken. But it makes testing clear and precise and its improved the quality of design of my sites and apps.

Simplify the directive API. Yep, its weird. Its fun when it works though. The ideas of directives will live on in other frameworks regardless. So Angular can't fail, it has already succeeded. Even if it dissolves into web components in the future.

When the animation system gets fully solved then I think angular apps will look/behave so cool that complainers will be compelled to learn it.

Really, its the Rails of the frontend. Which is both a compliment and a criticism ;) They both have too much magic.

[1] http://blog.angularjs.org/2014/03/angular-20.html

Re: The reason Angular JS will fail

#48
post #21

Apples and oranges...Coming from a backend developer background i actually found angular pretty easy to pick up. Most of the backend frameworks are much more complex. And angularJS is to be compared with application frameworks, not with a javascript toolkit to enhance static websites like jquery. Try to build the kind of apps you can build with angular in a few days with jquery and you will see what mess you end up w…

I don't think the argument is that jQuery can do the same things. I think the argument is that you can have two way bindings and a lot of the benefits without a lot of the complexity of Angular.

Re: The reason Angular JS will fail

#49
Completely disagree with the author, comparing jQuery to Angular is stupid.

It's similar to situation with php few years ago when Symfony2 and other big frameworks were introduced, many people still complain and they use simple non oop php to create websites.

World is changing, php changed and now javascript will change. Some people will stuck to jQuery but most will move to new mvc frameworks because they are much easier to maintain, also many backend developers is moving to REST architecture lately.

Re: The reason Angular JS will fail

#50
I agree that angular is difficult and docs poor. I think knockout has great docs and is easy to learn. But google trend both and clearly angular is winning and probably has won the mvc js battle. It defies logic but there it is.

50% of your article was about how jquery was superior and simpler than prototype and moo tools. It may have been superior but it's nonsense to say it was simpler. I used prototype alot and it was simpler. To grab a div you simply:

$("mydiv")

not:

$("#mydiv")

So much more elegant than jquery!

Prototype comes from a js perspective whilst jquery seems to come from a css perspective. So I think prototype is better for traditional developers and jquery for web designers.

Post reply on HN