Live data from Hacker News

StimulusReflex, or LiveView for Rails

docs.stimulusreflex.com

81–90 of 93 posts

Re: StimulusReflex, or LiveView for Rails

#81

Does python have anything like this?

More of a port of Laravel's Livewire (so only AJAX calls, no websockets), but I've been working on something similar for Django at https://www.django-unicorn.com/. I also detail other options at https://www.django-unicorn.com/docs/#related-projects.

Re: StimulusReflex, or LiveView for Rails

#82
> This entire round-trip allows us to update the UI in 20-30ms without flicker or expensive page loads.

A lot of people have much worse ping times than that. Try using this on a satellite connection for example, and your experience won't be very pleasant.

On my internet connection, which is pretty average by polish standards, the best ping I can get is 30ms, and that only happens when the server I ping is just one or two hops away. I probably won't be able to go under 100ms when the server is in the US.

It seems like this approach sacrifices runtime performance for development speed. I feel like it might often be a good tradeoff to make, but it's a tradeoff nevertheless, and we should recognize that. Separate layers for frontend and backend introduce complexity, but client side code is client side code, you can't go much faster than that.

Re: StimulusReflex, or LiveView for Rails

#83

Wish I had the time to really study Phoenix's LiveView and implement the same in Java. AFAIK there's no equivalent for this in Java and I mean the same not kinda-the-same but not really like Vaadin or God forbid GWT.

Good luck. Liveview depends strongly on features of the erlang VM that you won't get right without a deeper understanding of erlang (how do you clean up a websocket connection when the actor exits early, say due to throwing an exception - that's zero lines of code in lv), you're probably better of taking inspiration and writing it from scratch.

So in your opinion in Java land resources are always leaked when some exception occurs? That’s a bit far from the truth

Re: StimulusReflex, or LiveView for Rails

#84

I hope their form validation demo is just a toy and not an actual example of real email validation code, because it doesn't handle '+' in the localpart, which is a very commonly used character. I don't see any custom validation code in the demo source, though, so it kind of looks like they have a builtin "email" validator that's broken, which makes me question the production-readiness of this thing.

That was a regression in version 3.4, fixed here: https://github.com/hopsoft/stimulus_reflex/pull/418

Re: StimulusReflex, or LiveView for Rails

#85
As someone who has barely done any web development in his life but having a fairly interactive side project in mind I wanted to work on, is Rails and StimulusReflex a solid thing to start out with right now, or would you recommend just going with React, Vue and so on? Navigating all those frameworks seems very complex.

Re: StimulusReflex, or LiveView for Rails

#86

As someone who has barely done any web development in his life but having a fairly interactive side project in mind I wanted to work on, is Rails and StimulusReflex a solid thing to start out with right now, or would you recommend just going with React, Vue and so on? Navigating all those frameworks seems very complex.

Rails is great!

Re: StimulusReflex, or LiveView for Rails

#87
In my experience, the latency is just too great on 3G or 4G with congestion.

It's 500ms to 1000ms for something that ought to be instantaneous like clicking on a tab that I have already seen.

React websites might be a larger initial download, but its only an extra 3 seconds wait to begin with, then near instant reactivity afterwards for everything that doesn't require a network call.

Ironically, the browser cache is much faster than 500ms so the tab demo would have been faster if implemented as a full page refresh.

Re: StimulusReflex, or LiveView for Rails

#88

A tiny payload from the world's slowest backend framework. The Rails community has spent years resisting the future. Ember was an attempt to jam Rails into JavaScript and it's been a miserable, confusing, slow mess that every team utterly regrets. Rails has spent years and years pushing server-side rendered partials. Now the Rails community has yet another "new" approach that involves writing yet more Ruby instead of…

Imagine that there are companies (like the one I work for) and projects that are absolutely NOT going to scale (maybe because they're somebody else's internal apps, which is what I do) and the company behind them will not have trouble hiring JS developers, because they're a Ruby shop.

So they like writing more Ruby instead of JavaScript. They've enjoyed Rails pushing server-side rendered partials.

And the person that comes demanding they rewrite all their frontend in the current JS framework-du-jour (possibly to be rewritten again in a couple of years) will be told to fuck right off.

Re: StimulusReflex, or LiveView for Rails

#89

Earlier quoted context omitted.

Good luck. Liveview depends strongly on features of the erlang VM that you won't get right without a deeper understanding of erlang (how do you clean up a websocket connection when the actor exits early, say due to throwing an exception - that's zero lines of code in lv), you're probably better of taking inspiration and writing it from scratch.

So in your opinion in Java land resources are always leaked when some exception occurs? That’s a bit far from the truth

No, I think the point was that you would have be aware of these types of cases - and cleaning up after exceptions isn't the only one - and deal with it in your code. Maybe it's trivial to do in Java, but still it has to be done.

Whereas with Elixir, it's handled by the way failed processes are handled which is to just "let it die". Another one will come along and replace it. (I'm greatly simplifying here)

Re: StimulusReflex, or LiveView for Rails

#90

A tiny payload from the world's slowest backend framework. The Rails community has spent years resisting the future. Ember was an attempt to jam Rails into JavaScript and it's been a miserable, confusing, slow mess that every team utterly regrets. Rails has spent years and years pushing server-side rendered partials. Now the Rails community has yet another "new" approach that involves writing yet more Ruby instead of…

Imagine that there are companies (like the one I work for) and projects that are absolutely NOT going to scale (maybe because they're somebody else's internal apps, which is what I do) and the company behind them will not have trouble hiring JS developers, because they're a Ruby shop. So they like writing more Ruby instead of JavaScript. They've enjoyed Rails pushing server-side rendered partials. And the person that…

You've just described my company! I struggled through rewrites of JS from jQuery -> Backbone -> Vue -> Webpacker + Vue until the "head of IT" went off to do marketing where he was better suited. Now that I have the reigns, we've been slowly removing as much JS as makes sense and we've never been happier, more productive and relatively bug-free.

But we still have the requirement of "near instant" front-end for certain things. And this is precisely the sort of thing that a team of RoR devs can really get behind and do well. Rather than try and cram yet another JS paradigm and DSL into their heads only to be forgotten when the next one rolls into town.

Personally I'm a Phoenix/LiveView champion, but we're a Rails shop and I know better than attempt The Big Rewrite. So this really fits the bill.

Post reply on HN