Live data from Hacker News

Angular 2 Final Released

angular.io

251–260 of 452 posts

Re: Angular 2 Final Released

#251

Serious question : Why are SPA frameworks so popular these days? When someone asks "What should I use for web development?", It's now all about React/Angular/Ember/etc. But when I look at how are built the sites I like and visit frequently, I'd say 95% of them are not SPA, they are classic sites where the server generate each page (sometimes with one or two Ajax requests)! The Single Page pattern is great for desktop…

It loads faster, you can have a richer experience, you can use less compute resources and less bandwidth. And I'd say that HN users are not typical users.

In any event, if you're making a real Web application (as opposed to just a Web site that's primarily static content) the experience is much better.

Re: Angular 2 Final Released

#252

Serious question : Why are SPA frameworks so popular these days? When someone asks "What should I use for web development?", It's now all about React/Angular/Ember/etc. But when I look at how are built the sites I like and visit frequently, I'd say 95% of them are not SPA, they are classic sites where the server generate each page (sometimes with one or two Ajax requests)! The Single Page pattern is great for desktop…

Server-side rendering blurs the line here, eg you can write your page completely in react and still have the "server generate each page"

Re: Angular 2 Final Released

#254
post #143

Earlier quoted context omitted.

Why would you consider JS to be a terrible language? It's not a requirement to use a framework to code in JS.

"Why would you consider JS to be a terrible language? " JS is kind of a 'bad language' because: 1) It's missing some pretty important things. Try to determine if a value is a number. Seriously. Look into that mess. Or anything else. Doing simple type-checking is crazy, and we basically are resigned to 'best practices' - which is crazy. 2) Prototype chaining is a neat idea and has some merits - but in reality it makes…

1) Isn't it just (!isNaN(num) && isFinite(num))? I know that's pretty far from intuitive, but it's not as bad as you made it sound. That being said, i'd love an `isNumber` function at some point...

2) I felt the same way for a while, but recently I was working on something where I ended up really "abusing" the prototype system, and when you actually spend the time to learn it, it's not that bad! It's different, that's for sure, but it's not bad.

I like to think sometimes that if javascript came before C, would we still call many of these things "bad"? Would we call javascript's equality table "weird", or would it be C's that was the weird one? Would C be the star in a talk labeled 'Wat' where they laugh at the absurdity of 'a' == 97? So much of the stuff that people complain about in JS is because they have expectations from other languages. Sometimes those expectations are a good thing, but other times they are just different, and taking the time to actually learn how and why it's different can make you a much better programmer.

3) I genuinely like this about JS. There is no "one true way". The language is free to evolve, change, get new features, get new functionality, and easily "polyfill" old browsers outside of the release cycle. And that's important in JS because there is no one "authority". Keeping the stdlib small means that it's easier for new implementations to crop up, and it leaves the "niceties" to be developed by libraries. It's what allows libraries like ramada and lodash to be so powerful. They wouldn't be where they are today if the stdlib was more opinionated/complete.

4) But again I kind of like this. It does often make things more difficult, but at the same time it improves the ecosystem. I honestly believe that the fact that there are competing implementations is pretty much the only reason javascript (and in some ways, all dynamic languages) are as fast as they are today! Not only that but the fact that there are multiple competing implementations keeps most devs "honest". For the most part I don't need to worry about someone writing code that will run on version X on platform Y. I don't need to worry that the next "update" will require us to spend a week cleaning up removed functionality. It does lead to a lot of "crap" accumulating in the language, but over time that crap can and will be removed. JS is a fluid, constantly-evolving language, and because of that you tend target a point in time, not a "release", and the impressively awesome backwards compatibility means that while your older code might look outdated, it's not going to suddenly stop working.

I do agree that complex JS programs need much more tooling to be manageable, but it's working out very well in my experience. It's just different.

Re: Angular 2 Final Released

#255
post #13

Earlier quoted context omitted.

I'm currently in the same boat. Both are similar in that they are component-oriented. There are two important factors in my mind. 1. The ecosystem (as you mentioned). React has a clear head start here, but I expect Angular2 to make some gains over time. 2. Angular2 gives you a full framework, and as they say now, a whole platform. React is smaller and you rely on a bunch of other packages to get all the extra feature…

>> Angular2 gives you a full framework, and as they say now, a whole platform. So did Angular 1, and then they threw it under a bus. Now developers have to either refactor for a whole new framework or get stuck with a legacy one. Javascript ecosystem is becoming so hostile a project deprecates itself in favor of a clean rewrite and the migration path is an afterthought. Will think twice before adopting google framewo…

>and then they threw it under a bus.

They didn't just do this "because." There were sound technical reasons to do so. Angular made the correct decision, in my opinion, and decided to cut its losses immediately and right the wrongs within the framework.

Re: Angular 2 Final Released

#256
post #195

Earlier quoted context omitted.

Cons: 1. Typescript. If your team isn't familiar with it it's not trivial to get everyone on board. The up-front cost can absolutely be worth it in the long run, but there's some friction in the day-to-day work with managing type definition files and looking up esoteric lint-errors from the Typescript compiler. 2. RXJS. Canonical NG2 should use Observables, and rxjs is not a trivial library to learn the ins and outs…

It's very strange to me, any one of the cons from 3-6 will make me avoid a framework. Do you think the pros of the framework outweigh these serious cons?

Hard to test, hard to debug, poor documentation? Yeah, sounds like I don't want to be near it.

Re: Angular 2 Final Released

#257

Serious question : Why are SPA frameworks so popular these days? When someone asks "What should I use for web development?", It's now all about React/Angular/Ember/etc. But when I look at how are built the sites I like and visit frequently, I'd say 95% of them are not SPA, they are classic sites where the server generate each page (sometimes with one or two Ajax requests)! The Single Page pattern is great for desktop…

> I think I still prefere the "feel" of classic websites.

Your hacker biases are showing.

The sites where 95% of people spend most of their time (Twitter, Facebook, Instagram, etc.) are all built as single page "applications." Users expect rich interactivity from websites these days and are usually not tolerant of UI refreshes.

The comparison is not to "desktop" applications but to mobile apps. Users expect a mobile app level of interaction. Plus, if you're building mobile apps then it's a lot easier to just reuse those same APIs for a web app.

That being said, if your site doesn't have any interactivity then it does make sense to just render it statically.

Re: Angular 2 Final Released

#258
Never used Angular. I was considering it for one project, but the uncertainty around the whole Angular 1/2 thing made it too risky, so I stuck with what I knew at the time (Backbone/Marionette).

Tried Ember.js more recently, didn't much care for it. I think I'm just not a fan of large frameworks.

Now mithril.js (http://mithril.js.org/) has finally lured me away from Backbone :)

Re: Angular 2 Final Released

#259
post #198

Earlier quoted context omitted.

That compiler flag is wonderful, and so is the newer 'strictNullChecks' I use these typings: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast... Then create my components like this: interface Props { } interface State { } class MyComponent extends React.Component { } and everything is typed correctly (beside setState which is impossible to type exactly as of today)

How would you do something like this with stateless components? (Where the component is just a function that takes props)

interface IMyComponentProps { x: number; }

function MyComponent(props: IMyComponentProps): JSX.Element { return

{props.x}

; }

Re: Angular 2 Final Released

#260

Serious question : Why are SPA frameworks so popular these days? When someone asks "What should I use for web development?", It's now all about React/Angular/Ember/etc. But when I look at how are built the sites I like and visit frequently, I'd say 95% of them are not SPA, they are classic sites where the server generate each page (sometimes with one or two Ajax requests)! The Single Page pattern is great for desktop…

Because today there are websites and there are are web apps. Sometimes there's a combination of both - for example a blog - it's front end (user facing) part could be rendered by the server page by page and it's backend (admin access) is a single page web app. Each is used where appropriate - website - mostly static content, SEO and web app - a lot of user interaction.
Post reply on HN