Rails, Development, and More with David Heinemeier Hansson [audio]
player.fmAs a Turbolinks fan, I couldn't be more excited about Stimulus. Sounds like it completes the front-end development story with Rails-like simplicity minus requiring that you know Ruby and Rails.
I started off as a FE dev working on mostly Rails projects. Not knowing Ruby or Rails, I depended on others for updating controllers, debugging Rails errors, etc. I was also commonly frustrated when my teams treated the client as a second-class citizen for no apparent reason besides an aversion to JavaScript. JS' takeoff in the market was actually quite satisfying at first, but the more I worked with Angular, React & company, the more I missed the productivity of server-rendered JS responses, jQuery, and Turbolinks. I doubt Turbolinks + Stimulus wins prom king at JavaScript High next year, and I couldn't care less.
Also, Redux as "self-congratulatory" had me dead. XD
I'm a fan of Turbolinks too (started using it on its day 1 release), but nowdays you don't even need Rails to use it effectively. It integrates with any framework very easily.
Stimulus is a new upcoming framework for sprinkling in bits and pieces of JS. DHH talked about it on https://twitter.com/dhh/status/946184709528158208.
Yup - love using it for static sites!
For things like auth/signup/forgotten-password flow I'd agree I've been more productive with server-side frameworks than client-side, and the out-of-the-box solutions for those things from Rails/Django feel more solid.
Also basic blog and structured content 'pages' sites.
For building anything that requires complex client-side interaction, i.e. the sort of things that even warrant looking at React (e.g. a calendar app, or a music player app), then you're going to get yourself in a real mess attempting that with 'javascript sprinkles'.
> Also, Redux as "self-congratulatory" had me dead. XD
Also completely wrong if you've ever read/heard anything Dan Abramov has ever written/said [1].
[1] https://medium.com/@dan_abramov/you-might-not-need-redux-be4...
I believe Abramov was the first to say, “You might not need Redux.” What prompted that?
Yes! Perfect example, added to my comment :)
What does stimulus do?
Its something they've been developing internally at Basecamp. DHH sees Turbolinks handling "90%" of front end work related to full page changes. Stimulus (which I think he said they're releasing in another month) will handle on page interaction or as he calls it "Javascript sprinkles". Things like modifying existing elements, adding a new node to the DOM, filtering, etc.
A bit like what Drab does for Elixir/Phoenix perhaps?
I'm far from an authority to officially say, but this is what I gathered from listening to the podcast:
Stimulus essentially structures DOM manipulation. Whereas other frameworks aim to solve rendering, it seems Stimulus will offer a lo-fi and sane way of making your views dynamic. Restated, it's a framework for managing JS sprinkles aka jQuery spaghetti aka templating logic. I don't think its a component library because DHH explicitly mentioned its not a mechanism designed for handling JSON and similar concerns. It targets the realm of updating element classes and attributes, handling events, etc. It'll also allow you to partially update views with HTML templates sent over the wire.
When combined with Turbolinks, it should elegantly solve all your everyday front-end concerns. There's a lot of helpful context I'm neglecting - check out the podcast, DHH pretty much opens with this topic.
I had the same question :-)
Maybe a typo? A search for 'ruby rails stimulus' brought me right back to the root comment. About to listen to the podcast. Will report back if I learn anything.
This was a teaser - it's not out yet.
Thanks for clarifying. That was my takeaway as well.
Interesting to see Rails simultaneously embracing React with the Webpacker gem while also trying to offer a better solution in Turbolinks + Stimulus.
DHH's complaints here about React (and Redux especially) resonate with me, but I have a hard time believing a React-less approach is the best solution. I'd rather Rails roll its own enhancement of Redux - and perhaps CSS management - alongside a handful of component generators that make everything from "Javascript sprinkles" to SPAs easier to manage in Rails.
Webpacker is not about React, but about using a modern asset bundler (Webpack) and ease modern JS development for Rails users (Babel, …). There is a generator to easily setup React, Vue and some major JS frameworks, but those are very basic and optional.
Love that he's bringing attention to CO2 build up & air quality in offices. I can't stand those modern "energy efficient" buildings with no open windows.
I was really surprised to see how expensive co2 monitors are (about $110 USD).
It seems wrong at a moral level. Especially since smoke detectors and carbon monoxide monitors can be bought for $10-25.
I know nothing about making a co2 monitor but other than marketing hype, the willingness to function at optimum efficiency and not die of oxygen deprivation, is there anything about it at the hardware level that warrants it being 10x the price of other sensors?
Economies of scale, most likely. Every home must have one or more smoke detectors. How many people order a CO2 sensor? Maybe 1 in 1,000?
Yeah, I feel like there should be an affordable air quality monitor (with an accompanying app) that you can just slap on walls...
There is. The Laser Egg 2.