Live data from Hacker News

15 years trying to make everyone separate HTML, JavaScript, CSS – and then

twitter.com

71–80 of 177 posts

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#71
post #2

It is amazing how much react resembles php and classic asp from 15 years ago. I guess that's what happens when you don't hire anyone over 30.

It's also amazing how much its nothing like that and how shallow the comparison is.

And I've been around before PHP was a thing.

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#72
post #12

Earlier quoted context omitted.

While old school PHP might look like this it is not the same thing by far. The code in this screenshot is a stateful component and is supposed to encapsulate all the logic on how it should be displayed in one place. It is close to a view in a MVC framework than true old-school spagetti code. But unlike a view component in an MVC framework the stateful components can update themselves automatically when data changes m…

Curious on your take; for a component, why do I need the virtual dom diffing? If I'm working on a component level, it's already granular enough where I can easily understand the changes that need to be made and I can just update those DOM elements myself (e.g. Oh, I should add this class here and update my shopping cart total). The DOM diffing for small components seems so... heavy handed. "Don't worry React, I got t…

>The DOM diffing for small components seems so... heavy handed. "Don't worry React, I got this.."

If you don't do DOM diffing for small components then you have to keep control of the whole logic state AND view state of your app.

Complete diffing allows for automatic one way bindings and easier to reason UIs.

It's like functional programming.

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#73
post #2

It is amazing how much react resembles php and classic asp from 15 years ago. I guess that's what happens when you don't hire anyone over 30.

Interestingly enough, I am over 30, and my day job is to both write new React code, new modern php code, and to maintain some "classic" php code that intermingles logic, SQL, HTML, CSS, and javascript in one horrible disaster.

So I think I can say with some confidence that everything you have written is completely nonsense.

> It is amazing how much react resembles php and classic asp from 15 years ago.

Yes, it's amazing how it's nothing at all alike.

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#74
post #12

Earlier quoted context omitted.

While old school PHP might look like this it is not the same thing by far. The code in this screenshot is a stateful component and is supposed to encapsulate all the logic on how it should be displayed in one place. It is close to a view in a MVC framework than true old-school spagetti code. But unlike a view component in an MVC framework the stateful components can update themselves automatically when data changes m…

Curious on your take; for a component, why do I need the virtual dom diffing? If I'm working on a component level, it's already granular enough where I can easily understand the changes that need to be made and I can just update those DOM elements myself (e.g. Oh, I should add this class here and update my shopping cart total). The DOM diffing for small components seems so... heavy handed. "Don't worry React, I got t…

ReactJS is currently the fastest, most scalable frontend solution available so compared to all that has come before it, it can seem heavy handed. But if you want to build highly scalable apps like Facebook, Instagram, Pinterest, Reddit and Twitter mobile, then losing easy speed gains with every one of the hundreds to thousands of components you build is unacceptable.

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#75
post #30

Earlier quoted context omitted.

The critique is in the title. There are good reasons presentation and logic are separated.

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 th…

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, JavaScript, CSS – and then

#76
The thing about Fuchs is that he's a very smart guy, who is deeply embedded in the modern JS world, and is absolutely aware of what that code is doing, why it looks the way it does, why the trend in frameworks has moved the way it has, just how many times the argument he's using has been advanced already, and how thoroughly it's been trashed over the years.

He knows that what he's said has been said a thousand times before, and he knows that every time it's said a bunch of people will reply with "separation of concerns, not seperation of technology", and he knows that's a very valid counterargument which can't be refuted in a tweet, which means he also knows how pointless this is. Which in turn means that he's not doing this to start a discussion, but just to get a rise out of people. Giving him the benefit of the doubt, he might actually have an interesting point to add to the debate...but we'll never know, since he thinks a better use of his time is trolling React developers than actually making his case for...whatever it might be.

One of the tweets in reply to him hit the nail on the head: https://twitter.com/chrisbarless/status/810918115601158145

Sad.

Edit: Scroll through Fuchs' twitter feed right now; he's basically just non-stop trolling. "This is why we can’t have nice things" "Q: What is React? A: It’s PHP, but on the client." "I can see how react is awesome if you build todo apps that do nothing. :)" Then when noting how a million people are disagreeing with him: "I think that means that I’m on to something." No attempt at dialogue, no acknowledgement that there might be alternative viewpoints. Almost every tweet is another dollop of smug arrogance.

It must be nice to have so much confidence that you never have to stop and wonder if there might be something new you don't yet know.

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#77
The whole separating HTML, JS & CSS has never felt right to me. Just because it's in different files doesn't mean it's not entangled. Moving to self-contained components without any external dependencies has completely changed the way I code web.

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#78

This is a complaint I've heard often about React, and usually it's by someone that's never actually tried it (myself included before I first used it). But it's a visceral response. Until you sit down and give it a go, it's hard to believe that we had the separation of concerns wrong . Separation of concerns refers to responsibilities, not languages. If you're building a static website, sure, you probably don't need R…

Plus React still encourages the traditional separation:

- Model is props/state.

- View is render().

- Controller is everything else (lifecycle, handlers, etc.)

IMHO it's also best-practice to separate view from presentation using CSS modules for component-level styles, and sprinkling namespaced classes here and there so that the component can be styled externally using application-level CSS.

We didn't get the separation of concerns wrong. React is the same we've been doing for 15 years, but we finally understood we had to modularize and encapsulate it to encourage reusability and true separation of concerns.

I'm never going back to traditional code that violates the single-responsibility principle. I'm never going back to manual DOM mutation. Give me modular, namespaced, declarative HTML+CSS+JS and I'll stop using React.

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#79
Separating makes sense for websites with gradual improvement. You can disable JavaScript and have usable website. You can disable CSS and have usable website. Some features won't be available, it might be not that pretty, but it'll function.

Now with web applications it's not necessary makes sense to separate some concerns. Functionality, design, markup — it's all glued together, like it or not. Remove CSS and there won't be anything but bunch of pointless divs. Remove JavaScript and it'll be just a garbage.

Re: 15 years trying to make everyone separate HTML, JavaScript, CSS – and then

#80

The images of the 2000 line long JS and CSS monoliths didn't fit into a tweet. :-) Seperation should be by the responsibilities a component, not by language. So the trend to components in frontend dev is right despite some unfamiliar mangling of html and js.

[deleted]
Post reply on HN