TRANSCRIÇÃO 🔗
Hey, everybody, Welcome back to another episode of the Ruby Rogues podcast. This week on our panel we have Valentino Stole and now Charles max Wood from top End Dev's and we have a special guest this week. It is Cameron Dutrou. Cameron, do you want to remind people who you are? Yeah, for sure, I'm Cameron Dutro. I work at GitHub on the Core Productivity team, mostly working on the Primer View Components GEM, which is an implementation of the Primer design system, but I've also done other things on the show, for this thing called Kooby, which I think is some we talked about last time I was on the podcast, and yeah, happy to be here. Yeah, absolutely. So we were talking before the show and we've covered Kooby. I'll go ahead and put it in the comments here in a minute, the link to that. It sounds like there's not a whole lot to kind of rehash on that that would help people out. And so we were talking before the show about kind of the state of the front end with rails and things like that. It sounds like you might have a little bit different take than the people who are sort of raw raw hot wire. So yeah, do you want to kind of give us an overview on what you're thinking and what you're looking at. Yeah, where, that's for sure. Yeah, for sure. I'm glad you mentioned hot wire because hotware really kicked off. I think this sort of renaissance in the rail's front end world ecosystem. And I have nothing but good things to say about hot wire. I've seen people I've never I will say, I've also never used it personally on any projects, but I have seen it used it, yeah for sure. And I've heard you talk about on the podcast before. I think I us was on a couple of episodes ago talking about how awesome it is. And yeah, no, I mean hotwire is great. I think that it really sparked sort of a much need, the injection of a passion and sort of new energy into into rails, especially when it comes to the front end, because really, I don't think anybody would argue that the rail's back end is pretty solid, right like models and views and controllers or I guess models and controllers are pretty awesome. They haven't you know, really changed that much in the twenty years since rails was first made. You can get really you know, good performance. A speed I guess is what I mean, that's speed of development out of the back end, but the front end has kind of lagged a little bit. And you know, when I first started at GitHub, I was hired to work on the view component library. I used to call it the framework, and also work on primary view components, which is like an implementation of the Primer design system. But just components are awesome. Oh yeah, do I completely agree? No, I think they're great too. Yeah, no, for sure. And I think that that was one of the reasons that that was sort of something that came into Joel's mind. Joel Hawksley is the creator of your component. The reason that that sort of came into his understanding and his thinking was because of him seeing you know, the React world, seeing components there, and also just realizing that Rails was kind of having a moment, you know, in those days when it came to the front end, and so more thinking it around the front end was sort of happening. And that's why if your component sort of came into existence, and you know, if your component has been phenomenal, there are some rough edges still to it that you know, as a as a maintainer of it, I can sort of maybe see you know, more clearly than than other people. But I think for the most part it works pretty well. The thing though about all of the front end and rails right now is that there's there just hasn't been a lot of thinking about sort of you know, reactivity interactivity in the same way that like the react and the s felt and the angular communities think about it. Right, So that's what I've kind of been thinking about lately has been like, how can we kind of be how can we sort of have our rails cake and and our and our front end cake. I guess maybe other front of ice cream maybe eat them together? Right, So yeah, so I'm thinking about a lot lately. Actually to that point, I saw, oh, go ahead, Well, I know, I think it's an interesting conversation to have. I think hot wire solves some of these problems, but yeah, I don't think it comprehensively solves them all. Of course, I'm still learning pieces of it, right, So for the people who are saying, oh no, it totally solves them, there may be something I'm missing. I'm just gonna be honest, right, But yeah, there are definitely some things that I see people doing with say a react or an angular and we have shows on both of those. Right. We interviewed what's his name, the spelt guy. Oh yeah, anyway, we had him on Javascrip Jabber. I'm gonna remember his name here in a minute. But and he was talking about spelt five sou. You know, people are seeing problems on the front end that they want to solve that give people a high level of interactivity and and give it capabilities that you know, maybe you're a little different with a rails hot wire build, so i'd i'd love to talk about. Okay, so when you talk about reactivity in say a react or a VELT or whatever, what what specifically are you looking for? Yeah, that's a good question. I mean specifically Bridge. I'll put a link to the right. Yes, that's who it is. Yes, Yes, he's awesome because it came out I mean literally like a month ago, right, yeah, I think I saw it on a feed. Yeah. So. The the interesting thing about sort of my my sort of realization into into why the rails front end needed sort of more help than it was getting from a view component is that I saw a talk at Sin City Ruby by the shout out to Jason Sweat. He's been a panelist on this podcast before. He did a great job organizing that again for the second year in a row. And I got to see a talk by Jason Charns there where he was talking about how he had worked on he was at Podia. He'd worked on this like interactive site builder sort of thing where
Load full transcript
you could kind of make your own, your own website for your for your the courses you're selling quotas, like a course management and delivery platform. And he had tried to create it in Rails before he you know, as sort of the iteration number one of this thing, and he had used Stimulus and I think probably hotware in the back and all. I'm not sure. I think there were some turbo frames involved. And the idea was that you go into this site builder and you could, you know, configure blocks of text and put images in there and whatnot and click save and that would just become, you know, a website that other people would see and they could see your products and your courses and stuff. And they tried to build that. His company did, tried to build that, you know, with all those tools that Rails comes with. It's so stimulus and hot wire and I've wanted to decided not to. Ultimately, what's that I've wanted something like that for a long time myself, something I could plug into a railroad. Yeah right, No, completely, and I feel like there's some of those that already exists. I'm not sure. I don't know if they wanted like a full on like tiny CMS or whatever solution, or that's not the right tie whatever the site builder tool is for for like or n Django for a drupele. But I think he went in a little lighter weight than that. So they tried to build it with sort of basic rails technologies and then decided to go with React because they couldn't get it to tell that he couldn't they couldn't add all the features they wanted. And I'm kind of glossing over some of the details there. And unfortunately that talk wasn't recorded, But if people are curious, I'm sure you can reach out to Jason on Twitter or x But so, but I watched him. So what he did during that talk was he describes where the problem they had and then he walked through implementing that with stimulus and with hot wire, and he live coded the entire thing. And the thing that I remember from the talk is not even really the problem he was solving. The thing that took away from that is like he just flipped back and forth between like five or six different files. He had to touch controllers, he had to touch stimulus like rails controllers and stimulus controllers, he had to like wire up IDs in all these different places. And I was just looking at this going like, holy smokes, this is really complex and there's lots of little things you have to remember to do right. And again, nothing against those technologies. I know people who have used both stimulus and hot wire to great effect. They love it. It's awesome, and I think for certain use cases it probably does make complete sense use to go that route. So I saw that talk and then it sort of contrasted with my own experience at GitHub, where so this has maybe sort of made a splash a couple of months ago, but GitHub is has sort of decided to go all in on React. Like a lot of stuff is being rewritten on the front end is being rewritten, and React the core experiences are sort of moving over there. And one of the projects that, yeah, and one of the projects that I was tasked with doing was this global user Global user nab drawer, which is the thing that slides in from the right of the screen when you put on your avatar. There's a bunch of navelinks in there. And I've written React before, actually quite a bit of React before at a previous company, And so I dove into that and got that working and sort of reminded of how awesome React is, right, like, not necessarily for bundle size, not necessarily for efficiency of rendering. Right, the React is awesome from a developer experience perspective, Like everything's in one file. You know, your HTML and your behavior in one file, you know, hiding and showing things as a matter of just adding a conditional inside your JSX, right, Like it's very And also we were using typescript for it, so like all the types were there to help you guide you towards the right solution. It would compile, I'll give a compile error if this someone is broken. So you know, lots of just really nice ergonomics sort of that you don't get if you're doing hot wire, and you don't get if you're doing even something like a web component. Right. So after doing that work, and then also I was there's a couple of projects we also have where we're trying to remediate a bunch of accessibility issues. And I've been put on this this v team. This is sort of this strategic accessibility on Blocker team. Now where I'm working, I'm back on prem review components, and I'm where this team and I are creating this thing called a select panel. And the select panels basically a click a button little panel drops down, you can filter the results that it fetches results from. The server displays them and you can filter them and choose the one you want submit the choices. And I'm doing this now all in web components with just like basically a very procedural like imperative JavaScript, the way that a lot of JavaScript used to be written back in the early days of j Query whatever. Where you'd like select an element, you can toggle a class on and off, you can grab an element, grab its parent, stick an element in. Like It's just lots of very sort of fiddly and error prone dom manipulation code, right, And contrasting that with what I had done and React, it was just like whoa, there is a big disconnect, like a big impedancepismash that's the wrong term. There's a big like difference between how these feel to write, you know, and I really prefer the React way because it's just so much easier, simpler, Like it makes more sense to my brain, and not even I want to say more sense, it's they make the same amount of sense. It's more just like the less I have to do so much less debugging in the React version because I can declare something like, you know, display this or don't display it, and when the properties or the state of that component change, it rerenders. Right. So there's just there's just a it's just a much
nicer developer experience over there. And you know, it made me I mean, I was initially sort of very against the React migration at GitHub and sort of made my feelings known and you know, didn't didn't make a lot of friends that way. But you know, it's uh, you know, having having now sort of had the dual. And part of that was because I'll be totally honest, part of us because I really was sort of invested in view components succeeding, right, They wanted to that to succeed. And again I don't think that there I think there's probably a place for both of those tools, right, there's a place for and there's also a place for hot wire potentially in there too. Right. But but but just what we got really thinking was like, why can we like not have this, Like can't we make components in Ruby that can run in the browser and sort of get a lot of this same sort of cool reactivity that we get from React. Why can't we have that like in a view component or a flex component or you know whatever else. So that's I'm setting the stage there for what I've been thinking about lately. Yeah, that's a lot of stage, but it's it's definitely interesting, right, I mean what you were talking about, just as the example that you're using here from Jason's talk, there's the system out there called Builder. So there's builder dot io and they you know, their CTO is Mishko Heavry, who created Angular and then later created quick and so builder dot io is sort of this front end you know build uh you know visual builder front end. So that yeah, you can add in this is the text, this is the header. But you've kind of got a component you can put in there, right, and then you've got you know, maybe you have another component that's columns, and then you have a component that goes in each of the columns, right, and so you just visually drag and drop and yeah, like I said, I've wanted to be able to do that in rails for a while and yeah, you know that level of interactivity just to put your finger on it, you know, would be really really nice. But yeah, what you're talking about is kind of how I envisioned it working, where I could create a few component rails, right, and then have it behave the way that I want it to on the front end, And yeah, I was having trouble figuring out how to do that in a way that makes sense. And what you're talking about was react where yeah, essentially you just kind of put all of that together in a component and then you say, hey, I want this component here and this component here, and they interact and interplay in these ways. Yeah, you know, that's really really nice. And you can get some of that with the stimulus component or stimulus controllers, some of that with turbo, but it's not always completely seamless, I guess in the way that reacts and the other pieces is Yeah, ultimately i'd like to be able to just yeah, put up my rails view components and have that level of I don't even know that level of interactivity or reactivity like you're talking about, where I don't have to go in and code it twice, right, right exactly, just just have it do what I need it to do and have it dynamic enough so that, yeah, I can pull some of this stuff together and make it work. And I haven't given up on that idea, but I don't know what it's going to take to get there, right, Yeah, I mean there's kind of a lot of like, yeah, question marks about how we get to that point. I mean, so there are a couple of because one of the things I think that maybe it's one building block we can talk about it is like how do you get Ruby to execute in the browser? Right? That's kind of step number one. Like if I have a new component and it's a Ruby class and it's got a Ruby template associated with it, right, that's the standard view component architecture. How do I get that thing to run in the browser? Do I transpile it to try a script? Do I you know, ship an entire Ruby run time to the browser. And there's lots of interesting questions there, and there is a you know, there's that project Ruby dot WASM, and I've seen actually, Jason Turns also has a project where he got Ruby running in the browser, which is super cool running via WASM, right, it's very cool. And you know, you can get basically like a full on Ruby version running into Browse. You can do I RB, send it commanded, it'll spit back results. It's super super cool. But like that binary WASM file that you're downloading is like, I think fifty megabytes. It's like thirty compressed or something, which is pretty big when all you need to do is render a couple of components. It's pretty heavy, right, So that's a super good option I think for people that want to play with it for you know, for at the beginning of the process. Yeah, yeah, I don't know. I don't know if you necessarily So the kind of the approaches that I've seen to this are you've got people who essentially have a view component and then what I've done, and I've seen other people do, is they put a stimulus controller around it, right, And so then what you do is you get a lot of that interactivity, but you know, it's not necessarily as convenient as say JSX, where it's all in the same fiol and it all kind of plays nicely. Right. The other thing is is you have to kind of fiddle with some stuff in order to get you know, sort of the level of dynamic, Right, I've had to kind of cluge some stuff together. For example, if it's hey, I've got this container, and then I want random stuff to show up in it, right, I kind of have to play with it a little bit, massage view components to make it work. It's not impossible and it's not horrible, but it is a little bit messy. And then I've seen people kind of go from that level, you know, you go all the way up to React and React actually has server components, is that you know, and they're still working out some of the kinks. But right, so could you have Ruby just server render, right, so you wrote your view in JavaScript or and React but have it server render those or yeah, do you
go all the way to hey, here's Ruby and the browser and you know, solve some of those problems? It seems like those are those are kind of the levels that I'm looking at for some of this. Yeah. Yeah, I was thought too, like there's like a middle ground, right with like opel or something like that. Yeah, that you can even use Like I thought maybe like with the the influx of LASM too, we would see like OPAL like revamping up right, like people just like dropping opel in and then like okay, now there's like a middle ground that can also run like in browser, like as like a proxy service that does just bridge the gap. Yeah, yeah, JavaScript, so it would slide in to you know, you still have that server rendered component and then you have OPAL on top of it, the same way you would have stimulus or something else. Right, Yeah, I think that's right. I think OPAL could be like OPAL could could like bring some of that reactivity, like if you could listen for like or I don't if you could listen for this, but you could define an adder reader adder writer and then hook into that like when you set an instance variable that could automatically update the component and render the template or something that could be really cool. Yeah, yeah, there are definitely options there. Yeah, it has like a document ready like triggering for it. Oh there you go. Yeah yeah. Oh I should mention too because Chuck you mentioned stimulus controllers and I realized that I didn't sort of mention this before. But primary view components the way that we add interactivity to our view components is via web components, which is what essentially what Stimulus is also doing. It's like a yeah, so we have web compan different approach, but associate with them. Yeah. Yeah, it's a different it's a different approach, but it's very similar. Yeah. So web components just give people a little bit of background if you're not super familiar, because I know we have people at different levels, so some people may be familiar and some aren't. But web components are actually a standard that that you can write custom elements and things like that too, and so it's approached kind of similar to some of the other ones that you'll see out there. But yeah, they're just a really nice way of like encapsulating some JavaScript behavior. So you can say, like you have a job script class and that's that corresponds to an age element, and then when like click events happen inside that, you can you can listen for them on the on the component classes. Something can say like this add event listener, right, and that well you'll be able to handle events that happen inside the component. You can also say like this dot querry selector just like it's a document dot quarry selector, so that the quary selector happens just within that one component, like within that one component, it's children. So it's just a nice way of like of saying, I want to scope like all of my JavaScript code to like this one the ex section of the dom tree, right. And also what components are also really cool because they also provide this shadow dom concept, just like React sort of introduced back in the early days. So you can have a shadow root attached to your your component and you can stick like like CSS styles for example, in there, and those will only apply to that component. So there's no sort of global CSS anymore. Where I mean there can be, but most of it is. One of the benefits of having shadow is you can to attach like CSS styles that don't escape the context or the confines of the component. So that's pretty cool too, right, So we talked about WASM, but go ahead. I didn't realize that that shadow root mode is compatible in all the browsers. I was worried that question. Yeah it is. I just looked it up because I was looking at that before and now it's all green. So yeah, there you go. Yeah, that's the nice thing about useful. It's the nice thing about a lot of those standards is that because the browser vendors are all interested in pulling together and implementing the web standards. When they get adopted, they're usually pretty good about doing that. And web components they seem to come back into vogue often enough that yeah, people want to see him work, right, Yeah, it's it's it's interesting because like web components are very cool, but they again sort of only serve part of the only sort of solve part of the problem. I think I saw like a post on masses On a couple of months ago where it was like I think it was Dave Copeland, who I think has been on the show before, and he was saying, like I think he's like, basically the title of his article is like web components are a big nothing burger because in his mind, they didn't really add a lot to the table. I mean, so there is that scoping concept you talked about. You can define you know, a custom element attached behavior to it, you have the shadow root. Those are cool things, but they don't really, at least in my opinion, they don't really come to like, they don't really meet that level of like awesomeness that is react right or that is there. It's a view, right, they don't add that or even even something like solid. I just listening to a podcast about solid the other day. It's pretty cool. So all of that is is great, Like web clones are awesome, but they don't I don't think they offer the same things that REACT as at least I don't come to that level. And so a lot of people are saying like, well, these are there, they're great, and you can use them in particular circumstances, but they don't really give you the same right stability that reactes. And to that point, you know, I think stimulus and we actually use this thing GETU called Catalyst, which is very similar to stimulus where you can like attach you know, you can you can put little data targets and stuff on your children your web component and then it will automatically have those available as like properties on the component for you, and you can attach event listeners using
data action. It's very similar to what stimulus does. The thing about both of those, though, is that I still am I'm working on this select panel thing I mentioned. I still have to do just a ton of domb manipulation and manual event listener adding and just like so much messing around and then I have to like iterate on that CONSOPLET like this trying to get select panel, at least the version we have, trying to get that to support sort of multiple modes for fetching data. Like I wanted to have totally local where it just filters the list that you render from the server. I want to have like an eventually local where like it fetches results and then filters those in the browser. And there's also like a fully remote mode where it always fetches every keystroke you're typing in the filter input. Right, all of that, like getting all of that working together was such an enormous pain in the butt. I spent days days to get that right. And React that would have been much much easier, least I think it would have been. So that's where my head is at, right. It's just like I feel like we need to maybe start being a little more honest in the rails community about like how great React is and like how how much better it is than even something like hot wire. And again, I don't think there's I think there's room for all of these technologies. It's not like we have to pick one right, like we can definitely choose all of them together. So but anyway, so to the point of like OPAL, that was the next thing I was going to mention is like Ople's really cool, like it transpiles your Ruby to JavaScript right front of the browser. I looked at OPLE a little while ago, and the thing that kind of got me was that, like you still like the big standard library that comes with it's like four or five hundred k right that you're like downloading, and that's just for running some Ruby code. And then the transporlation process of Ruby to JavaScript itself, like you're adding a lot more to the bundle size because it's not just Ruby anymore. It's like Ruby wrapped in JavaScript. So I kind of didn't I mean, Local was super cool. Again, not trying to take away from any of these technologies, but it was like a little too heavy for what I was thinking we would want in rails. And actually, so to that to that point, just a couple of like a couple of two years ago or so, I started working on a Ruby implementation written in JavaScript called Garnet, and Garnet has been a super fun to work on, but it's essentially, yeah, it's like an implementation of Ruby like written in type script and so you can like you know, import this thing, and I think it compressed. It's currently and of course it's not fully fledged yet. It's not the whole like Ruby Standard library in there, but it comes in at like ninety seven K I think, or something compressed or a little bit less than that sixty I think. So it's a lot smaller. There's no transporlation. You don't transpile your Ruby code. You just give it some Ruby
code and it will use the prism parser, the parsit and then the you know, execution engine in there to run the code and it sort of just boils down to job script native types the end of the day. So like the Ruby string class just wraps a jobscript string. Right. So that was that was super fun to work on, or has been. It's it's definitely not done yet. It's a bug still, I'm sure because of writing a RIBE implementation is not an easy thing to do, but it kind of it got me fired up about thinking about like, Okay, so because all these previous solutions, right, like WASM is super heavy. Opal's pretty heavy, Like I wanted something not as heavy, right, So that's what garnet is supposed to be. So yeah, there's that to think about that. For a long time, I got like all of the flex tests passing in Garnet, thinking like maybe we could run a flex component in the browser. But then just over the last couple of weeks I've been able to hack together this, what I think is a pretty cool demo of rendering. Not it's something, it's just a it's just a Ruby class so using Garnet you can load I'm calling it NIDO the need a Needo component and it's just a class with some instance variables and like some state getters and setters, right, And what it does it sits on top of LIT, lit HTML and lit element, which is another sort of reactive JavaScript framework, really lightweight, and it takes your your template and compiles that into Ruby that calls the LIT methods so like lit dot HTML, and that's how you that's how the template gets defined. So again it's taking your existing you know, not e ERB. It's actually using rocks, which we talked about a little bit on the show before, but you can think of it like EREB. It takes it your ab template, converts that into what LIT expects and the whole thing then runs in the browser and uses web components. So like the Ruby class instance is like attached you know, to the to the web component, and you can do things like define event handlers as a real lamb does. Let me click a button, the random will run, update the state state preventers the component. So I'm really excited about that. It's I'm amazed that it works at all because it shouldn't, like it shouldn't do this, But yeah, I've been I've been working that a lot. I think, yeah, at some point we might be able to actually have like Ruby components running in the browser, whether you're using you know, Ruby dot WASM or opal or Garnet or whatever. As long as you have that run time in there, I think it's possible to like do this, and I think that would be a pretty big leap forward for rail CUI. Yeah, one hundred percent agree. This is really cool stuff. By the way, I'm gonna have to, like you do a lot of this later. Yeah, but yeah, because I was trying to run, you know. One of the hardest things with the whole like wlasome aspect of it is like just getting up and running. And there's like so many examples, but like even still it is still kind of like a hurdle. And I know that they'll keep making that easier obviously for sure, but still, yeah, I'm not sold on on the idea of using it as like our go too. Right, It's still it still feels a little clunky, right, and and and bulky like you mentioned, like it does like the packages to like they add up, and like you don't need the whole Ruby run time right to like run your little components so that everything. I just imagine, like you know, putting it on a you know, mobile device or somebody like in like a terrible connection, right, Like that's it's not a great like start, like especially with everybody using mobile first, right, like yeah, yeah, no, that's a really good point. Like actually, do you know who Alex Russell is? Oh yeah, yes, okay, okay he I mean he for the longest time has been like railing against modern front end because of how heavy it is, right, And a lot of that I think is well not a lot some of that is attributable to React, right, but it's also just like the bundle sizes in general have just gotten and even to render a static site, you know, you're loading in just tons of crap React and all these things on top of React, and you know component libraries and you know CSS library. I mean, just so much stuff. It's crammed. And even if if you're just visiting a simple blog site, right, and you know, his his thing for a long time has been this might work fine if you live in a developed country like the US, and you're even even even then, if you're not in a big city, sometimes you're you know, your experience can be can be not as great as it could be, right, But what he's really thinking about is people who live in developing countries. Like Google has this project they call it, I think they call it the Next Billion Users, and they're saying that, like, you know, the number of people online right now is only I don't know, a third of the whole you know, world population or half or something. And the next billion people that come online are going to be doing so on mobile, on terrible connections with crappy devices because they live in these developing countries that are just coming online now, right. And I think that they were saying this back in like twenty fifteen or whatever. It's been a long time since, and I'm sure a lot of people have come online, but to the point where they were saying it was like three hundred thousand people or something were coming online every day, right like it was a crazy pace of like more people getting added to the Internet over the last couple of years. And you know, Alex's point, I think to a large degree has been the experience that those people have with your blog that has you know, ten megabytes of drum script delivered to the browser is just a terrible experience. Their phone can't even load that page because it's so heavy, and to the extent that the bits actually flow to their browser, they flow slowly because they have a terrible connection because it's like two G speeds. So, you know, his rally and cry lately has been
like, let's just make the web less bloated, like, because it's going to be much worse experience for everybody, really, but especially those people who are coming online in developing countries. And I have to say that really sort of resonates with me because I have visited certain developing countries and have seen sort of firsthand how sort of difficult it is for people to get internet connections. I would visit a Peru back in like twenty ten granted a long time ago and the only way you could really get internet in Peru was via internet cafe. That's all they really had for You couldn't get in your house unless you knew somebody like at the ISP who could like hook you up. Right, So I'm sure things have changed, but you know, it's it's just worth considering. I think that large portion of the population that you know won't be able to visit your site, or will visit a site that loads very slowly because you know they have a bad connection, bad device. Yes, low end. I think we had a very similar conversation with Alex last year when we were talking about web performance, and he basically pointed out, if I remember correctly, that yeah, you still can't count on a great connection for Yeah, that's true. That's a good point. Even in developed countries, it's hard to sometimes, you know, if you're behind a big building or something in San Francisco, even then sometimes you have problems and you know, getting a page load or a signal out. So for sure, Yeah, so we've been talking about this for about thirty five minutes. If I look at the clock on the recording, and I guess there are two questions that you're kind of coming to mind, and we've kind of been, i think, circling around them a little bit. One of them is, okay, so what do we do now? Right? What? Because we've kind of talked through all the different options that are out there, But what do we do now? And what can we contribute to now that will move the state of the art? And then two, where do you think we end up? Right? Do we solve this with view components that are front end enabled or are we going to just wind up kind of settling back into something like a react or stimulus will get better, I don't need I don't even know, right, WASM gets smaller on its package size or whatever. Yeah, good questions, man, So what can we do now? I think that like rails are sort of uniquely positioned to sort of be the less heavyweight framework of TROY. Like you know, in the Rails, sort of the rails we have doing things, but you're not really shipping a giant front end. You're just you know, you're shipping some HTML and there's some jobs sprinkles. So I would think that rails in general is like now people can low whatever the jobscript LIBRA is, they want to and from a Rails app of course, but sort of by default Rails is pretty lightweight compared to React or Gatsby or anything else that uses reactor, viewer spells or whatever. So because it's also it's not just about bundle size, it's also about how long does it
take the browser to interpret your JavaScript, like load that up, parsit, load it, do whatever actions are necessary to init it, right, to initialize it. So you know, it's all that stuff. It's sort of as a as a whole that makes that impacts performance. So but I think Rails is uniquely positioned for this, maybe not uniquely, but certainly well positioned for this. Like other frameworks that are sort of more classic in the way they deliver front end experiences like Django, you know, it's probably also similar in that regard. So yeah, what can we do? Mostly what I think I would like people to think about is that if you don't need to use interactivity, if you don't need interactivity, if you don't need you know, a super dynamic experience, like don't use React for everything, don't use view for everything, don't use hot wire for everything, like choose the thing that is going to solve your particular problem and in sort of the least amount of front end code you can. Right, there are going to be some things that really do need that full on interactivity that React brings, and that's totally fine. Use React for that. It's a little hard because you know, React does kind of want to take over the whole page, so there is kind of a you know that there's conspiration there. Yeah, for sure, I don't know about other frameworks. I know React for sure is like that. So but there's lots of interesting work being done now about React islands and quick I think has this of partial hydration concept where you can just hydrate part of the page at a time with your components that are coming from the like the job scripting coming from the server, it's in runt of those components. So yeah, well you've got astro as well, which implements the island's architecture, and you can okay, you kind of box it in a kind of a little bit, right, So yeah, I guess what I'm really advocating for is just think about what you actually need. You don't need to be using React for your blog, for example, like use Jeckle for your blog. Just get people Htmo it's going to be lightning fast. You don't need any jobscript front time for that. Just some HTAM and some CSS should be enough for that, right, Yeah, you know this reminds me, Like this reminds me of like kind of who we're building things for in this specific case, right, Like I feel like most people were working on like the reels front end side as like as the reel st app starts to grow like beyond just like, oh I built this thing, right Like, you get people that are all front end, right who aren't really necessarily familiar with reels, and they can come up to the speed like enough, like you component is a great example of that, right, Like sure they learn how to like read ERB or how the templating syntax is a little bit different, but it's still like kind of a bottleneck. And I know that there are now like kind of ways that the component like addresses these specific cases, but it's still like you know, a side step, right like it it removes them from their like typical flow. Uh, And it's like you know, a new DSL they have to learn, right, And I just keep like thinking about the like the older days of how reels used to answer this with like Rail's assets, right, where like every JS package was like a gem and you just say, okay, like I'm using this gem as this job package as a gem instead, right, And I honestly worked pretty well. It was cool. It was it was cool. I mean I wouldn't want to like continue that now, but like I feel like just that idea of uh, you know, catering to the audience and just keeping things like in their their realm like that. Yeah, that's solved the problem the best, right because it kept it kept it made it available for both, right, Like it made the rails developers happy because they could introduce new things to the people that needed them, right, and then it just showed up in the reels asset pipeline, which right doesn't exist. But you know, it consolidated things in an easy way. So I feel like there's a like there's a happy path there. I don't know what it is, but I feel like we're like highlighting a lot of it now, right, Like I'm worried that we're just like reintroducing like the same things of like all right, just like a new DSL, right that's like really just outside of what people are using. Yeah, No, that's a that's a super good point. I just saw somebody on mass and say this too, where like if you the more you stick with kind of the rails defaults, the better off you're going to be, basically because somebody can come in and make changes right away, you know. Well, and a lot of that stuff is designed to kind of ergonomically, I guess, or developer experience aligne and so your thought processes can follow a common pattern. Yeah, definitely, yeah, I guess what I what I've been thinking is like I feel like as an industry, maybe not as much in the REILS world, I have to pull people, but like we've sort of decided that the components are good, right generally speaking, do you want to use them everywhere? I don't know, maybe not. I can react. You pretty much have no choice. You have to use components everywhere. But in rails, right, you can use a view component in the middle of a partial. You can under a partial from a view component, right, like you can mix a match. Rails is on the casse, right, So I think that's a that's a nice sort of wage and a get up. Like that's also how adoption has happened, where people have just been like I think the component's great, and maybe I want to reuse this bit of you I logic going to wrap it in a view component. But the rest of my UI like stays as templates and stays as partials. I think that's totally fine. But in general, it feels like components are kind of one a thing that we've kind of decided on the web at least are a good idea. And I feel like we've also sort of centered on this idea that reactivity is good too, because that's maybe the biggest thing that React gave us. Like sure react gave us GSX, Sure
React gave us adding behavior to dominleance or whatever, but it also just gave us this reactivity idea, and that sort of just changed a lot of what web development could be. Right, So those two things, components and reactivity, I think if we have those two things in the front end, but we don't maybe put too many limitations on that, Like we don't say you need to use this syntax instead of ERB, or you need to use this component framework. Right, if you just let people render strains basically or like define a template however they want, then there's not this sort of artificial like you have to use this framework dujure, because like, one thing that I think is just so funny about React in particular is like people don't put like I'm a I solve problems. I solve web design problems. I solve problems. My customers have the don't put that stuff on the resume. They put like I'm a React developer on the resume, right, And to me, that's just absolutely wild because like React is a technology, it's a library. It's not it's not a problem. It's not like the way to solve problem or a way to solve problems, I guess, or it's like how do I put this? That's not You're not a React developer, You're you're a programmer who happens to use Reacting your job. Right, you can use React to solve problems. You've seen it before. Rails is the same way, So like, sure, add that to your list of skills, but like what you actually do is solve problems, you know. But this is coming up more and more now where people even to get time, people will apply or and even people will say, you know, I don't really want to write Rail's UI because I don't want to be I don't want to put that on my resume, want to put React experience in my resume. And I'm just like, man, I don't feel like that is what you should be doing on your resume. I feelink it was putting things like here's the cool product that I shipped, you know, and it just sort of incidentally used Rails or incidentally used React. So anyway, well we fall victim that in Rails and Ruby too, right, like you know, absolutely, but employers, employers fall victim to it too, right, and so they they and and that's where you know, so I put I'm a Rails developer because the employer knows that they want a Rails developer, and so I'm speaking the language that they're putting out into the world. And anyway, that's a lot of times, yeah, they're too short sighted to even recognize, Hey, this this person's been building apps in on the web for you know, eighty years. It's not that long, but you get my point, right, And so they could probably pick up our stack within a couple of months, and then we would benefit from all of that experience they have in solving a lot of these same kinds of problems. Yeah, exactly, because like the web works the same no matter what framework you're using, right, like HML, CSS, JavaScript, Like there's not that much different in these frameworks, and you know how that stuff works and interacts with each other, then you're probably going to be able to pick up sort of any stack that they have, Like I've picked up you know, Elixir work and JavaScript and Ruby and Python like you know, it's and it really at the end of the day, it's really not that different. So no, I don't know about some parts of I mean, I like rails and I there are parts of it that I definitely appeal to me, but yeah, fundamentally a lot of the problems are the same. It did make me think about a topic. I'm really interested to find out what you think of, Cameron oh show. And that's because one of the big things that I really liked of React when graf ql started, like ramping up, was there like blend of basically data causing the reactivity. Like what are your thoughts on like the coupling of like data like driven like you know, front end changes and vice versa, and like you know where that blend lies and like maybe where we could start like digging into that. Yes, Oh, that's such a good question, right, because I think it's like a lot back in the day, maybe not so much anymore. You would like go to like a React like tutorial and they'd be like, here's some data hardcoded into your component, you know, like as a Jason object would like render this and it would show and there was no conversation at all about like how you get that data from the server, right, So like it was all it was. You'd get to this point where you're like, okay, I can render this component, I can read this, like how do I get that? And nobody know these tutorials would ever go to that to that place. They would never say like, okay, now here's the back end code that you should you should try to get standing up right. So that's a great question, and like that's sort of another place where rails, like rails developers know where to get data from, you know, act your record object, pass that into your view component maybe, or pass that into your template and render the properties from that. Yeah, so like we we know how to do that sort of maybe more than a lot of jobs for people do. But the question I think is like how do you sort of efficiently get that data from the back end? To the front end. You know, do you stand up like a rail's API or something where you're responding in Jason. That's certainly a way to do it. One of the really nice things about hotwire is you don't have to worry about that because the servers generating the instrum that you're just jamming into the dom. So there's no worrying about, like how do I get the data? All you do is just get HTML. So, you know, it's a really nice benefit there. We don't have to like think about getting data to the front end. What I would would love to see at some point is for someone to figure out, and I think this is probably already possible, is to figure out how you could sort of hook up react or hook up you know, this Needo thing or whatever to like broadcasts from action Cable. So like when something changes, you know, in the back end, it serializes that to Jason and then
sends it to your page via pub sud like automatically, and then your component updates based on that. So if you could say, like in your component like subscribe to channel whatever I don't. I haven't used action Cable, I'm gonna come across as an idiot right now. But like you know, some some directive in your in your component that that knows how to listen to these events and then update the dawn from that. I think that could be super super cool. Stimulus reflex do something like that. Oh is that what's okay? I actually have not looked at stimulus reflex. I think I think that the idea behind it, and it works exactly. So use this cable ready behind the scenes, and then yeah, when when stuff gets updated then anyway, I have to admit I have not used either. Nate Hopkins and Eric Berry are their local guys that I've known forever, and yeah, they've they've done a lot of this. In fact, I'm trying to get Nate to come on the show and just talk about all the stimulus magic that he's doing because it's awesome. But yeah, so I'm pretty sure that that's how that works. It is exactly what I'm talking about. And but but on the on the other end, I mean what you're talking about on the front end is okay, I've got the data right, so now I have to set up my if I'm using stimulus right, if it's sending it back over Via and Jason and not HTML where Turbo can update it. Then yeah, then I have to program my stimulus controller to know update here and here and here and here, right, and so what you're starting to see with Angler just implemented this. What's the one that anyway, so you've got signals now on the front end, right, Oh yeah, and so you've got you've got this reactivity that's coming the other way. So the way that it used to work was with observers and so you had like our chas and so what it would do is it would it's kind of like the innumerable module in Ruby. It is kind of the way I think about it, right, where you can pass matt compact, you know, and you keep getting this array of things with them. It's an array of essentially it's events. I can't remember the exact term that they call it, but yeah, so then it would trickle through to everything that subscribed to those events, right, that event stream. But signals works the other way, where essentially it says everything that's bound to this value, when I update this value, it it updates everything that and so it's it's really slick, it's very fast. And yeah, so anyway, so there are a lot of options on the front end that kind of can tie into what we're talking about with this. Yeah, here are the updates thing right, Right. That's super good to know because I do think we kind of want a data binding story of some kind, right, Oh absolutely, And you know I think in some instances, I mean, Turbo's great. Right. So I ran across an article I think it was Alexandra Ruba. He wrote an article that was basically a hey, I wrote stimulus and Turbo pop up search feature, right, And so it does a motile pop up and then
it has a bar where you can type your search term into, right, and so when you you know, when you type it in, then it automatically goes back and it uses turbo frames to load in your search results in your modal. Right. So it's real slick, and it's it's it's this nice feature that you would love to see on like every website you use. And so I was like, oh, wow, that's really nice, right, But just to kind of for the things that aren't quite so, hey, just replace this with this. It's like you're talking about, Hey, the data's been updated, somebody type the chat message, you know, what have you? Right, you don't necessarily need or in a lot of cases want turbo to you know, do that work. Maybe you do, and maybe it's fast enough. I think it depends on your problem. But yeah, just have the okay, here's your data boom, you know, and have it fan out and it does it through whatever JavaScript mechanism is the state of the art these days. Yeah, yeah, completely. I'm giving a talk at the sf RBY meet up on the sixteenth, and like I'm trying to get like a to do list, you know, the classic to do list example, working with you know, Barnett and Neat and all that stuff, just to show what's what like if it just make it for myself to see if it's like possible. Right And by the way, shout out to to Evil Martians and Irina and as a Robo has been putting together. She's revived the s f B meetups there they're happening again. So that's cool. Didn't we have some critic of that working. I think she's been on the podcast. Yeah, yeah, I don't know that. We had Irena, we had a we had something Victoria Victoria. Yeah. I think Vladimir Devenia has been on on as well, who works at Evil Martians. So anyway, my my thoughts there have been like I want to get that working, but I've been thinking like how do I get it? So because there's no data binding story in nito at all. Right now, I'm like, how do I do this? Would it would it make sense to like when you when you want to add a new item or edit an items more to adding one, I want to add a new item. I submit her request to the server saying add this item. But then does the server respond with like all the items that I should be seeing, or does it just respond with the one that I added and I have to append that somehow? Like in the React world, right, you would just we were into the whole template, so you would need all of those items or what. I guess you could do it that way. But the other option now that I'm thinking about is like just go add the item and don't worry about the response and just let the broadcast of the pub subhandle adding the item. That could be really cool. Yeah, so signals first showed up in solid JS and yeah, I'm trying to remember the game and then we kind of copied them. Yeah, oh, I just that's there's a JS party podcast about that I'm just now listening to what is his name? I feel like it's Alex something. Also, Oh no, Ryan Carneado, Yeah, Ryan Carneado, and I taught. I talked to him at a conference in Amsterdam last June and just for hours, and then I listened to him talked to somebody else. I can't remember who we were sitting with at the speaker dinner, but it was. It was awesome, and it's just like, oh wow, you know these ideas. Yeah, I'd love to see something like that. Angular just fully and fully adopted signals, and they're doing it in a way to where they're basically encouraging people to have a hard look at how they're using our XJS, which is how they did it. Okay, interesting, Where can you use signals because it'll be faster and you know, more efficient and solve a whole bunch of these things. Right So anyway, Yeah, so it sounds like signals is the way to go, which I guess you could also say is like pubsub right, like you're getting a signal from the service. Yeah cool. Yeah, well so yeah, I think to Valentino's point, if we could and I say we, I mean the JavaScript or the Ruby community. If we could get like a compelling sort of answer to react that lets you write components and Ruby as a data binding story is efficient and and I think one thing also before I know, we're getting close to an hour here, one thing I also wanted to mention is like a lot of JavaScript frameworks, right, the idea is that you render the component on the client, and a lot of jobscript frameworks are now thinking like, okay, well wait a minute, we probably should also render on the server because the server, you know, we can control that environment. It's going to be very fast, it can optimize it, I can have more memory if you want to. Can't do that with browsers. So it'd be cool if we could like paint something on the screen faster than our jobscript bundle loads. So let's do service side rendering, and which always made me laugh because it's just like, you know, that's how the web used to work. Everything was service surrendered, right, But I think if we do this in Ruby, right, you sort of automatically get service side rendering without so it's like the opposite way of looking at it. It's like I want service side rendering, and I already have that. Now I want client side versus the other one, which is like I have client server, so because we're already good at that, like because Ruby rails already good at that, we sort of already have service side renderings, so we're like almost already ahead of the curve in that regard, right. Cool. I'm really interested to see how the AI hand reaches in here too, write, like, because if we have like all of these like components like driven things, right, like, we could just say, like you know, hey, like create a bunch of components for this data and like do that, Like that would be awesome. That would be super cool. Yeah, like give me, give me a to do list component right now, just exactly. Yeah. Yeah, we should also try to work crypto in somehow, right, because that's there we go. Every component could be bought as an NFT too, there we go. Well, I really do like the idea if there was some way to translate my view
components and rails up into a component in in the front end, right, but without having to do the work. I don't want to write it twice, so I don't know, yeah exactly, which is really what you have to do. Yes, So I just posted in the comments again and by the way, the comments go out to twitch, YouTube and Facebook. But we did an interview last year right when Signals were hitting, and not a lot has really changed. I mean the adoption and some of the implementations changed, but the idea is still the same. We talked to Tageous Kumar about signals, and so if you want to look into that, he explains pretty deeply how that all goes. I was I wish we had done it with Ryan Carneatto, but we just didn't. So, m yeah, I mean talking about other things. We're talking about things that like we sort of have decided are good, like components, reactivity, but also signals. I feel like signals are also one of those things sort of like all the major frameworks, they are all adopting them, and it solves a lot of issues that you know, kind of came up and Okay, how do I keep track of state from this to this to this to this? Yep, so totally totally all right, Well I'm going to push this toward picks. We've been talking for an hour. It's been great, and I would love to just kind of see I almost want to just say, hey, let's just do this every six months and just see where we're at. But yeah, anyway, uh yeah, let's go ahead, do Pis Valentino, Do you have some picks for us? Sure? You have been following along a little bit on the Twitter of Ruby Kagi. It's always great to see all the brilliant talks that come out of that. I didn't attend anything virtual. I don't know if they had anything virtual, but uh, I just like seeing all the presentations and projects getting worked one. It's pretty fantastic. Uh, excellent. I got a little I bought the rabbit R one and it came in the mail. Uh. And I've been I've been using a all fully local wearable AI from the project. It's been really fun. So I want to compare and contrast and see maybe what you know one advantage is over the other and digging into the AI. I also I've been reading through Obi fernandez new book The Patterns of Application Development using AI, and just some super fantastic like abstractions and ways to use AI in the Ruby context and build apps. It's like it's it's a really remarkable book, so highly recommend it. Awesome. I didn't even know he had a new book, so I feel we should get him on and have him just explain it all to us. I'm gonna throw out a couple of picks. One pick that I have. I always do a board game pick, so I'm going to pick up. It's actually a card game that's called Hanabi, and it's it's a fast, easy game, and effectively, what it is is you have a set of fireworks and there are five colors of fireworks, and what you do is you deal out four cards to each player. And I guess Hanabi is the word for fireworks and Japanese. Anyway, it's a cooperative game, and I'm not always keen on cooperative games because what happens is you'll have quarterbacking, where you know somebody basically is just telling you what to do. So if you play Pandemic with my wife, I shouldn't. She doesn't listen to the show, but she does a lot of quarterbacking. In fact, there's another game that we play called Castle Panic, and I don't enjoy playing it with her because I don't get to play. I just watch her play my turn. So anyway, that said, Hanabi is a little bit different. And you know, in all these games, you can overrule, right if it's your turn, you can overrule them. And so sometimes I'll say, I think this is a better idea, but Hanabi's different. So what you do is you deal out the cards and then you hold the cards up face everybody else, so you don't know what cards are in your hand. And then what you do is you're trying to get the colors to go from one to five. And there are three ones, two twos, two threes, two fours and one to five. And so what happens is is you can discard a card out of your hand, you can play a card out of your hand, or you can give a clue to somebody else if you have enough time tokens. And so you play a time token and you say these are both twos, or this is a white card or right or whatever. And you can only clue numbers or colors, and if you clue a number or a color, you have to tell them what all of the cards are in their hand of that kind. And so you're trying to give them clues that will get them to play the ones and then the twos and then the threes. But everybody's piles, right, And so the other thing is is if you play a card that's already been played, right, then it's a bad play, and there's a fuse there. Three. You have three parts of the fuse, and once they're gone, you explode and you lose. So the other way to lose is right if you discard both numbers or all the numbers of a specific color and number. Right, So if you discard any of your fives, you lose because you can't win, you know. And so anyway, so me and my friends we played it like three or four rounds last night. We played some other games too, but this is one of my favorites. It's it's fun, it's hard, it's fricking hard, right, because sometimes they'll say these are both white, or they'll say this is a four, and you're like, okay, are you telling me that I can get rid of it? Right? Because when you discard a card, you get your you get the time tokens back from giving a clue if you play it, you know. But if you play a card and it's wrong or you get ridy, you know, get rid of a card you need, right, And so it's do I Are you telling me to keep it? Are you telling me to get rid of it? Are you telling me to you know, hold on to it, or you're just trying to help me know that I have it right for the future. And so anyway, it's it's way way fun. So I'm gonna pick Hanabby, super super simple game. I'll list I'll put the board game Geek list up, and then I'll put an Amazon affiliate linkup. Board Game Geek waits it at one point six 't nine, which means that if you're a casual
gamer, this is right up your alley. It's it's so fun. So anyway, I'm going to pick that. I went on way too long about that game. As far as other picks go, there's a challenge that I want to join next week. So one of my favorite books is Thinking Grow Rich by Napoleon Hill, And there's a market marketing guy named Russell Brunson who is putting together a three day challenge based on the book. And and I don't have the link right off the bat, but I will put it up in the show notes so you can join it. That will probably also be of an affiliate link. I think I have an affiliate link for that. It's free. It's a free challenge, so I only get paid if you buy something after you sign up for it, so and even then it doesn't cost you anything extra. I just get a cut of the action. So anyway, I'm super excited about that. And then yeah, go sign up for Ruby Geniuses. It's rubygeniuses dot com. We're gonna be doing weekly calls talking about Ruby. I'm hoping to get brilliant people to come join. But you know, I'm playing with this stuff all the time, so I'll probably be doing some of the presentations about how I'm deploying or doing front end or whatever. So definitely check that out as well. And yeah, those are my picks, Cameron, what are your picks? Let's see. My first pick is going to be the Prism parser, and I know that it's been talked about a lot on various podcasts. Kevin Newton did that. I think he did do a talk on it at Ruby komp in November last year. But yeah, Prism is amazing. It's and if you haven't heard of it before, it's a new parser written and see that he and a couple of other people at Chopify I've been working on. The Idea is that it's going to replace all the other myriad of parsers that exist out there for Ruby, like the white Quark one, and I think Seattle rb Ryan Davis has one also, the idea of it being's going to replace those and eventually it'll also replaced the c Ruby parser. I think it already has at least it's there. I don't know if it's actually being used. I think you can switch it on, but it's available. The cool thing about it is that there's also WASM bindings for it. So that's what my little Ruby implementation is using, is it's using this the Prism dot WASM and he's got typescript types for it. I think mostly for Opal because was gonna use it too. But I mean I just found it to be because what I was doing before before that project came out, what what what what Garnett would do is it would it would like compile the Ruby code into an instruction sequence like on the server and then ship like a Jason file that it would then you know, read the instructions from. And now it doesn't have to do that. It can do all that in the browser, just all the parsing and everything in the browser now via prism dot wasm. So huge like shout, he just made like that I would. I think it's not like an exaggeration to say that Kevin like made Garnet possible, right, And he's also been getting sort of lots of accolades from other people who work on you know, Ruby implementations like Truble Ruby and ja Ruby and all the other ones that that Needa parser, so that's really cool. I also really appreciate just how much time he dedicated to helping me figure that out during the Rails or the Ruby comp hack day. So one of the things that happened that was different from how Ruby comp normally runs is that they had a hack day. At the beginning of the first day of the conference was a hacked day. There weren't any talks, and he would just go into a room and meet these luminaries in the Ruby community and talk to them. So I got to talk to him, I got to talk to Amir Rejean who does Dragon Ruby. That was super fun. So I guess my pike is Prism. Maybe the second pick is Rails Camp or Ruby Compact Day, and then I think my my third pick it is gonna be sin City Ruby, which is Jason Swetz. Conference was really fun, just great to get out go to the Vegas, have a good time in Vegas, and you know, see some cool talks. Obi Fernandez was there actually talking about AI and Ruby. That was super interesting too. So yeah, I think that that summed it up. Awesome. So, Cameron, if people want to check in with you, if they have questions or anything, where do they find you. Yeah, I have a website, camerondeuture dot com. I don't post their that much, just a blog. I'm also on mas it, on Cameratron at web dot social, and I'm on X two although I use X very much, at Cameratron, gethub dot com, Cameraton, I'm basically Cameratron everywhere on the internet. Awesome. All right, well we're gonna go ahead and wrap it up. Thanks for coming, Cameron. This is awesome. Thank you all right, next, thank us? Yeah, absolutely, thanks guys,