When you say “I’m going to reverse-engineer a binary file format,” people picture C, or Python with struct , or Kaitai. Nobody pictures Ruby. Ruby is for web apps and DSLs and being pleasant; it is not, in the popular imagination, for byte-banging floats out of a 2003 racing game. That popular imagination is wrong. The reader for Codemasters’ BIGF archive format — the container that holds the AI…
For most of Rails’ history, almost every layer of the stack has had a tool that parses it. RuboCop reads your Ruby as a syntax tree; Brakeman traces tainted data through it; ESLint reads your JavaScript. The view layer was the exception. The ERB linters we had worked on the text of the template, not on the HTML that text produces. Marco Roth’s Herb closes that gap: written in C, it parses…
A piece of feedback to the Rails community crossed my feed this week. A team had migrated an application to Rails 8.1.3, adopted Propshaft — the asset pipeline that replaced Sprockets as the Rails 8 default — and concluded that it had removed the ability to set a version string to force new fingerprints on precompile. Their words were that this introduced “a weakness to the platform.” The…
A webhook controller is the natural place to put webhook code. You name it WebhooksController , you put a def stripe action in it, and you start writing. Six months later it is 200 lines long and you cannot remember what half of it does. This post is about the moment I noticed mine had become a god object, and the small architectural shift that fixed it. The code is real. It is from Seams , the…
I have spent an entire book making the case for Rails engines. Now I am going to tell you when not to use them. This is not a hedge. It is honesty. Every architectural tool has a cost, and engines are no exception. Using them when they are not warranted creates overhead that slows your team down rather than speeding them up. Knowing when not to reach for an engine is just as important as knowing…
This is an adapted excerpt from Chapter 13 of Modular Rails: Architecture for the Long Game , my book on building maintainable Ruby on Rails applications using Rails Engines. Your test suite takes 40 minutes. Mine takes 4. That is not because I write fewer tests. It is because when I change billing code, I only run billing tests. When I change notification code, I only run notification tests. The…
This is an adapted excerpt from Chapter 17 of Modular Rails: Architecture for the Long Game , my book on building maintainable Ruby on Rails applications using Rails Engines. “Majestic monolith. The vast majority of web applications should start here and never leave.” – David Heinemeier Hansson The microservices conversation has been going on for over a decade now, and the industry is starting to…
A passing test tells you the implementation is correct. The second-order question — was the work behind this code the work we meant to do — is the one comprehension debt and the perception gap have both been circling. This post is the third leg. The argument of the first two posts was diagnostic. Teams using AI-assisted code accrue a gap between what exists in the codebase and what anyone on the…
An engineer opens a pull request. It is eighteen hundred lines across roughly fifteen files. The description has the kind of structure you write when you mean it — what changed, why, what you would push back on if you were the reviewer. They have thought about it. They feel organised. They are organised, from where they’re sitting. The reviewer opens it and is being asked to evaluate two or three…
This is an adapted excerpt from Chapter 16 of Modular Rails: Architecture for the Long Game , my book on building maintainable Ruby on Rails applications using Rails Engines. Rails engines are not the only way to introduce structure into a monolith. Packwerk, plain Ruby gems, namespaces, and even Hanami slices offer different trade-offs. The question is not which tool is “best” – it is which tool…