News for hackers. Stuff that matters.
Re:15 years trying to make everyone separate HTML, JavaScrip... by throwaway2016a on Tuesday December 20, 2016 @12:13AM (#13217634)
> I guess that's what happens when you don't hire anyone over 30

It's comments like these while people don't hire anyone over 30. Rather than provide thoughtful critique of the platform the response is "This looks like something I saw 20 years ago and it didn't work then so it won't work now, I'm not even going to look at it!"

Speaking as someone who is over 30... before you criticize something, understand it. For example, this code is nothing like PHP spaghetti code for reasons I listed in other comments among others I'm sure I didn't think of.

I see it very often. People like "we did this 30 years ago. I guess what is old is new again. Hahaha" But I've lived through it... like many of you... I've gone from CGI scripts written in C++ when you couldn't even guarantee a browser had Javascript to PHP, to Ruby, etc etc etc, blah blah blah. But after all that, and a Computer Science degree, I gave React an honest look and while it's not perfect. It is worth a look.

Re:15 years trying to make everyone separate HTML, JavaScrip... by flukus on Tuesday December 20, 2016 @12:28AM (#13217699)
The critique is in the title. There are good reasons presentation and logic are separated.
Re:15 years trying to make everyone separate HTML, JavaScrip... by marcus_holmes on Tuesday December 20, 2016 @04:55AM (#13218630)
This has been going on forever. 3-tier client-server code bases had problems separating "presentation logic" and "business logic" because often they're very very closely connected.

React runs on the client. It runs the logic needed on the client. And there has always been some logic required on the client, otherwise you end up refreshing the screen for every.single.validation. which is a total PITA.

Given that there's some logic running on the client, then maybe running more of it there would be a good thing. This is the principle behind SPA's after all, and they've turned out to be a Good Thing generally. Not suitable for every use case, mind. So do we then need a separate Logic Layer for logic that isn't to do with Presentation? Where do we draw that line given that the whole thing is running on the client? How do we keep the thing clean and stop bits of logic being run on random button events?

React makes perfect sense when you look at it as an answer to the problem of "how do I add logic to my presentation layer and not end up in a mess of spaghetti code?"

Re:15 years trying to make everyone separate HTML, JavaScrip... by tracker1 on Tuesday December 20, 2016 @02:21AM (#13218100)
And how often are the presentation and logic changed in isolation of each other... they aren't separate concerns at many levels. The concern is sepearated in React at a component level... how a component is rendered is just as important as how it raises/accepts changes outside of itself, and often interacts.

Also, having JSX in my JS is much easier to deal with than remembering some abstract DSL for how to iterate through children in a template language. It's no more goofy.

Re:15 years trying to make everyone separate HTML, JavaScrip... by flukus on Tuesday December 20, 2016 @03:16AM (#13218287)
Anywhere from never to always. A Pure logic change shouldn't need a ui change. At some companies the ui and logic are different responsibilities (this used to be common). Other times there will be multiple UIs for the same logic.
Re:15 years trying to make everyone separate HTML, JavaScrip... by mateuszf on Tuesday December 20, 2016 @04:13AM (#13218467)
React is for UI logic, application logic may be in a different place.