4 ms·
Every time "separation of concerns" and HTML, CSS and JS come up, I want to scream. I don't think I've ever seen so many people have such a shallow understandin
by lilactown 9y ago
Every time "separation of concerns" and HTML, CSS and JS come up, I want to scream. I don't think I've ever seen so many people have such a shallow understanding of what a term means. It's practically a trigger at this point.
Everyone who is confused: HTML, CSS and JS are not concerns. They do not represent an intelligent way of separating your application code. Every time you write the ID of an HTML tag, or a component- or feature-specific class name, you are violating "separation of concerns."
- seanwilson 9y agoI think the phrase "thought terminating cliche" is a good summary of this concept... I always hear things like separating everything out that way can make it easier for non-technical people to edit the HTML which is rarely going to be a practical idea. > Every time you write the ID of an HTML tag, or a component- or feature-specific class name, you are violating "separation of concerns." Yes, you can separate out a lot of the behaviour and presentation between HTML, CSS and JS but there's always some overlap you just can't get away from. Frequently you want to change the structure of the HTML just to make the styling easier for example because there isn't a practical alternative. Jumping around between files to edit the HTML, add a class, styling the class in CSS, modifying the HTML to help with the styling and then adding click behaviour in JavaScript, then trying to figure how it all works again later involves a lot of context switching.