Welcome to 2023 â weâre kicking off the year talking to Justin Searls about the state of web development and why he just might write a âYou Might Not Need Reactâ post. Heâs been so productive using Turbo and Stimulus (and tailwind) in Rails 7 that we had to talk about the state of Rails development today and a bunch of other fun topics around building for the web in 2023.
Justin Searls: I think thereâs a couple worthwhile reactions. One is, when we say multiclient, weâre mostly talking about phone apps. And the industry has changed quite a lot since the app stores were new, where to build any application at all would have required not only an API talking to native Objective-C code, or Java, and Android land⌠But it would have to really sip the data, because the computing constraints were so narrow. And now weâre in this other world where, if anything, with tools like React Native, and with the advent of much more mature UI frameworks for those different clients, Iâm not as concerned as I used to be about that exact question. It was something I worried a lot about in 2014, when I was thinking about when you need an iPhone app, because everyone was like building those, and now what it is is âOh, it turns out that we can actually run pretty far afield with just responsive web design and a mobile website.â And if you need an application â nowadays when I talk to clients or prospective clients for Test Double, itâs almost always not that âI need my entire gigantic website of 800 controllers and every single thing that you could possibly do through the webâ, itâs âI have a very specific use case, where these people who are doing site inspections need to check for these particular things, and they need to be able to scan barcodes really quickly, and they need to be able to do this or that.â And so the scope of functionality thatâs needed by mobile applications tends to be much narrower, and it tends to come much later in the lifecycle of applications than it did 10 years ago.
And you asked me a bit ago, like âI seem to be coding a lot. why is that?â One big reason is Iâm not a believer in progress. Iâm not a believer that this industry is getting better over time, and like innovation is happening⌠Because when youâre outside tech, everyoneâs like âOh, look, weâre getting smarter and hotter all the time. And all these new technologies are coming out. Itâs great!â I honestly feel like in many ways the industry has regressed since Iâve joined it. And itâs worth thinking about, when we ask questions like this one, of - that may be what Tom shared is completely conceptually true, but I think the industry has changed where now the likelihood that youâre going to need to build both a web client and two native mobile applications, and maybe some third client, on day one, or near day one, with full-fledged functionality - even as I say that, I struggle to even think of like how often Iâve seen that in recent years.
And so I would instead say - if somebody had that consternation or that frustration, I would say, âWell, if youâve got a small team, and theyâre careful, and theyâre expertsâŚâ For example, when I do a Rails application in this way, the controller is kind of the controller, in terms of my search feature is going to take a query string from users, and then itâs going to go and figure out what are the results, and then itâs going to call stuff that does all that hard work for me, and then the last little line is just going to like render a template from that piece of data⌠And I could just as easily respond to a JSON format, or header, and just convert that to JSON and have like a quick presenter just do that. And in well-factored Rails applications - well, yes, building the whole separate API as a bunch of separate endpoints really never works, because you end up with two code paths doing the same thingâŚ
[40:10] If youâre really careful about being rigorous in how we structure the data that flows into the templates, that data - the controller and the route is asking the same question. The inputs are the same arguments, that might modify the answer⌠And then the answer is factored in a way thatâs like - itâs the same answer, itâs just different shapes to present it to the client.
So Iâve had really good luck of doing exactly what youâve struggled with, and Iâve seen a lot of teams struggle with, of just âOkay, cool, well this particular set of routes needs an API response now, so be able to respond to JSON requests, as well as to web requests.â In fact Turbo, which Iâve been talking about, has a Turbo stream feature, where those action cable little partial page snippets are also just another kind of request, right? It just goes through the same templating, itâs just that it knows itâs only a document fragment, instead of the whole document.
So thatâs, I think, more functional than going out whole hog on day one and saying âYou know what - we just need a fullÂ-fledged API.â Itâs just like saying âWe need microservices on day oneâ, or something like that, âbecause weâre afraid that in the future weâre gonna have more complexity.â