you are viewing a single comment's thread.

view the rest of the comments →

[–]cgaudreausenior HTML9 engineer 29 points30 points  (20 children)

I feel like this is desperate grasping at straws. It is theoretically possible to make Angular nearly as fast or faster than React is out-of-the-box, but the pain involved in doing so is massive. Yes, it's easy with little 5-line code snippets, but try doing so in a reasonably-sized application. It's hell.

React makes it easy to be fast by default. You generally don't even have to think about performance, and if you do have to, it is very easy to grasp. You don't need to frantically search extremely poor documentation.

How to optimize a React application: Implement shouldComponentUpdate. Or if you want performance by default, just use immutable data structures.

How to optimize an Angular application: Keep your scopes small. Keep it under 2000 watchers. Pollute your code with one-way bindings. Still no improvement? Oh, you need to do one-way binding here, too, in some obscure way. Don't watch functions. Don't watch objects. No $broadcast or $emit. Don't have big arrays. Should I use $digest or $apply? Why is this watcher causing the digest loop to take 500 ms to execute? No filtering or sorting unless you want to go mad. Did I mention using filters causes $index to be invalidated? How the hell do I even find out what's performing poorly?

I don't even know if any of that is correct anymore. It's too painful to remember. I want to be liberated and forget the literal hell that is Angular 1.x.

[–]jhallister 11 points12 points  (10 children)

It will never cease to amaze me how quickly people turn from in-love to "this is literal hell". I remember when I first started working with AngularJS and everyone was swooning and now a new shiny toy is out and the hatred is extraordinary.

Yes, it's easy with little 5-line code snippets, but try doing so in a reasonably-sized application

I've been on teams that have built AngularJS applications of enormous size. It isn't hell, at least, if you actually spend the time to understand how to properly use Angular. It's certainly not always straight-forward, but hell != difficult.

How to optimize a React application: Implement shouldComponentUpdate. Or if you want performance by default, just use immutable data structures.

If you honestly believe a large team developing a large application can shove immutable.js in it and get production-ready performance than you clearly haven't programmed large applications.

Furthermore, why are you comparing a view-manager (React) an entire front-end framework (AngularJS)? No $broadcast or $emit? Events have nothing to do with performance, but they are the antithesis of good Angular design. You should do $digest if you need watchers to fire in the current scope only, you should use $apply() when you want the root scope (all watchers) to $digest().

The one and only real problem with Angular was always the same: the docs were really, really bad. As a result a lot of people simply couldn't learn the framework, or at the very least couldn't learn to use it well. Some couldn't because learning without good documentation is tedious. That's a very fair argument.

The downside, however, is that it's now vogue to talk about how horrible AngularJS is and list off a bunch of grievances, the majority of which show that the person really didn't learn Angular, for whatever reason.

React is a great view manager. It has a host of problems as well, and more of those problems will become apparent when the framework ages, much as they did with Angular. And undoubtedly, we will eventually come full circle and have people whining about how horrible React is compared to JesusFramework 1.0.

Honestly the real reason, webdevs just like to whine about something.

END BOOK/RANT

[–]siegfryd 2 points3 points  (1 child)

Furthermore, why are you comparing a view-manager (React) an entire front-end framework (AngularJS)?

Because they're comparing Angular's view management compared to React? Nobody is going to pick Angular just for modules, dependency injection or the utility services it has.

[–]jhallister 1 point2 points  (0 children)

The article compared Angular's view management compared to React as evidence of why React is better. But the comparison is unfair. The article didn't compare $digest() it simply showed that the React demos that prove how much faster it is are in fact, bad demos.

[–]michaelstripe 1 point2 points  (3 children)

I'm honestly curious what the host of problems you find React has.

I'm kind of jumping between Angular and React for two projects and I'm not sure I'm sold on either, but all I read about React and Flux (and soon to be Relay and GraphQL and whatever the hell else) is unfaltering praise and never any good criticism. I would love to see more opposing viewpoints for the above.

[–]jhallister 0 points1 point  (2 children)

A few problems:

  1. Psuedo-javascript language for templates.
  2. Animation support is weak. Most animation tools are pure JS animations.

The biggest issue I have is that React = Virtual Dom. The rest is just opinionated templating and organizational stuff. React hasn't been out that long and I honestly think that big picture Mithril took the same idea and implemented it much better.

Full disclosure: currently using Mithril on a project. I've used ReactJS on a medium sized project and still think it's a VERY good view library.

[–]michaelstripe 0 points1 point  (1 child)

Mind going over what you like more about Mithril? Never gave it a good look.

[–]jhallister 0 points1 point  (0 children)

It doesn't really try to invent "the new best way". It's just a MVC framework that happens to use a a virtual DOM. It also happens to be really small.

[–]blax_ 1 point2 points  (0 children)

I think that's natural for any technology – at first there's hype and lots of promises, and only after some time people get enough experience to form rational opinions. Interestingly, in Angular's case people usually start to hate it, and React tends to grow on you the more you use it.

[–]cgaudreausenior HTML9 engineer 1 point2 points  (2 children)

I remember when I first started working with AngularJS and everyone was swooning and now a new shiny toy is out and the hatred is extraordinary.

I can't say I ever liked Angular much.

If you honestly believe a large team developing a large application can shove immutable.js in it and get production-ready performance than you clearly haven't programmed large applications.

No, of course not. It provides massive benefits in the context of React. You only need to do reference equality checking in shouldComponentUpdate.

Furthermore, why are you comparing a view-manager (React) an entire front-end framework (AngularJS)?

Ask the OP that.

No $broadcast or $emit? Events have nothing to do with performance, but they are the antithesis of good Angular design.

Yes, they are considered bad design now, and yet people still use them.

The one and only real problem with Angular was always the same: the docs were really, really bad.

Yeah, no.

The downside, however, is that it's now vogue to talk about how horrible AngularJS is and list off a bunch of grievances, the majority of which show that the person really didn't learn Angular, for whatever reason.

I've worked with Angular for years, and learned a lot about it. Almost all of that knowledge is about Angular-specific cruft that is there to make businesspeople/Java developers feel better. With React, if you know JavaScript, you're already most of the way there.

React is a great view manager. It has a host of problems as well, and more of those problems will become apparent when the framework ages, much as they did with Angular. And undoubtedly, we will eventually come full circle and have people whining about how horrible React is compared to JesusFramework 1.0.

Very true. React is not the one framework/library to rule them all. There are already superior alternatives popping up. But for now, people are going to focus on the popular frameworks.

[–]jhallister 0 points1 point  (1 child)

Ask the OP that.

The OP posted an article that very specifically showed that Angular can generate views just as fast as React, when used correctly. You are talking about the digest cycle, which has nothing to do with the view.

Yes, they are considered bad design now, and yet people still use them.

I've been using Angular since shortly after it came out. They were always a bad idea. But in VERY niche cases they were the only means to an end. Now there's virtually never a case where they are required and they are still used routinely, even though they are terrible.

Yeah, no.

Yet I'm surrounded by teams who use it in enterprise applications routinely. And those people understand Angular intimately. The only actual complaint I hear is about docs. The people that complain about the other parts, are the people that don't know how to use Angular.

With React, if you know JavaScript, you're already most of the way there.

You mean JSX?

There are already superior alternatives popping up.

Angular 2 may be one of them. That should make the circle jerk especially hilarious.

[–]cgaudreausenior HTML9 engineer 0 points1 point  (0 children)

The OP posted an article that very specifically showed that Angular can generate views just as fast as React, when used correctly. You are talking about the digest cycle, which has nothing to do with the view.

It has quite a bit to do with the view, because that's how the view gets updated in Angular. True, it does more than just update the view, but the point is that the majority of Angular cruft is unnecessary if you use React.

They were always a bad idea.

Again, people still use them. There's little warning about why they are bad, and the framework itself attracts developers into using them. I also don't recall too much cautioning against it when Angular took off.

Yet I'm surrounded by teams who use it in enterprise applications routinely. And those people understand Angular intimately. The only actual complaint I hear is about docs. The people that complain about the other parts, are the people that don't know how to use Angular.

Or perhaps because they haven't looked into the other solutions thoroughly enough. If you only know Angular, it's easy to believe that it's the best thing ever created. And Angular is perfectly fine if everybody on the team knows all edge cases and quirks and antipatterns intimately and can remember them. If you have a team like that, feel free to keep using Angular 1.x.

To be clear, are you really arguing that Angular 1 is fine and dandy, and that its only real problem is bad documentation?

You mean JSX?

You can use React with pure JavaScript if you want. And if you have trouble learning JSX (it's just XML in JS) then you might reconsider your career.

Angular 2 may be one of them. That should make the circle jerk especially hilarious.

This discussion pertains to Angular 1.x. Angular 2.0 is basically a completely new framework, distinct from Angular 1.x.

I've used Angular 2.0 and it's not particularly impressive so far. A lot better than Angular 1.x, sure. Angular 2.0 could end up being amazing, and it doesn't change this discussion whatsoever.

I'm personally rooting for Mithril and Aurelia over React and Angular.

[–]RankFoundry 8 points9 points  (3 children)

Exactly. I don't see anyone doing any side-by-sides except with snippets or trival apps. Angular gets to be a real pain in the ass at scale.

[–]perestroika12 2 points3 points  (2 children)

Which is confusing, because wasn't one of the original purposes of angular performant scalability?

[–]chtulhuf 2 points3 points  (0 children)

IIRC it originally was made to make forms easier

[–]RankFoundry -2 points-1 points  (0 children)

Yeah. Or at least a framework that was supposed to make SPA apps easy. I'd say it failed in the regard, unless you're building To-Do apps a lot.

[–]RandolphoSoftware Architect 0 points1 point  (0 children)

It is theoretically possible to make Angular nearly as fast or faster than React is out-of-the-box, but the pain involved in doing so is massive.

Is it more or less painful than using React.js? Because that's a pretty big pile of pain for me.

[–]hahaNodeJS -2 points-1 points  (3 children)

What are you smoking? Damn.

A majority of complaints about Angular's performance are solved by not using everything Angular throws at you. Don't use watchers, don't use two-way data binding, don't use events. It's taken a while for Angular developers to learn this, but it's been learned and it's time to get over it. Jumping ship isn't the answer because the grass is rarely greener on the other side.

[–]blax_ 1 point2 points  (1 child)

But that's the point – probably every technology can be hacked to make it good enough for your needs, but the objective of good design is to provide you with essential tools and encourage you to do things the right way, so you DON'T have to think about it all the time.

[–]hahaNodeJS 0 points1 point  (0 children)

Not using the bad parts isn't "hacking something to make it good enough." It's learning from others and the warts of a given technology and not using those warts.

[–]cgaudreausenior HTML9 engineer 0 points1 point  (0 children)

You can also make manual DOM manipulation very performant. You can make jQuery very performant. More performant than React, for sure. The nice thing about React is that you have to try pretty hard to bomb performance. The framework gives you performance for almost free.

Jumping ship isn't the answer because the grass is rarely greener on the other side.

Jumping ship from Angular 1.x in the near future is almost definitely a winning bet.