Kevin: Hello, my front end friend, and welcome to my podcast General Musings. My name is Kevin, and here I talk about whatever is front of mind for me in any given week, usually in some way that's related to front end development. And yeah, I think mostly these days it actually will be more on front end development. And the reason for that is making these a little bit more for the YouTube channel now, but they're just they are just talking head. I'm gonna continue with what I've been doing. ⁓ but the podcast form that we're in now, this isn't getting this part isn't gonna make it into the YouTube video. ⁓ the podcast form of it has been very stagnant basically since I launched it, in terms of how many downloads it gets and I guess listens, which is fine. There's I I love podcasts. I appreciate everyone who's listening to this in podcast form. And I'm gonna continue posting these as podcasts. But I just wanted to let you know that if you've been listening for a while now, it might be a little bit different. I'm gonna try to always have the intro, but if I'm in a rush, sometimes I might not. And it might just jump in like it's been doing recently. But yeah, I just wanted to let you know, like the focus isn't more on YouTube ⁓ necessarily, but we'll probably be more front-end related because that's tends to be what people listen to me for. ⁓ still be general musings and all of that. ⁓ maybe less tangents than we've had, which I know some people really like. ⁓ maybe I have a second version, like now I'm doing, where we have a bit of an intro before we dive into things where I I muse a little more about things. We'll see how it goes and and all of that. But I will be like mentioning like the comment section and other stuff, just because as I said, I I get like maybe 500 to 700 listens on the podcast form, whereas I've had videos now hitting like a hundred and fifty thousand views and other ones at 55,000 or something. ⁓ so yeah, the the video forms have taken off very much. And just for the algorithm being a little bit less meandering, ⁓ tends to be something. I don't want to make content based on the algorithm. ⁓ that's not what this channel's for. ⁓ but obviously if you get more people listening, that's sort of the point of what I do here. So you sort of finding like the right balance between everything ⁓ is always important. ⁓ so anyway, just wanted to let you know about that. That if it you know is slightly different than what you're used to, ⁓ maybe the episodes will be bit shorter ⁓ and things like that. That's just what it is. The episodes will not be shorter because of YouTube, the episodes will be shorter because I'm busy and so I'm trying to trying to keep things a little bit shorter. And make them a little bit easier to edit for myself. But yeah, that's about it. With that, I guess we're gonna jump into the main conversation now where I talk about the separation of concerns being a lie when it comes to how we think about it with HTML, CSS, and JavaScript. So I hope you enjoy. People like to talk about the separation of concerns, especially when it comes to web development, in a really rigid way. HTML is for the content, CSS is for making things look pretty, and JavaScript is for handling the behavior and everything else that we can't do. Those other things, I guess. But the fun thing, at least in my experience being a CSS guy, is most of the time when I hear people saying, ⁓ separation of concerns, you shouldn't be doing it that way, comes up when somebody's going, ⁓ you shouldn't be using CSS for that. That's the job of JavaScript. But then they often ignore all the things they're doing with JavaScript that probably should be done by CSS. Right. And this happens or has at least happened for a long time now because we just didn't have a choice, right? Though there was a lot of things that you Couldn't do with CSS. So you had to do it with JavaScript. And that sort of just stuck around a lot. And there's some things, and it slowly shifts and moves around a little bit. And we get new things in CSS that nobody's complaining about, like I don't know, anchor positioning, scroll-driven animations. I think we realize that's just styling related. So that's completely fine. But as CSS is getting all of these new features and becoming more powerful, especially in my comments section and just through conversations I've had with developers. I keep hearing that CSS is starting to overstep its bounds. And so much so that it actually inspired my talk that I just got back from at CSS Day, which was an absolute blast. So much fun, so amazing seeing so many people. But yeah, it was it. I got inspired at least partially for what I was talking about in that one, where I was actually saying, Well, things are going to change and we're going to push more towards CSS and why that's actually a good idea ⁓ in my talk. But one thing that actually came up was Jeremy Keith came to see me and he was like, ⁓ Kevin, ⁓ really good talk, awesome stuff. But I wanted to let you know that this conversation's been going on forever, which I I sort of am aware of, but not to the extent that he let me know about, because he actually put a blog post out in 2004. So that's 22 years ago, which is crazy, ⁓ where this whole separation of concerns thing was coming up because hover was part of CSS and whether or not it should only be for links or if you could use hover anywhere. And people were like, ⁓ wait, hover hover should be the world of JavaScript. That's behavior. You're you're what the user's doing on the page. That shouldn't be. On CSS. I'll put a link to his article in the description because it is kind of cool to like look back on these types of conversations, I think. And it's just it's funny how I guess it just never goes away. But I think the main thing is with all of this is like clearly, I think most people these days see hover as a styling related thing. Yes, it's behavior, but it's also style. And I think that's the whole problem with separation of concerns in the first place. The idea of HTML, CSS, and JavaScript. Being these three things where we're separating into content styling and logic and behavior and all of that, I think is just flawed. And I don't think it really even encapsulates the idea of what separation of concerns is when it comes to programming in general, where it's mostly about simplifying things. Now you see this in JavaScript. If you're doing good, you're writing good JavaScript, you're separating things as much as possible, right? You want one function to do one thing and not handle seven different things. That's separation of concerns. And that's something we should be doing when you're writing JavaScript or any language whatsoever. But somehow we got this idea of HTML being content, CSS being styles, and JavaScript being the rest, right? But the problem was JavaScript just filled in all the blanks of the things we haven't been able to do with the other languages. And now that things are changing, people are like, ⁓ a separation of concerns. That's not how we should be doing things. And it's like, no, it's not not how we should be doing things. It's well, we haven't been doing it that way before because we had no other choice. And it's just there's this evolution that's going to continue to happen. And I really think that we shouldn't be worried about it in that way because there is so much overlap. A scroll-driven animation, for example, is behavior. It's the user scrolling on the page and going up and down, just like a hover would be. So should that be in JavaScript or should that be in CSS only? Well, I think it makes a lot of sense to me in CSS only. I think anyone who's written the JavaScript To create scroll-driven animations is probably happy it's only in CSS now because it simplifies our life so much, going from a lot of code to a few lines of CSS. But it also increases performance because we're not relying on JavaScript to be constantly figuring things out and you know, tracking our scroll position everywhere we're going and relaying that over to our styles and updating inline styles and all of that. Like it's a lot of work. And now we can just let the browser pass that information directly through. And to me, that is separation of concerns. In a big way, we're simplifying things. We're getting the information directly from the browser. Invoker commands are very similar, right? An invoker command allows us to open a modal or a dialogue without any JavaScript. You make a button, you make a dialogue, you link them with a couple of attributes, which makes sense. That's the realm of content. Let's connect them through an attribute. I don't see anything wrong with that. We used to have to do the exact same thing in JavaScript, but you'd make your two elements, go and find them, and then link them. Why not just do that? So we're simplifying the problem. We're separating the concerns. We're saying this button and this dialog or this modal are connected to one another. We've simplified the matter. And then when it opens, we style what it looks like with CSS. Why do we need JavaScript? We don't. And it's not because it's behavior related, it's because we're trying to simplify the situation. And we're making this button and thing that's being opened into this self-contained. Thing that's separation of concerns. And sometimes with an invoker command, you might need some JavaScript, and that's completely fine. That API is available to do some extra things with, including creating custom commands, because I believe we can only do modals and popovers with the built-in invoker commands, but we can create custom ones for other types of things you might want to do. Maybe a button to play a video or go full screen or other things like that that for whatever reason you need your own button for. We can make an invoker command for that now. And that just simplifies everybody's life. And a little bit of JavaScript is there just to actually throw add that extra functionality into there. But it's all part of that same system. And I think looking at things in that way makes a lot more sense. But instead of getting all excited about how we're starting to simplify things in many ways, in other ways, the web is getting more complicated because of all of these new things that are coming in and these new capabilities that we do have. But there is a simplification in another way. I don't know, maybe that's a topic for another day. ⁓ but instead of getting excited about, yeah, that's really cool, people are like, ⁓ you shouldn't be opening a button with HTML. There's you know, separation of concerns, this is a problem. And well, is it really though? We're making life easier, is it a problem? Or is it just that they're not happy that we're doing it in a different way than they've been told this is how we do things, and then they get, you know, frustrated and they say this is the wrong direction, that things shouldn't be going that way. I think just because we've been so trained on thinking of HTML, CSS, and JavaScript in the buckets we have been. And even like if you think of it in like a more of a component-based system, you have your component file, and like all of the stuff for that component lives in that one file. That's a separation of concerns in many ways. And that's why I think component-based architectures become so popular, because we're keeping everything self-contained, which makes a lot of sense. But then what each one of the languages is doing there, it's handling its job, but again, there's this gray zone, the overlap between what's behavior, what's styling. When should it be styling related? When should it be the behavior as much as possible? I'm a strong believer being a CSS person that if this logic or the anything related to what's happening changes how the user sees it, it's updating the visual of it. Well, then as much of that should be done in CSS. ⁓ because to me that makes sense. That's its domain. But again, maybe I'm getting stuck there. I don't know. I maybe it's just because I like CSS a lot. ⁓ but yeah, if if We look at things more in that context. I think that's more of what separation of concerns should be. Where we're looking at the element, we're doing it as simply as possible within those languages that we have and in the way those work, instead of being so focused on, well, this is for this one purpose, this is for this other purpose. And this all does raise another question, though, that I'm not too sure about. And this is the one part in these videos I've started asking for what you guys think. And the comment sections have been fantastic. So we're going to continue that on this because I don't know what. The answer is in terms of how AI is going to impact everything, I wanted to make sure this video wasn't AI focused, but I do have a question on how you think this will be impacted because AI has been trained on like millions of lines of code the way things have traditionally been done. And the web's changed a lot in the last like two years. There's a lot of features that are coming: invoker commands, popovers, dialogues, all these things, the modals that we have now, scroll-driven animations, anchor positioning, the list goes on and on and on and on. ⁓ that aren't really part of those code bases. And I know there's, you know, the Google has their modern web thing that can sort of help steer the direction a little bit that I'm not a hundred percent sure is as good as they want us to think. But at least there are these things to say, ⁓ use these modern features and here's what they do. But if people aren't writing as much of the code themselves, there's less concern about the architecture of that code. And who cares if we're doing it in a more complex way that works? I mean, some people do because there's performance impacts, and we should probably be focused primarily on performance, ⁓ which often goes by the wayside with AI. But if people are writing less code themselves, is does this potentially lead to a stagnation of all of our languages, right? ⁓ because it we have ways of doing things, you ask it to do it, it can create some stuff, you go in, you tweak, you massage it, you get it to go where you want it to be. but if And there's people like me that will continue writing code on our own. ⁓ and I know a lot of people listening to this are probably in the same boat. But if there's less people doing that, does it put less pressure for the languages to continue to evolve or not? This is a question that a few people asked me at CSS day that I didn't really have an answer for. ⁓ it could be one of those unforeseen things that ends up happening, or maybe we continue to evolve or it evolves in different ways. Whatever it is, I'd love to know what you think about that. And I'll probably talk about it in a future video. And I think for today that is it. So thank you very much for listening. And of course, until next time, don't forget to make your corner of the internet just a little bit more awesome.