r/javascript • • Sep 15 '16

Angular 2 Final Released

http://angularjs.blogspot.com/2016/09/angular2-final.html
358 Upvotes

190 comments sorted by

View all comments

Show parent comments

21

u/Shaper_pmp Sep 15 '16 edited Sep 15 '16

You also left out the most important point - Angular is a framework, and with any framework almost everything is done "their way or the highway" (or at least, their way or you're off in the weeds of unsupported/second-class-citizen workflows with limited support and documentation).

React is a library, and - like any other library - if necessary you can swap it in and out for alternatives without completely reengineering your entire application.

Frameworks are convenient but fundamentally limiting because they dictate the structure of your application, so you're always trying to express both the problem and the solution in terms of one specific tool. With a full toolbox you can hammer nails, screw in screws and spread glue as appropriate. With exactly one tool in your toolbox you either severely limit the kinds of projects you can undertake or you inevitably end up banging in screws sooner or later because that's all you can do.

Composing libraries together takes more effort, but gives you more flexibility, allows you to avoid lockin more easily, and allows you to express your solution in terms of the problem-space instead of coercing you into a "one size fits all" approach that never really quite does.

18

u/pegbiter Sep 15 '16

React is beautiful.. in principle, but to actually do useful things with it you need so many additional libraries that the slickness is lost. You want ajax? You need an additional library. You want promises? You need an additional library. You want routing? You need an additional library. And god forbid something goes wrong and you have to trace through the documentation of each of these libraries and how they work with react proper.

In theory, sure I could pull out react and replace it with some other view engine, but in reality I'd be pulling out react and all the other react-based libraries and replacing/adjusting all of those.

Angular 1.x sure isn't perfect, but at least all the most basic tools you need for a web application are right there and I never have to worry about how $http works with $scope or whether $q is a compatible version.

8

u/theonlylawislove Sep 15 '16

in principle, but to actually do useful things with it you need so many additional

This is actually a benefit. You are looking for an opinionated Swiss army knife. With React, you do things what makes sense to you, not what the framework forces you to do.

5

u/pegbiter Sep 15 '16

I don't really see how it's a benefit, because React on its own is utterly useless to me. Sure, if I want to quickly mock up the standard 'to do list' test app and just demonstrate data-binding, yeah that's great. But I've worked on dozens of web apps, some tiny and some huge, and every single one has needed ajax, promises and routing, to some degree. Those aren't optional 'nice to haves', they're absolutely core tools.

React forces me to rely on a load of other libraries just for core functionality.

If you like that, then Angular comes with those benefits too. Sure, Angular has a router, but there are other Angular routers you can use too. Sure, Angular can do datetime formatting, but there are other directives (moment.js is absolutely brilliant) that extend that.

0

u/[deleted] Sep 15 '16

[deleted]

5

u/pegbiter Sep 15 '16

I just think comparing React to Angular isn't really a fair comparison. We should really be comparing React + Redux + Flux + React-Promise + React-Router to Angular, that's the actual real-world use-case. And at this point, I don't really see the benefit because I'm relying on all these libraries to do really basic things, and all those libraries rely on react, so I'm as tied down to React as I would be with Angular.

8

u/[deleted] Sep 15 '16

Why would you be using Flux with Redux? Why would you be using React-Promise in a toolchain that already transpiles JSX and can therefore shim ES6 and its promise objects? It's a disingenuous example and it weakens your argument.

1

u/theonlylawislove Sep 15 '16

The state part of React doesn't depend on React. The only thing built with React that depends on React is anything having to do with the views.

1

u/[deleted] Sep 15 '16 edited Sep 15 '16

Btw, this is from the Angular quickstart: https://angular.io/docs/ts/latest/quickstart.html

Building a simple "hello world" without anything fancy resolves to this:

"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"angular2-in-memory-web-api": "0.0.20",
"concurrently": "^2.2.0",
"lite-server": "^2.2.2",
"typescript": "^2.0.2",
"typings":"^1.3.2"

<!-- 1. Load libraries -->
 <!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
  System.import('app').catch(function(err){ console.error(err); });
</script>

Even if you can pick and choose, it's still a myriad of moving parts.