Programming is most interesting and challenging when "Best Practices" are in conflict. Working to understand fundamentals & approaching problems with first principle thinking will help you stay relevant in a world where AI can outperform everyone with "Best Practice" techniques.
When I discovered Ruby and Rails, it was literally a 10x boost to my productivity. Nothing... and I mean NOTHING has come close to matching it. It's baffling to me that the industry doesn't hold new tech to this standard. It's why I continue to bet on Ruby and Rails.
Devs: We moved away from Ruby. It's a dying language... and it has scalability problems.
Also devs: Let's host our projects on GitHub, use Stripe as our payment processor, crowdfund with Kickstarter, and livestream on Twitch.
I've been helping my daughter with her JavaScript/React bootcamp, and my God... we forget how much we take for granted in the Ruby/Rails world. If you work professionally in Ruby, take a moment today and thank your lucky stars.
Here's what my Gemfile structure looks like these days. It's designed to make upgrading Rails less painful in the future, but it's also very clean. I love it.
Last weekend I helped a young programmer add a boolean toggle/checkbox to a React form in a large app. It took us 3.5+ hours of discovery and updates to 7 files to get things working. Something that would have been a 10 min change to a single file in a typical Rails app. 🙃
The same is true of most of the "modern" tech that's hyped today. Ruby and Rails still runs circles around most of it. The trick is to embrace the framework instead of fighting it.
I remember being reprimanded by the consulting firm I worked at because I was finishing projects in 2 weeks that had been scheduled for 6+ months... since I proposed Rails over of C#, Java, etc. I was told the sales cycle was too long for me to be finishing projects that quickly.
I’m excited to announce the new game changing Universal ID Ruby GEM. 🚀 It allows you to recursively serialize any Ruby object into a small URL-safe string (including Arrays, Hahes, ActiveRecords… with Associations, even ActiveRecord::Relations).
ActiveJob is the only service layer your Rails app needs. Some folks seem to get tripped up on this paradigm shift, so I created a simple "service" job to help illustrate.
Rails has a great built in mechanic for service objects & similar patterns. It’s called ActiveJob. You can use jobs to encapsulate all sorts of business logic that doesn’t belong in the model or controller. They’re composable & testable & can be called sync or async as needed.
Rails has a great built in mechanic for service objects & similar patterns. It’s called ActiveJob. You can use jobs to encapsulate all sorts of business logic that doesn’t belong in the model or controller. They’re composable & testable & can be called sync or async as needed.
Would anyone be interested if I productized and open sourced my Docker development setup for Rails? I try to match production deployment locally to help teammates grok infrastructure. It includes commands for bringing complete environments up/down, running one off commands, etc..
We've gone
#NoBuild
on the CSS with . 21 individual CSS files, all fetch concurrently over http/2. No transpiling, no bundling, no need. Just raw HTML and CSS, deployed with Kamal/Skiff. You don't need a build pipeline to work with the web ✌️
Ruby is one of the few programming languages that’s expressive enough to support writing code at pretty much the same speed as thought. It often just flows out like prose. ❤️💎
"It's like I'm a caveman finding fire for the first time." -My nephew who's been learning to program (mostly JavaScript and SQL) for over a year... after trying Ruby and Rails for the first time recently.
I'd like to make it explicitly clear how excited I am for Hotwire's evolution. When I started CableReady and StimulusReflex over 6 years ago, my hope was to see our ideas and techniques folded into Rails. We've learned a lot of lessons over the years and have some battle scars
It's difficult to overstate how well
@heroku
nailed the space of commoditizing devops. You’ll pay a premium for it, but it’s actually very affordable when you consider that time is more valuable.
I just created a tiny Rails app that anyone can clone & run locally to learn about StimulusReflex. It should lower the barrier to entry for folks just getting started or tinkering. Would love to hear feedback & am happy to accept PRs.
To make amends,
@digitalocean
donated $5,000 to an open source project of my choice. I chose Stimulus Reflex,
@hopsoft
and team have done an amazing job. What a classy move DO, thanks!
What are folks considering as a legit Heroku alternative? I'm not looking for bespoke K8 solutions. I want a service that treats devops as a commodity so I don't have to think about it.
-
-
-
What else?
Experiencing weirdness with a Rails app during local development? Remember that caches are the enemy.
- export DISABLE_SPRING=true
- bin/rails assets:clobber
- rm -rf tmp
"Reactive Rails means an order of magnitude less lines of code, & an order of magnitude more productivity... adding StimulusReflex & ViewComponent to Rails changes everything... I can’t overstate the magnitude of how much developer effort this saves!"
If you properly design the Rails' ActiveRecord model layer (relationships, scopes, etc...) so many things in your application will become much simpler.
Universal ID can create a deep true-copy of an ActiveRecord including it's associations to help you create a new unrelated set of "identical" records (minus db keys, timestamps, etc). Here's a benchmark showing a copy of 100k db records in < 26 seconds. Note that I'm still
I still marvel at the elegance of Stimulus JS. It's such a well designed library. It's conceptually simple, easy to use, and provides all the power you need while staying out of your way.
The role of senior engineers is to build architectural solutions that enable less experienced teammates to have an outsized impact. In a way, seniors should be constantly working themselves out of a job. In many ways... this is the job.
This is why we’re starting to see more folks adopting tech stacks, like Rails, again that emphasize productivity. I’m optimistic and looking forward to the return of sanity in the industry, with a focus on revenue over growth… and with highly productive small teams. I sense a
Who knew that Ruby conferences could be so impactful and inspiring? So many great people, incredible speakers, and wonderful new friendships. First, Sin City Ruby, then RailsSaaS, next RubyConf and RubyConf Mini, …
Microservices do nothing to reduce complexity. The hoped-for modularity improvements are not guaranteed, the performance and reliability costs are significant, failures become much harder to diagnose, and they introduce significant accidental complexity.
An Inconvenient Truth: A story of "No Build" featuring import maps and HTTP/2(3).
---
"This is a wake-up call that cuts through myths and misconceptions..." 😜
---
Loving all the dunk replies and retweets claiming it's impossible... after they've done it and are running it in
"The state of the art is no longer in finding more sophisticated ways to build JavaScript or CSS. It's not to build at all. To lean on HTTP/2 and the now universal support for import maps to avoid bundling."
In a capital-constrained startup environment, engineering efficiency is vital. Tools like Hotwire, CableReady, and StimulusReflex can reduce the code required to build rich user experiences by 5x or more. Less code means your team will ship features faster and with fewer people.
It looks like JSONAPI::Serializer is around 50x faster than ActiveModel::Serializer. Also, it ensures your API is JSON API compliant rather than some bespoke custom variant.
The “dunks” on this post are incredibly reminiscent of the FUD spread about Ruby and Rails in the early days. People losing their minds over tools while others just ship value to customers while making money... and having fun in process. 🤷♂️
Gotta love the pivot from "it doesn't scale" to "you can't write real systems without types" as the new ding-dong argument against dynamically-typed languages like Ruby (and vanilla JavaScript and Smalltalk and...).
How many of y'all knew it's possible to use ActiveRecord to configure an in-memory SQLite database, define and create a table (migrate), and seed it with data in just 3 lines of Ruby?
Always opt for less infrastructure whenever possible. Fewer moving parts == less complexity, lower hosting costs, lower maintenance costs, and fewer bugs.
The role of principal, staff, and senior engineers is to create tools and establish patterns that enable other less experienced engineers to be highly productive. Then mentor them so they can be.
The sad thing about JavaScript build tooling is that you feel smart and accomplished whenever you succeed at getting things to work, but in reality you haven’t actually accomplished anything.
Rails models don’t always need to map to database tables. Using models to map the business domain should be common practice. This can help identify some of the REST resources your app should expose, but resources don’t always need to map directly to models either.
I prefer defaulting to double quoted strings when linting/formatting Ruby. It seems I'm in good company with GitHub, Thoughtbot, Test Double, et al. on this... even though the Rubocop style guide defaults to single quotes. What's your preference?
One of the most exciting things in web dev right now is HTML over the wire (via both HTTP & web socket) coupled with multi-region geo aware infrastructure. The geo tooling isn't quite there yet, but it will mark a sea change in how web apps are built & deployed in the future.
This is how I’m starting to organize the Gemfile in my Rails projects. It’s an attempt to be more mindful of additional dependencies with the hope of easing the Rails upgrade path in the future.
Very excited about the projects I've been working on. Some great new tooling for Rails developers is coming together and shaping up. Most of it is foundational at this point. It will provide plenty of opportunity to build even better UX and DX on top of it.
I’ve been learning Hotwire/Turbo and must admit that I’m impressed. I love that Rails has so many options for building reactive user experiences without forcing complexity on the developer. HTML over the wire FTW. 🙌
Last night I upgraded one of my StimulusReflex projects to Rails 7 and esbuild. It feels like I just stepped into the future. It's simple and fast as hell. 🔥
We're going to make Rails 8 the damn best framework for creating full-stack PWAs. Web Push, badges, install prompts, service workers, the works. I was motivated before, but now it's really on. Let's get back to making apps where we don't have to beg for permission or mercy!
Here's a quick intro to some of the new libs I've been working on. Still early days with this, but I'm just too excited not to share with y'all. Lots of cool stuff to unpack here. Let me know what you think.
Here's what my Gemfile structure looks like these days. It's designed to make upgrading Rails less painful in the future, but it's also very clean. I love it.
I'm almost done extracting the first set of reusable TurboReflex behaviors (with state management) into a new UI/UX focused lib. I expect this is the start of something that will prove to be pretty terrific for Rails developers.
SQLite with LiteFS and Write Forwarding is a game changer. The way we build and deploy highly performant reactive SSR apps is going to change. I just wish that SQLite had support for array and json datatypes.
Every additional gem dependency adds friction to upgrading Rails. Be sure to apply a healthy dose of scrutiny to all gems before including them in your projects.
Did you know that you can use `sidekiq_options` with ActiveJob on Rails >= 6.0.1 and Sidekiq >= 6.0.1? 🤯 Gone are the days of giving up ActiveJob's beautiful API and abstractions in order to use advanced Sidekiq worker features. 🎉
We handle roughly 400M visits/mo between our 2 flagship products (both built with Rails) which puts us in the top 25 most visited websites in the world according to Semrush.
@dhh
We're building ClickFunnels with Rails and Bullet Train... and we love it. We also have parts that aren't Rails and even use TypeScript 😱 in some places where it makes sense or the team prefers it. I'm just glad I get to spend my days mostly in Ruby.
Had a major breakthrough today with optimistic UI updates for "ephemeral state" management using the TurboReflex library for Rails. I believe it will be a leap forward for SSR driven reactivity across multiple stacks and I'm excited to start producing content around this stuff.
@coderberry
@pinzonjulian
To further clarify... the omission of the db enforced FK constraints allows you to parallelize data modifications. It also makes general scriptability of the db much simpler. It does comes with tradeoffs (data integrity risks), but it's totally worth it at a certain scale.
If you’re too lazy to setup ActiveJobs in your Rails app, pull in the hopsoft/bg GEM to add behavior similar to Goroutines or Elixir processes. It allows you to run model methods in the background.
Universal ID is such a powerful low level tool for Rubyists, it can be challenging to think through all the ways you might leverage it... so I added a few more use cases to help you get started.
@JamesClear
This is spot on. Unfortunately authoritarian and opportunistic management often squashes level 2-3 efforts from ICs... which is generally the root cause of burnout.
“I recently wrote a chat application that is fast, responsive, and was simple to build while leveraging StimulusReflex. I also wrote a total of 24 lines of JavaScript - you can't beat that.”
"...with this new way of thinking about and building Rails apps, I suddenly found myself single-handedly launching features again. ...Developing an app feels fun again."
@dhh
We're building ClickFunnels with Rails and Bullet Train... and we love it. We also have parts that aren't Rails and even use TypeScript 😱 in some places where it makes sense or the team prefers it. I'm just glad I get to spend my days mostly in Ruby.
It’s fun to watch the cognitive dissonance starting to surface from people just discovering that HTML over the wire techniques can produce great modern web experiences.