5 ms·
The HTML/CSS/JS split is great ideologically, but have you looked at the source code of any web app lately? It’s a jumble of all 3, with modern frameworks like
by GuiA 9y ago
The HTML/CSS/JS split is great ideologically, but have you looked at the source code of any web app lately? It’s a jumble of all 3, with modern frameworks like react encouraging you to work with the whole, injecting things as needed here and there.
I remember learning CSS in the early 2000s, with the book showing how one could have separate stylesheets for on screen display vs printing. You’d think this approach would have aged nicely, now that websites need to render on a large variety of screen densities/sizes/aspect ratios/etc. Well no, now we have huge bloated CSS files full of media queries and weird things that are impossible to make sense of unless you’ve spent a few weeks in the codebase.
So yes, nice in theory but completely outdated in practice given the horrible Beast DOM has become.
Perhaps that approach was too idealistic all along, and only sort of worked in the beginning, when the web was really basic and most people were on a 1024x768 display. The form is the function and also the medium and the message, and it’s impossible to place abstract boundaries on where the content vs presentation vs interaction lie.
- meesterdude 9y agoI work with rails basically every day, and your experience does not match mine. In the codebases I've worked with, almost all of them are cleanly and clearly separated. HTML is in one directory, css and js in another. It's true react has a... different approach, but it's certainly not the only way to do it.
- ralfn 9y ago"separations of concerns" is not about putting things in different folders or files. It is about those things not being entangled as spaghetti with each other. Reacts Philosophy is that everybody's css/js/html is tightly coupled and therefor using different languages with different semantics and scoping rules increase the cognitive complexity without providing any advantage. Can I break your app by just touching the CSS? Does any cosmetic change at any point require that I touch the html? Can I write a new style sheet for your app without knowing the JS or HTML? Can I plug in a new style sheet of one application into another? Can people work on the JS/HTML/CSS separately and independently? Putting your spaghetti in separate folders doesn't make it less spaghetti. And the market knows it's tightly coupled spaghetti for everyone. Thats why you don't see different job adverts for your three different folders. The goal was to have a world where the designer would know CSS but zero JavaScript and zero HTML. This goal has completely failed.
- dkonofalski 9y agoI think web apps are a little unique because there's huge parts of them that are not content and that's where the separation of concerns originally came to be. I vehemently disagree with you that all of these things have to be entangled and tightly coupled. I think they just end up that way because it's the easy way to get through a problem and people who do things like that are, generally, lazy or on a tight deadline (for no reason that to have a deadline) or stressed or any number of things. Unfortunately, if all you're given is noodles, sauce, and meatballs, you're probably going to make spaghetti.
- dkonofalski 9y agoI don't mean to simplify your argument so much but is it essentially "well, some web apps don't follow that ideology so no one should"? I work regularly with codebases that have definite separations of concerns. Granted, I don't use react much. I think that semantic design/development is hard and that's why people end up with jumbled messes of things. Commenting code is hard too, that's why most developers don't do it. We're not here because the DOM is crazy. We're here because the DOM is crazy and developers are too lazy/taxed/forced to do it the quick and dirty way instead of the way that works ideologically and is generally accepted as a best practice. I agree that this is a realist vs. an idealist discussion, though. It's a very mild version of the gun control argument - the idealist in me thinks nobody should need guns, the realist in me realizes that people should be able to have them.