3 ms·
I think if a business needs to, I would recommend they move to React now - Angular 2 is shaping up to be quite impressive, and taking pretty much all of the les
by Bahamut 11y ago
I think if a business needs to, I would recommend they move to React now - Angular 2 is shaping up to be quite impressive, and taking pretty much all of the lessons that Facebook has brought with React (& possibilities brought about by the generally clean architecture such as server-side rendering, native mobile app support, etc.), and refining it ruthlessly, but you can only use what is available if you are consuming a third party library. Once Angular 2 is ready though, I would only consider using it in a new project unless the company is already deeply invested in React (or other tech) & doesn't have the time to migrate.
Angular 2 is still rough today, and that is why it is still in alpha - the Angular team is still trying to figure out what do they need to expose in the framework for consumers to build flexible components. In addition, the testing situation still needs to be refined some. The UI Bootstrap team is in the beginning of migration to Angular 2, and we already came across some pain points that Google is working with us to try to ease as much as possible.
As far as ng2 vs. React - ng2 uses pure HTML templates still. ng2 manages to use this and still optimize dramatically over React due to how change detection works in Angular. The template syntax is not complicated once you get used to it - it is much easier than remembering all of the edge cases that JSX has had to write around (i.e. className) due to issues of conflict with JS itself, and certainly much easier than remembering all of the little caveats and edge aspects of ng1.
Web component support for Shadow DOM is opt-in, and it does use the template tag for custom components. Observables have some overhead, but the great thing is that it is optional for many things, and easy to use when something is exposed as an observable.
The Angular 2 DI is much better than the Angular 1 version - it is much more powerful and doesn't require a hacky implementation due to its use of decorators.
- aikah 11y ago> ng2 manages to use this and still optimize dramatically over React due to how change detection works in Angular. That's what the angular team claims yet, there is absolutely no proof that ng2 templates are faster than React, and I did my own benchmarks. You can say "it's still alpha" , but if speed is a business requirement for ng2, alpha doesn't fulfill that promise. > The Angular 2 DI is much better than the Angular 1 version Better or more verbose and complicated ? I just don't want to do that kind of DI in the front-end. It will lead to people over engineering their code bases. It will lead to bad and verbose code, everything what front-end development should not be.
- Bahamut 11y agoActual benchmarks would disagree with your claim - the Meteor team did a benchmark and found Angular 2 significantly faster than Angular 1 (I hope so), React, and their own Blaze. The perf gap increases dramatically with the more DOM elements worked with - the best part is that the Angular and Meteor team's benchmarks are both open source! (The Angular team does not compare with React, just Angular 1 and a baseline of no JS generated DOM) The problem I have found with most codebases written with angular is by far the underengineering put into it, sometimes to an appalling degree. The new DI is pretty simple - specify an array of services, or just define the array elsewhere and import it in and set it to a config onject. There is not much complexity on the user's side.
- aikah 11y ago> the underengineering put into it, There is no such things as underengineering, given specific business requirements. On the other hand, writting useless code is something I often see with people abusing IoC containers like Spring. If a minimal codebase passes the acceptance tests it is not "underengineering" ,it's actually doing one's job as a developer. Anyway i'm really against the lack of pragmatism in the new DI. But don't worry , by the time ng2 is realised you'll see an avalanche of blog posts about how horrible it is. Mark my words.
- Bahamut 11y agoThere is such a thing called underengineering - it happens quite often at dev shops where developers do not plan their code out with flexibility, clarity, and modularity, where you run into poor abstractions that are inflexible because not enough thought went into what approach would work best for potential business needs...and unsurprisingly, that sort of code often is difficult, if not impossible, to properly test. Re: ng2 DI, I disagree, I have used the ng2 DI system for almost a year now, in production code as well for a large part of it. The new DI is decoupled from any framework, allows multiple injectors, avoids verbose hackiness, and is more natural to use - all significant improvements to ng1. There is literally nothing lost, only additions in terms of features and flexibility.