Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The deadest horse in web development is the myth of “separation of concerns”
 help



I was recently doing some very specific web scraping of some very public very static documents. About 25% of them use a soup of divs with hashes for class names. Not a <main> or <article> or <section> in sight. I am fine with the idea of what tailwind does but like at least using semantic tags where appropriate could be a thing.

You can grumble at web developers in general for things like div soup, but the hostility towards tailwind is misplaced. Hashed classes aren’t even tailwind, and the tools that generate them are not the problem either.

I do sympathise as someone who has to scrape content from time to time, but that doesn't sound like a problem for the author of the content or something that impacts their intended user.

that's a problem for accessibility too

Tbh there's nothing really wrong with that. You don't need stuff like article or section if you set the right attributes. Often easier to just use divs to get the structure right, and figure out the meaning later.

And there's 'nothing wrong' with just writing code with variables named 'a1, a2, a3'. But when some poor sod has to dig through your mess to figure out what you had in mind it turns out that having an easier to discern logical structure to your code (or html) makes it better. I've dug through a lot of html. And there's a ton of ugly code smell out there. Layers and layers of "I don't really know what I'm doing but I guess it looks okay and I'll make it make sense later". I'm sure it pays the bills for someone. But it makes me sad.

Well, it does help if you expect sight impaired people with software to find the site useful.

Exactly this.

I wonder if the people downvoted you realize that HN is basically just a big table and a bunch of div, and they use this very site just fine?


As a user, I don't care.

As a disabled user with a screen reader, I might care.

As a developer tasked with maintaining it after the original dev left, I most certainly would care a great deal.


As a developer you maintain the source templates, not the compiled/generated HTML. The HTML is messy doesn't mean the source templates are so.

Semantic web is basically "please think of the crawlers."


Except that as a developer you have access to the original source code where things are well structured. It only turns into div soup after the React/Vue code gets compiled down to HTML+CSS+JS that can run on any browser.

It's a choice. The dominant paradigms choose not to.

I disagree. And that makes me the loser here


I agree, it’s a choice. So is the opposite. Complaining about other people’s choice of doing things on the web is the choice I’m actually tired of.

Another loser here to second you

I wrote these libraries like

https://github.com/kristopolous/db.js and https://github.com/kristopolous/evda in the early 2010s. I spent months on them

I was all in. I swore off touching front end in 2022. It's terrible now


Ah, yeah. I spent the early 2010s writing front-ends in AS3, so imagine how that turned out. I wrote my own event system too when I was forced to head to javascript, but in the end I mostly just used jquery's, and it's still what I use. I agree the event-driven paradigm leads to sloppy code, but static event names are enough of a clue to what's invoked most of the time, even in relatively large projects. And most things can sensibly just be promisified now anyway, besides user interactions.

I thought it was funny that you wrote this way back when:

>> I've often seen projects where I think "what talks to what and how? What is the separation of concerns and where does this code live?"


You can separate concerns without violating locality of behavior, and that’s exactly what tailwind does.

It admittedly does not do a good job at being very DRY but I think that’s poorly applied to HTML/CSS in general, and the most DRY css is often over abstracted to the point of becoming nigh uninterpretable.


When I write CSS, I most often do not want the locality of behavior. I instead want uniformity of behavior, hence "semantic" styles. Even the trivial light / dark mode switching is pain with Tailwind, when classes like "color-gray-200" are routinely applied.

I’d somewhat agree with you there, but I usually use variables for uniformity. I do see arguments against tailwind but find anytime I’ve tried to do anything else it just feels like bikeshedding on internals for the same end result.

Really what I want to see is beautiful TDD for CSS so that uniformity can be enforced, but I’m not sure that exists.


Variables are hugely helpful, I agreee. IDK about bikeshedding. I'm very used to writing React code that normally declares no styles for components at all, and having CSS that style components using 1-2 classes, specific to these components. Container components control margins, <body> controls general things like fonts.

It seems that what solves the problem is a good component library. "But I need red text here!" For what reason? It's a warning. OK, we've got <Text variant="warning">, it will be styled appropriately, and will look like every other warning in the application.


I tend to think that if you're having issues with repeating yourself with stuff like tailwind you probably need to refactor your JSX/templates to share the repeated code. Keeping stuff like CSS isolated is a deliberate choice that helps massively with stuff like splitting code, and keeping changes side effect free.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: