Live data from Hacker News

Angular 2 – Best Practises

blog.budacode.com

41–50 of 94 posts

Re: Angular 2 – Best Practises

#41
post #20

Earlier quoted context omitted.

Have you tried React with React Native[0]? [0] https://facebook.github.io/react-native/

BTW to parent, one big advantage of react-native over ionic is that it's not a wrapped web app, but a javascript/react app that compiles to an actual native app. The performance difference and development experience (no silly css hacks) is very noticeable.

Not to nitpick, but I don't believe react native "compiles" to a native app. The evaluation of the JS in JavaScript Core is passed of to native code to layout native views. The interactions are then posted back into jscore. So while closer to native compiled code performance, it's still a bit different.

Re: Angular 2 – Best Practises

#42
post #4

Could someone tell me one-or-more reasons to choose Angular for a new project, now that the React ecosystem is mature enough to compete with it? As I feel that from a conceptual/architectural point of view Angular is simply on a loosing path. https://www.google.com/trends/explore#q=angular%20tutorial%2...

I've found it more straightforward to transition to Angular over from a more server-side setup gradually. The template language is at least in the same general area as template languages for Django, Rails, etc.

The general tooling process is pretty simple, no need to convince people of the merits of JSX.

Architecturally speaking many people still like separating presentation from business logic.

Angular has a lot of mature tooling and wrappings around current libraries. Angular also offers a lot more tooling on the side, React is much smaller.

On an architectural side, while React keeps states in components, the state update mechanism is a bit obtuse compared to Angular's "scopes are just objects" philosophy.

It's dependent on how you view things, but if you're working on things where strict component decomposition is hard, and you "like global state in your views", then Angular's state mechanism (controllers) could work better for you.

Some would also declare that the non-turing-complete-ness of the template language in Angular is a feature, not a bug.

Re: Angular 2 – Best Practises

#43
post #23
post #10

Earlier quoted context omitted.

My impression is that a lot of "mature" (aka boring old) companies like Angular 1 and the sound of Angular 2 over React. For a number of reasons: - In general Java and C# programmers like it. - It is made by Google (perceived as more "mature", business like) rather than Facebook (young kids). - It takes a lot of inspiration from server side development with its dependency injection and general terminology. - And Type…

> My impression is that a lot of "mature" (aka boring old) companies like Angular 1 and the sound of Angular 2 over React. React has been around for a while, but it is still only a library. Angular 1 and 2 are frameworks. Also Angular 2 is a complete rewrite and not even in final release. I'm not sure how that is boring or old. As with Angular 1, Angular 2 aims to be opinionated, so it should be clearer how to do thi…

> React has been around for a while, but it is still only a library. Angular 1 and 2 are frameworks.

What does this even mean. Angular is also 'only a library'.

> As with Angular 1, Angular 2 aims to be opinionated, so it should be clearer how to do things than with React.

'Should' and 'is' are different things, angular 1 was a complete mess. React is quite clean and straightforward.

> Especially now with the move to components, Angular should be easier do more with, without as much confusion.

Why? You don't give a reason of why this would be easier than with React.

> And Angular 2 is much faster, if you do it right, which was one of the reasons Angular 1 was left for React.

We are comparing Angular 2 with React not sure how 'Angular 2 might be better than Angular 1' is an argument against React.

> React is fine for what it is. It's somewhat "matured" for a few years and is not a bad decision if you go with it.

It's a much better decision than Angular 1 or Angular 2.

Re: Angular 2 – Best Practises

#44
post #39
post #4

Could someone tell me one-or-more reasons to choose Angular for a new project, now that the React ecosystem is mature enough to compete with it? As I feel that from a conceptual/architectural point of view Angular is simply on a loosing path. https://www.google.com/trends/explore#q=angular%20tutorial%2...

For Angular 1 vs. React, I would just say depending on the resources you have - for example if a team is very productive with Angular 1 & there isn't enough time to get a team to pivot skills, then it may make more sense to go with that from a business perspective. IMO there is one main reason to choose Angular 2 over React currently - perf. Angular 2 has significant perf improvements over the other libraries/framewo…

What's the difference between Angular 2 and Reacts rendering? I was under the assumption that Angular 2 had implemented a shadow dom or something similar.

Not arguing that you are wrong, I just haven't kept up with any of Angular 2 and am genuinely curios.

Re: Angular 2 – Best Practises

#45
post #5

Earlier quoted context omitted.

> I also can see how Typescript features can shape a codebase and ultimately make it look like Enterprise Java, instead of making it easy to use and to learn. Meh, I don't see how this is a bad thing. We need some more software engineering in the javascript space instead of cowboy hacking.

> We need some more software engineering in the javascript space instead of cowboy hacking Are you saying that the ability to write entreprise java code is what separates "software engineers" from "cowboy hackers" ? That statement is arrogant. My point is the use of Typescript doesn't produce idiomatic Javascript code, since it encourages writing front-end code a certain way. You might like it, fine, I'm personally n…

Have you used TypeScript? I thought the very same things until I started using it. TS does a great job of maintaining the spirit and feel of JS. It's not a "C# for the web", it really is "JavaScript with types"

Re: Angular 2 – Best Practises

#46
post #39
post #4

Could someone tell me one-or-more reasons to choose Angular for a new project, now that the React ecosystem is mature enough to compete with it? As I feel that from a conceptual/architectural point of view Angular is simply on a loosing path. https://www.google.com/trends/explore#q=angular%20tutorial%2...

For Angular 1 vs. React, I would just say depending on the resources you have - for example if a team is very productive with Angular 1 & there isn't enough time to get a team to pivot skills, then it may make more sense to go with that from a business perspective. IMO there is one main reason to choose Angular 2 over React currently - perf. Angular 2 has significant perf improvements over the other libraries/framewo…

I'm trying to find more info on angular 2 incremental rendering that you've mentioned.

I've despised angular since pre-1.0, mainly for performance reasons. Once the number of watchers hits 1000 or so, a browser will noticeably lag. A compete rerender will cause a noticeable freeze up.

I'm not currently using react either, but it's possible to do an incremental render through code, only rendering what needs rendering. React-dom will be needed to plug the result in the right spot.

Re: Angular 2 – Best Practises

#47
post #42
post #4

Could someone tell me one-or-more reasons to choose Angular for a new project, now that the React ecosystem is mature enough to compete with it? As I feel that from a conceptual/architectural point of view Angular is simply on a loosing path. https://www.google.com/trends/explore#q=angular%20tutorial%2...

I've found it more straightforward to transition to Angular over from a more server-side setup gradually. The template language is at least in the same general area as template languages for Django, Rails, etc. The general tooling process is pretty simple, no need to convince people of the merits of JSX. Architecturally speaking many people still like separating presentation from business logic. Angular has a lot of…

Thanks for this!

Re: Angular 2 – Best Practises

#48
post #39

Earlier quoted context omitted.

For Angular 1 vs. React, I would just say depending on the resources you have - for example if a team is very productive with Angular 1 & there isn't enough time to get a team to pivot skills, then it may make more sense to go with that from a business perspective. IMO there is one main reason to choose Angular 2 over React currently - perf. Angular 2 has significant perf improvements over the other libraries/framewo…

What's the difference between Angular 2 and Reacts rendering? I was under the assumption that Angular 2 had implemented a shadow dom or something similar. Not arguing that you are wrong, I just haven't kept up with any of Angular 2 and am genuinely curios.

Both Angular and React rely on an AST - React uses jsdom, while Angular has a template compiler which constructs an AST from the template, and the renderer then can render from the AST as it determines. Angular can render templates with the inert template tag - this allows it to leverage browser caching for browsers supporting the template tag.

It also supports the shadow DOM through its style engine with the component decorator. One can either use native shadow DOM (and use a polyfill for the functionality), or use Angular 2's built-in virtual shadow DOM where it randomly generates unique attributes to style off of with the component decorator.

Re: Angular 2 – Best Practises

#49
post #8

Earlier quoted context omitted.

As is shown with the decorator transpiling in both typescript and babel, it doesn't really matter if it never makes it to the spec: you can still use it using a compiler. I use it in my own production software and it is a real blessing when trying to use a more OO approach in a JS world

> it doesn't really matter if it never makes it to the spec I does matter as there is difference between introducing type support in a language and introducing features that completely are non standard. Now imagine TC39 introduces a decorator syntax that is not compatible with Typescript's implementation ( it happened in the past with previous Typescript module syntax and the language had to break compatibility ) Ang…

> it happened in the past with previous Typescript module syntax and the language had to break compatibility

Hmm. I thought that they just deprecated the old syntax while maintaining backwards compatibility.

Re: Angular 2 – Best Practises

#50

Not directly related but I would appreciate any thoughts on which angular version one should go with, for a new development (fairly large enterprise project) at this point of time. How hard would it be to upgrade to version 2.0 if we start our early development on v1.5, assuming 2.0 is not ready for prime time (or is it?)

All depends on if you use any third party Angular 1 libraries. If you do, it can be trickier, as one will have to rewrite the functionality in Angular 2.

For example, my current company screwed itself by using a fork of UI Grid, and thus probably cannot upgrade the current app to Angular 2 easily.

Post reply on HN