Live data from Hacker News

Angular 2 – Best Practises

blog.budacode.com

61–70 of 94 posts

Re: Angular 2 – Best Practises

#61
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...

Essentially it boils down to whether you prefer a cohesive all-in-one framework/platform (angular2) or a collection of semi- and fully-independent libraries (react). Pretending that one of those options is the right fit for everyone is not productive. The only thing really missing from Angular 2 compared to the React ecosystem is jsx. Angular 2 and RxJS (and if you want throw in ngrx/store) allows a heavy focus on im…

I'm using typescript with React right now...and typescript does a decent job with jsx checking. (saved me from a lot of missing / wrong prop name errors)

anyway, does typescript support some kind of template-string validation for angular2? If so, I'm going to really re-consider angular2 for my next project

Re: Angular 2 – Best Practises

#62

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?)

It's going to take a massive amount of work to upgrade from 1.0 to 2.0. Don't do that to yourself. Just go with 2.0.

Re: Angular 2 – Best Practises

#63
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...

This might have been mentioned already, but I do like that they're not reinventing the wheel with ng2 on every front and instead leveraging libraries that are either mature or likely to be the direction that web is heading. If you follow their quick start example you'll get Typescript, RxJS, SystemJS. RxJS is a very interesting beast that has been around for a long time in c# world and recently gained popularity in Javascript and implements what may be a precursor to browsers Observable() object and anything-as-a-stream management. Not sure how React is solving these problems but probably a good idea just to go through a few simple examples to see how they work.

Re: Angular 2 – Best Practises

#64

Earlier quoted context omitted.

Essentially it boils down to whether you prefer a cohesive all-in-one framework/platform (angular2) or a collection of semi- and fully-independent libraries (react). Pretending that one of those options is the right fit for everyone is not productive. The only thing really missing from Angular 2 compared to the React ecosystem is jsx. Angular 2 and RxJS (and if you want throw in ngrx/store) allows a heavy focus on im…

I'm using typescript with React right now...and typescript does a decent job with jsx checking. (saved me from a lot of missing / wrong prop name errors) anyway, does typescript support some kind of template-string validation for angular2? If so, I'm going to really re-consider angular2 for my next project

> does typescript support some kind of template-string validation for angular2

No, and that's the reason I mention jsx as a missing feature from Angular 2. There is no compile time or refactoring support for templates, whereas with TypeScript and jsx you get that.

Re: Angular 2 – Best Practises

#65

Earlier quoted context omitted.

Essentially it boils down to whether you prefer a cohesive all-in-one framework/platform (angular2) or a collection of semi- and fully-independent libraries (react). Pretending that one of those options is the right fit for everyone is not productive. The only thing really missing from Angular 2 compared to the React ecosystem is jsx. Angular 2 and RxJS (and if you want throw in ngrx/store) allows a heavy focus on im…

I don't think JSX fits Angular 2 - it sticks to "views are markup based and code is in controller" traditional MVC which I prefer to JSX. You mentioned TS but I feel like you understated it - it's the selling point for me. I have used TS + React but it's not the same thing - Angular was written with/for TS and it uses it to leverage all the advantages. React migrated from ES5 to incrementally add ES6 support and it s…

Definitely agree about the deep TypeScript integration with Angular 2 due to it being written in TypeScript. That is the core reason I prefer it, it is absolutely awesome in that regard. (And the same is true with RxJS).

Re: Angular 2 – Best Practises

#66
post #13

Can someone recommend me good resources to learn (start with) angular 2? I am totally new, I am learning node after JS and after that, I would like to introduce myself to angular. I have some experience on JSF but I suppose it is completely different.

Angular 2's own tutorial is a nice start: https://angular.io/docs/js/latest/tutorial/ .

Am I supposed to bite the bullet and just use/learn typescript?

"This chapter is not yet available in JavaScript. We recommend reading the TypeScript version."

Re: Angular 2 – Best Practises

#67
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…

You separate your presentation from your business logic in React. What React gives you that Angular doesn't is the ability to separate your presentational logic from your business logic. Angular makes you put presentational logic in with your business logic because presentational logic simply cannot be expressed with the templating format.

I would argue that a distinction that you make yourself, based on your application's architecture is more meaningful and useful than one made by some arbitrary separation of source file formats.

Re: Angular 2 – Best Practises

#68

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?)

There's a way to bootstrap your angular 1 app with an upgrade module so that you can have both running at the same time. There are ways to upgrade/downgrade your services/components so that they can be used in either Angular 1 or 2. I know Angular2 is planning a release that breaks its forms API, so there may be more small breaks like that, so take that for what it's worth when deciding to use Angular 2 or Angular 1 (or both, once 2 stabilizes more for your enterprise app). It took me two hours to bootstrap my angular 1.5 app with the upgrade module, along with transpiling .ts files with my es6 JS. Be aware, though, that if you do use Typescript, your build system is going to change, and you're going to have to figure out how to use a module bundler (SystemJS or WebPack, probably).

It may get pretty confusing if you're not used to transpilation, too. For example, when you want to instrument your code for code coverage for your unit tests, you need to map that instrumented code and its results to your typescript files and not the es5 transpiled version of your code to see which lines are failing/not being run/whatever. There are good plugins, but there's definitely some effort involved.

People on my team are using Angular2 in their own projects and are claiming huge productivity gains. They love the relative simplicity and power.

Re: Angular 2 – Best Practises

#69
post #52
post #45

Earlier quoted context omitted.

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"

It is C# for the web, of which a small subset is great and can be used to make "JavaScript with types". Or rather, TypeScript isn't bad, but the way it is documented might convince people to do bad things. It took forever to get "the good parts" of JavaScript in people's head, and that doc is really a step backward. If you just use TypeScript's types and run away with that though, it's pretty good. If you start using…

I have to disagree. For starters classes came from ES2015. They're an official, first class construct of JavaScript now, whether we like it or not. Decorators are also from ECMAScript. Whether people use TypeScript or not, a lot of what you're complaining about is coming regardless.

The visibility modifiers are optional, only checked at compile time, and quite frankly solve a problem that JS developers have been solving badly for a decade now. From "gentlemen's privates" (ie, if it starts with an underscore please don't touch it or rely on it!), to closures to CommonJS modules, all ridiculous contraptions essentially designed to give you some sense of privacy in the language.

TypeScript doesn't have enums. Instead it allows you to restrict a string to a finite set of values. Which basically boils down to JavaScript "enums" with a dash of static typing thrown in.

I have no doubt TypeScript tends to attract C# and Java developers. But that doesn't take away from the fact that TypeScript is a proper superset of JavaScript, it doesn't force you into a rigid class system at all (structural typing for the win), and really, truly is "JavaScript with types".

Re: Angular 2 – Best Practises

#70
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...

The only reason - if you want to bet the future of your project on an untested framework, that seen no real world use and is still changing during its RC.

Or simply put. If they named "Angular 2" by its real name "Some other cool framework name" - you would not use it. (e.g. Polymer 2)

Post reply on HN