logoalt Hacker News

aleksiy123yesterday at 9:00 PM2 repliesview on HN

I think this assertion is where most of the conflict comes from.

There is a fair amount of people that disagree with the premise that it should be separated in that way (Including me).

I personally like this essay by the author of htmx on the topic

https://htmx.org/essays/locality-of-behaviour/

Also just better composition imo.

Practically I think this means components of scoped css, html, js.

People never seem to have the same complaint about mixing or separating app code and sql in the same way?


Replies

timrtoday at 2:43 AM

There’s absolutely no tension between locality of behavior and separation of concerns in CSS: you’re putting styles on the elements in the document. The styles are defined elsewhere.

It’s like arguing that all of your source code should go in one big file because one file is less than two files, which means greater localization.

show 1 reply
mcvyesterday at 9:37 PM

I separate those too. Queries get their own file. Sometimes their own framework.

show 1 reply