r/webdev • • Nov 24 '14

2 years with Angular. Verdict: good enough (not really)

http://www.fse.guru/2-years-with-angular
54 Upvotes

43 comments sorted by

7

u/magenta_placenta Nov 24 '14

but it obviously has become the best solution for many many professional projects

You're making the mistake of assuming framework du jour === best solution.

1

u/khoker Nov 24 '14

I agree with your sentiments, but I think you meant to reply to a comment, not the parent.

-12

u/wdpttt Nov 24 '14

Angular.js is "good enough" for majority of projects, but it is not good enough for professional web app development.

I don't think so..

4

u/[deleted] Nov 24 '14

Hmmm, this reminds me of another comment of yours:

I can't say much about angular because I don't use it.

-7

u/wdpttt Nov 24 '14

You are right, I can't speak much about angular, but I know it very briefly.

5

u/Ventajou Nov 24 '14

I like bullet lists but that's just overkill...

Want performance? Architect your app for performance, if Angular's digest cycle kills your browser with a million row data structure nothing keeps you from handling that different as a special case.

Want maintainable and well organized code? Then organize your code properly, JavaScript is a mess for that, it's not Angular's fault. Again, architect your project properly, leverage some build tools, and refactor from time to time.

All of his complaints can apply to any software projects, I don't see what's Angular specific...

4

u/the9trances Nov 24 '14

Want maintainable and well organized code? Then organize your code properly

This right here sums up nearly 90% of Angular "problems." No framework is going to save you from yourself or your own poorly optimized, disorganized code.

Look, I get the critical eye people point towards Angular, but I've lived and breathed jQuery for years and now I've found Angular to have a huge learning curve.

But instead of griping about it being "a bad framework" I've reexamined my programming patterns and how I approach projects. It's a learning opportunity: I had to learn jQuery, now I have to learn Angular. And y'know what? It's actually awesome, and all my "problems" with it are really me forgetting my meat-and-potatoes Javascript behavior. It keeps me honest and forces me to study scope.

-12

u/wdpttt Nov 24 '14

Want performance? Architect your app for performance, if Angular's digest cycle kills your browser with a million row data structure nothing keeps you from handling that different as a special case.

I can use react and only react instead of angular and jquery which makes the app a mess.

Want maintainable and well organized code?

Read previous.

Then organize your code properly, JavaScript is a mess for that, it's not Angular's fault.

What??? That depends by how you use it. JavaScript only allows you to write bad code, but you don't have to do it. That depends on you.

All of his complaints can apply to any software projects, I don't see what's Angular specific...

I don't know how would you apply that to react? (of course react has a smaller scope)

1

u/Ventajou Nov 24 '14

I think we agree there... not sure where React comes in though as that blog post doesn't even mention it.

-8

u/wdpttt Nov 24 '14

I mention it.

11

u/[deleted] Nov 24 '14

Angular.js is "good enough" for majority of projects, but it is not good enough for professional web app development.

Yet you still use it and it's probably the most popular framework right now for making web apps.

I really don't understand the point of this article. It seems you have more of a problem with how YOU used Angular because you architected your applications incorrectly, but instead blame the framework for not forcing you into any specific conventions.

There are valid criticisms against Angular, sure, but it obviously has become the best solution for many many professional projects so I'm not sure you can reach the conclusion on your own that it's not "good enough".

4

u/Hoek Nov 24 '14

There's a good discussion going on at HackerNews: https://news.ycombinator.com/item?id=8651641

-6

u/wdpttt Nov 24 '14

I'm not the author, I can't say much about angular because I don't use it. But I know is "bloated" (contains a lot of stuff and has a complex architecture and moving pieces). I also dislike the dual binding and the templating engine. I prefer react.js because my views are pure js, no jsx and is more robust* (*This is my point of view and of course I might be wrong because I didn't even touched angular, just saw the docs and some examples)

Also I'm very biased toward react.js and I can't see another lib that can make me change. Om is very interesting but is not pure js. https://github.com/swannodette/om

3

u/evildonald Nov 24 '14

Interesting points about react. One of the things that is turning me off angular ist he fact you have logic and code hooks mixed into your mark-up.

I havent' used Angular enough to see if there is anyway to define that stuff by only using javascript, but I will look at React as well.. why do you like it so much?

-2

u/worldDev Nov 25 '14

If you have logic in your markup you are not using angular correctly.

6

u/[deleted] Nov 25 '14

Really? Ng-if, ng-show, ng-class, and ng-hide are examples of putting logic in your markup. These are out of the box directives. Please explain how using these is not using angularjs correctly.

Don't get me wrong. I do like me some angularjs, but it definitely has logic in your markup in its normal use. Maybe I'm wrong here.

1

u/worldDev Nov 25 '14

You don't put logic in any of those, you put a variable or function that returns a boolean. You put the logic setting that boolean in a controller.

1

u/[deleted] Nov 25 '14

I'm not trying to be rude here so please don't interpret what I'm saying as such, but I don't think you're understanding what I'm saying. ng-if (and the others I referenced before) by itself is an example of putting logic in your markup. This is something that was designed by AngularJS.

It doesn't matter if you put a boolean in there or a function, you still have to look at your markup to see what is happening to certain elements (hence the logic being put into your markup).

But you're right in that you shouldn't be putting a bunch of custom logic into those directives, but I think it's fine to put something like "boolean1 && boolean2". I'd definitely let those booleans get set in the controller (or a service).

1

u/worldDev Nov 25 '14 edited Nov 25 '14

In any templating you need some identifiers in the template to declare objects of logical significance. I don't really see it any different than that. ng-if isn't meant to be used as a logical component (hence there is no else). It is an alternative to ng-show that will prevent children being instantiated. I do understand what you are saying, and I see where people are coming from when they say this. However it all stems from people using angular without knowing how it works and how it is supposed to be used. It is very easy to misuse, I'll admit that.

An example of how to use it <div class="profile" ng-if="showProfile"></div>

In the controller you have

//logic

scope.showProfile = true;

I'm not sure how that's any different from using an ID in the DOM. If anything it makes your views more descriptive.

And you aren't being rude, it's a valid discussion and I like hearing points from all sides. A better example for your point would be ng-init, but even the docs say not to use that for anything other than scope specific variables of ng-repeat.

2

u/evildonald Nov 25 '14

So you can use Angular without using ng-someattribute in the markup?

-1

u/wdpttt Nov 24 '14

I will soon make a post, now I don't have time. You might also look at my comments you might see my answer somewhere else.

1

u/RandyHoward Nov 24 '14

I know is "bloated" (contains a lot of stuff and has a complex architecture and moving pieces)

All frameworks are bloated. They have to contain lots of stuff that you might never use, but that stuff needs to be there for the people who do need it. This is probably the biggest downside of all frameworks in existence.

-5

u/wdpttt Nov 24 '14

Compare it with react.js. I know is subjective, but it doesn't "feel" bloated. Almost all the API in 2 small pages.

3

u/rq60 Nov 25 '14

Compare it with react.js.

Okay.

http://fb.me/react-0.12.1.min.js (127 kb)

https://ajax.googleapis.com/ajax/libs/angularjs/1.2.27/angular.min.js (105 kb)

That's quite the feat making Angular, a bloated framework, smaller than React (which isn't even a full framework).

0

u/wdpttt Nov 25 '14

I'm not speaking about file size. I'm talking about its API breath

1

u/rq60 Nov 25 '14

Actually, it appears you've mostly been speaking about "feelings."

1

u/wdpttt Nov 25 '14

You are right, I don't speak objectively about angular because I don't know it. But I've already looked at angular docs in 5 minutes and seems huge compared to react.js.

2

u/joshuacc Nov 25 '14

React isn't a full framework. It's one building block for a framework.

6

u/jmking full-stack Nov 25 '14

I find Angular is a very productive framework. It provides a nice, opinionated way to built SPAs. Once I understood how directives worked, things came together quite nicely.

When I read things about people running into serious performance problems with Angular and I hear things about trying to bind thousands of rows all I can think is "no shit".

If you're trying to bind thousands of rows all at once, you've got a stupidly designed app problem, not an Angular problem...

6

u/evildonald Nov 24 '14

All i hear about Angular is rainbows and sunshine. I'm glad to be able to read a counterpoint argument.

This feels like a blog entry I'd write :D

2

u/[deleted] Nov 24 '14

So...I don't know AngularJS since I am just starting web development, but I have chosen to start with Django.

Given my lack of my lack of experience, I have an honest question:

What benefits (if any) are there for using AngularJS instead of a templating system such as Jinja2?

At face value it seems, from my limited perspective, that frameworks that support templates solve the same problems as AngularJS but also have a more distinct separation of the backend from the front.

But, like I said, I have a very limited perspective so I was wondering if anyone could provide some insight for a novice like me.

2

u/mongopeter Nov 24 '14 edited Nov 24 '14

No need for full page reloads (server-side view), you simple fetch the data as JSON from the server and the DOM will be updated by Angular. This enables more app-like behavior --> SPA (Single Page Application). It's also not Django or Angular. If you use Angular, Django just has less to do. Django has to provide an API which you can use in your AngularJS app to fetch the data you need. There's just a lot more going on in JavaScript than in Python but the responsibilites can be mixed as you wish. AngularJS in principle is like a smarter jQuery. While in jQuery a lot of DOM manipulations have to be made by hand Angular will do this for you.


Jinja:

<ul>
  {% for user in users %}
    <li><a href="{{ user.url }}">{{ user.username }}</a></li>
  {% endfor %}
</ul>

in AngularJS it would look like this:

<ul>
    <li ng-repeat="user in users"><a href="{{ user.url }}">{{ user.username }}</a></li>
</ul>

As you can see {{ value }} is even the same syntax for dynamic values.

1

u/[deleted] Nov 24 '14

Ah, SPA and no need for full page refresh is exactly the answer I was looking for. I hadn't considered them (I know about it but hadn't fully considered the application). Interesting.

But I guess I can now see some of the performance implications that would bring as well. JavaScript can get bloated fairly quickly.

1

u/the9trances Nov 24 '14

In my opinion, you need to be really solid on the fiddly behaviors of vanilla Javascript to dive into Angular without finding it frustrating. Because it's super easy to put together something really fast, which will suck you in, but then the difficulty curve gets super steep for a long time, and then it's kind of a "click" and it's awesome. So it gets better, but the deceptive ease at the beginning can rough you up.

I'd say someone who can, for example, have a conversation about objects, enclosures, "truthiness" and thus why you would use !!variable, and an ironclad understanding of scope at least hits the minimum for starting Angular. If someone can't, I'd say study those principles first.

1

u/[deleted] Nov 24 '14

Ah, I appreciate the response, but I think /u/mongopeter answered my question fairly well.

Thanks.

1

u/[deleted] Nov 25 '14

Use mithril.js :) clean, simple, fast.

1

u/Phreakhead Nov 25 '14

Just offering an alternative which has helped teams I've been on a lot: Backbone Marionette. It's very bare-bones, but has all the basics you need to build a fast, maintainable web app. And it's built on Backbone (really just kind of a framework to structure Backbone better), so if you know Backbone it's quite easy to get started.

26

u/[deleted] Nov 24 '14

[removed] — view removed comment

6

u/Fidodo Nov 24 '14

What's wrong with pointing out problems? I personally hate it when articles act like Angular is all sunshine and rainbows. All frameworks are going to have problems along with their benefits and we need to recognize those problems to be level headed about it all. It's bad to have only rosy articles written about a framework because it ignores or trivializes the cons, and those are just as important as the pros when picking a framework.

8

u/arachattack Nov 24 '14

I don't think he has to give us an alternative. Perhaps, the complaints are present in pretty much all the framworks that exist today. Rants like these provide opportunities for frameworks to consider feedback and iterate.

12

u/Nilzor Nov 24 '14

This really just sounds like a rant more than an actual article.

Please enlighten us on what defines an "actual article".

I for one think it was well composed and had a lot of valid points. I didn't know you had to name an alternativ to voice your negative opinion about framework X for it to count as an actual article on the internet.

4

u/rq60 Nov 25 '14

I for one think it was well composed

Really? I would be surprised if the author even read what he wrote given the amount of typos and grammatical errors.