News for hackers. Stuff that matters.
Re:Angular 2 Final Released by electrotype on Thursday September 15, 2016 @08:58AM (#12505688)
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-like applications such as Gmail, it's obvious. But otherwise, I don't know... I think I still prefere the "feel" of classic websites.

Re:Angular 2 Final Released by morgante on Thursday September 15, 2016 @09:21AM (#12505854)
> 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 by andrewstuart2 on Thursday September 15, 2016 @01:02PM (#12507805)
One of the key advantages of a single-page application from the User Experience perspective is perceived response time. It takes well under a single frame refresh period (~16ms) to react to some event and either change the page using data you already have, or throw a loading indicator on the screen.

The app may have been slower to load the first time (hopefully not by much) but from then on, they get the perception of instant feedback even if they have to wait a round trip for the backing data sometimes.

SPA frameworks make this sort of interaction very easy to design and reason about as a developer.

Re:Angular 2 Final Released by pekk on Friday September 16, 2016 @01:26AM (#12512022)
Hyperlinks are a form of interactivity. That aside, there is no reason why one cannot have many individual pages which each have their own interactivity.

If you are going to argue that this is about "hacker bias" you will have to show user studies, not poll JS developers.

Re:Angular 2 Final Released by omouse on Thursday September 15, 2016 @02:21PM (#12508493)
And the performance of all those is just garbage in Firefox on a 3 yr old laptop and isn't that much better on mobile.

They're fantastic for forcing people to buy new hardware just to look at information :|

Re:Angular 2 Final Released by charrondev on Thursday September 15, 2016 @03:54PM (#12509284)
Well it must not be a very good 3 yr old laptop then? And firefox isn't exactly the slimmest or lightest web browser. Sucks ram just as bad as chrome used to. My 3 year old laptop can handle all of the google services just fine.
Re:Angular 2 Final Released by omouse on Friday September 16, 2016 @09:42AM (#12513891)
8gb RAM, great CPU. I'm playing counterstrike global offensive and civ 5 with very few problems. Lower FPS sure because the video card isn't great but it shouldn't be this bad. It was fairly decent in Win7.
Re:Angular 2 Final Released by slmyers on Thursday September 15, 2016 @04:07PM (#12509397)
Isn't that more of problem with adds or 3rd party JS?
Re:Angular 2 Final Released by overcast on Thursday September 15, 2016 @09:00AM (#12505706)
Prevalence of API's. One common interface to query/update from. You don't have to do both server side, and client side requests. Rather do it all client side.

I've done of a few of these types, and now have moved onto mixed environments. Where most is rendered server sided, then only updates requested client side. Of course you're doing things twice for same queries.

Re:Angular 2 Final Released by TelmoMenezes on Thursday September 15, 2016 @09:06AM (#12505745)
What's with the "serious question", "genuine question", etc? Mostly I see this mannerism prefacing questions that could not reasonably be taken as a joke or provocation.

Serious question: are people so touchy these days that you have to assure them that you are not being hostile before even saying something?

Re:Angular 2 Final Released by praptak on Thursday September 15, 2016 @09:09AM (#12505762)
I think it means "don't interpret curiosity as middlebrow dismissal".
Re:Angular 2 Final Released by aiokos on Thursday September 15, 2016 @10:06AM (#12506213)
If you look at some of the comments condemning him for not backing up his preferences with statistics it makes sense that he should preface his questions with something to provide levity. I don't know why programming communities are so touchy about their tools, particularly JavaScript frameworks. It must be a sort of buyer's satisfaction to convince themselves that they made the correct time investment.
Re:Angular 2 Final Released by electrotype on Thursday September 15, 2016 @10:01AM (#12506165)
This is a huge release for the Angular team, I'm happy for them and I don't want to sound like I'm "attacking" them with such question. Also, english is not my main language so maybe I don't understand perfectly when to use this expression or not. I see I should use it more carefully! ;-)
Re:Angular 2 Final Released by akst on Thursday September 15, 2016 @01:31PM (#12508064)
Someone having a different point of view online isn't that radical of a concept. Especially considering how easy it is to misinterpret the tone of someone's remark online. It just shows you're going out of your way to clarify your interested in a genuine discussion.
Re:Angular 2 Final Released by TelmoMenezes on Thursday September 15, 2016 @06:05PM (#12510228)
Fair enough.

For me it has the opposite effect, it makes everything sound less genuine. But hey, I'm just some guy, if people like it...

I find unnecessary clichéd phrases very annoying (e.g "going forward"). Maybe I'm alone in this. It's not because of pretentiousness or language puritanism, it's that it makes me feel that I'm reading something created by corporate PR or some other soulless entity with ulterior motives. My rule of thumb: if you have nothing creative to add, just be simple.

Re:Angular 2 Final Released by daxfohl on Thursday September 15, 2016 @09:42AM (#12506016)
Also I think it's more intuitive to develop. You do all your logic in the "app", and the REST layer is just a glorified DB wrapper. It matches the project's inevitable phone app more closely too so you don't have two entirely different paradigms.

Of course all that goes away when your boss says you need to support JS-disabled browsers.

Re:Angular 2 Final Released by akst on Thursday September 15, 2016 @09:59AM (#12506150)
> Of course all that goes away when your boss says you need to support JS-disabled browsers

Well seeing as this release of angular offers some form of server side rendering, as well as Ember with fastboot, & being implementable in React or something like that. It's more approachable these days, there's some tweaking that's required, but very much doable.

Unless of course you're dealing with an interaction heavy UI.

Re:Angular 2 Final Released by emodendroket on Thursday September 15, 2016 @09:14AM (#12505803)
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 by shados on Thursday September 15, 2016 @02:01PM (#12508326)
IMO building classic websites is a solved problem, while building web apps isn't.

Classic websites have CMS, things like Wordpress, and a ton of MVC frameworks that have been tweaked over the last decade, like Rails, Django, ASP.NET MVC, etc. When it wasn't a solved problem, a new one like this was popping up in the news every other week.

Now, that that's done, people are trying to do other things, like complex web apps...and so that's where the brain time is being spent.

Re:Angular 2 Final Released by jwarren on Thursday September 15, 2016 @10:46AM (#12506568)
There's honestly no need for React/Angular/etc to necessarily power a SPA, you can just use it to build smaller components. I initially got started with Angular to power a reusable video "widget" component on a WordPress site - a far cry from an SPA! It's also a great route to getting your feet wet without committing wholesale to a technology.
Re:Angular 2 Final Released by oelmekki on Friday September 16, 2016 @08:14AM (#12513459)
+1. I've made nine react apps since last year, only the two last are SPA (because I wanted to try the golang/react combo).

React is super good to take control of a small piece of the page and build a complexe widget on it (can't speak about angular, I only used it twice without getting very far).

Re:Angular 2 Final Released by scottmmjackson on Thursday September 15, 2016 @09:05AM (#12505739)
SPA frameworks are not all-encompassing tools for buildong all web pages. Notably, trying to SEO a SPA is frustrating at best and impossible at worst.

However, in b2b use cases where SEO isn't an issue, SPA frameworks are ideal for coordinating a static-site<->dynamic-api system.

Re:Angular 2 Final Released by charrondev on Thursday September 15, 2016 @03:56PM (#12509304)
React, Angular 2, Vue 2 and some other SPA frameworks or view systems all support server-side rendering with very little coercion nowadays. That combined with google executing javascript during indexing means that SEO isn't nearly the issue it used to be.
Re:Angular 2 Final Released by pault on Thursday September 15, 2016 @11:01AM (#12506712)
Server-side rendering is supported in several SPA frameworks now, and SEO is not an issue if you use it.
Re:Angular 2 Final Released by quaunaut on Thursday September 15, 2016 @01:14PM (#12507914)
Google's been indexing SPAs fine for quite awhile.
Re:Angular 2 Final Released by akamaka on Thursday September 15, 2016 @09:31AM (#12505948)
They're easier to develop.

Most websites and web apps have use AJAX to dynamically update certain parts of the site. Even though few sites would need to use it for everything, once you introduce good tools for dynamically updating the DOM and hire some Javascript developers, it's easy to say "Let's just use this approach to everything".

It's fair to say it's a lazy approach. I've built many SPAs that probably would have been better as static sites, and would have benefited from better SEO. But hey, we got then shipped fast.

Re:Angular 2 Final Released by nkassis on Thursday September 15, 2016 @10:14AM (#12506290)
"They're easier to develop."

I don't think that's entirely true, they allow for building experiences that weren't really possible with the previous model of rendering entire pages server side on every action but they aren't easier in all respect to that. If you site is mostly static data, it's probably still easier to use the older model. SPA frameworks start to make more sense when you want to build interactive pages with components that you want to individually update etc...

But they do add complexity that can't be ignored. that's why tooling and frameworks are hugely important as they smooth out that complexity.

Re:Angular 2 Final Released by hatsix on Thursday September 15, 2016 @04:31PM (#12509576)
The biggest "easier to develop" thing for me is the ability to have the SPA separate from the server. Being able to deploy beta builds, one-off builds, etc makes it MUCH easier to diagnose production problems.

So, I guess I'm saying that it allows for much shorter iteration times, ability to experiment with solutions in the production environment without requiring complicated server solutions.

Granted, that also lets me build experiences that weren't possible, because I can experiment more and have a faster feedback loop, but for me, it's because I can DEV better.

Re:Angular 2 Final Released by neverminder on Thursday September 15, 2016 @09:28AM (#12505924)
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.
Re:Angular 2 Final Released by prodigal_erik on Thursday September 15, 2016 @01:21PM (#12507984)
There's no such thing as a web app, just javascript apps, and every time someone ships one the world-wide web of linked hypertext becomes smaller and less useful than it might have been.
Re:Angular 2 Final Released by dcwca on Thursday September 15, 2016 @10:08AM (#12506234)
Websites vs. Web Apps.

Websites are static documents.

Web Apps use the browser as a runtime for a UI application.

Re:Angular 2 Final Released by electrotype on Thursday September 15, 2016 @10:45AM (#12506556)
You can have a lot of interactivity with plain Javascript + some Ajax requests, without the need for the application to be a single page developed using an almighty framework. Classic websites are not synonym of "static documents" in my opinion.
Re:Angular 2 Final Released by bluetwo on Thursday September 15, 2016 @10:21AM (#12506360)
I have to agree with you.

HTML5, CSS3, and Javascript have matured to the point where they are very powerful and flexible. I don't always see the point of over-complicating things with frameworks.

Re:Angular 2 Final Released by hatsix on Thursday September 15, 2016 @04:41PM (#12509651)
I recently built a small three 'page' game for a trade-show booth. By using Ember, I was able to: try out a new CSS framework based on flexbox, save data to localstorage, capture images from the webcam, have 'data binding' of variables so that they updated on the page when I changed them, and deploy to surge.sh in the first hour.

All-told, it took 20 hours, 7 of which was me getting used to the intricacies of developing a full-screen "App" (no scrolling) with flexbox and implementing the designs. I'm good with vanilla JS, but there's no way I could have done all of the coding (three 'game' pages, three 'admin' pages) in less than two days.

I guess the point is, a framework that you know and are familiar with can halve the time you spend on a project. I find that to be especially true with Ember because of the CLI tools and all of the various addons.

Re:Angular 2 Final Released by skhavari on Thursday September 15, 2016 @12:42PM (#12507630)
Yes, they are very powerful and flexible. These frameworks actually payoff and simplify once your project grows beyond a particular size.
Re:Angular 2 Final Released by officialchicken on Thursday September 15, 2016 @01:11PM (#12507890)
> once your project grows beyond

"Premature optimization is the root of all evil."

- Donald Knuth

Re:Angular 2 Final Released by zodiac on Thursday September 15, 2016 @09:15AM (#12505806)
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 by Roboprog on Thursday September 15, 2016 @11:50AM (#12507144)
See my response to "alzoid" about separation of concerns and bandwidth/processing benefits.

Simplify server logic

Use less bandwidth

Re:Angular 2 Final Released by EugeneOZ on Thursday September 15, 2016 @09:13AM (#12505798)
> I think I still prefere the "feel" of classic

Very detailed, proved by numbers, objective and professional argument. That's how things should work.