4 ms·
Backend devs doing "just simple rails views" only works when those views are really simple, and mostly for internal tools. Otherwise it becomes a total nightmar
by 0xblinq 3y ago
Backend devs doing "just simple rails views" only works when those views are really simple, and mostly for internal tools. Otherwise it becomes a total nightmare to maintain.
I agree the "popular" JavaScript solutions are a complexity, over engineering and maintenance nightmare (I'm talking about Next.js mostly here).
But if you use somethink like Inertia, which TL;DR basically just makes React (or Vue) a templating library for your backend framework, it becomes super simple and easy to maintain. I find Inertia great because it's the perfect bridge that can make both backend and frontend devs happy, as it gives you the best of both worlds.
Hotwire is great, but you do need to invest into its way of doing things, and believe me... backend devs who hate on JS doing frontends leads to disaster in the same way JS devs hating on PHP/Ruby/Etc doing backend also leads to disaster.
Last year we replaced Hotwire in a medium size Rails app with Inertia because even if it was quite fast to build new features with, it became a total nightmare to maintain. Simple things such as a modal were split in 4 or 5 different files... some logic was in controllers, other in templates, then the stimulus controller for this and that, and the frames, and... nobody knew what to change.
The problem with Hotwire is that you need to be super "creative" with your solutions and take decisions like should I use a stimulus controller, a frame, a stream? or what? at every single step, and a single functionality ends up split in multiple different places. While with React or Vue it would be just a single component with an isOpen=true/false and done.
I insist... if you look at the "modern frontend" situation thinking on Next.js, Redux, css-in-js, etc... yes... it's a f*ng over engineering marketing hype bullshit hell.
But React/Vue on their own do provide some real benefits and real solutions to actual problems.
I think inertia brings to backend frameworks all the benefits of these tools, with minimal (and worth it, in my opinion) trade offs.
If you end up using Hotwire, just be careful and be warned... it's very likely to become a mess sooner, especially if used by JS haters.
- x0x0 3y agofwiw, I disagree with your take on Hotwire: that's really all of Rails. Rails is built for expert users and you simply must be disciplined about how you build it or you will regret it; I don't think that's unique to Hotwire at all. I'm commenting to thank you for sharing Inertia though. Very interesting approach; I'm going to do some reading of the code. For everyone reading this, if you're curious, start here: https://inertiajs.com/how-it-works https://inertiajs.com/how-it-works
- 0xblinq 3y agoI think you're actually agreeing with me :-). Just extending my take to all of Rails, which I think it makes sense too. Yeah, Inertia is great. We're supper happy with it. It simplified a lot of things and makes us feel we're building something robust and maintainable.
- x0x0 3y agoApologies, my only disagreement was that it was Hotwire that requires care when I really think it's the entirety of Rails. Thanks again for the suggestion on intertia.js !