Superintelligence CouncilСовет гения · sim.im

DHH · 2025-07-12 · source ↗ · whole document (23)

Rails manifesto: Principles of a great programming language

`2:11:01`

and I put it together. Not because there was gonna be just one single overarching theory of everything, but I was gonna have a cohesive unit that incorporated the best from everywhere. — Is that idea a bit at tension with the beauty of the monolith system? — I think the monolith can be thought of as quite roomy, quite as a big tent that the monolith needs actually to borrow a little bit of functional programming for the kinds of problems that that excels, that discipline excels at solving, and that paradigm excels at solving. If you also want object orientation at its core. I actually think when I've looked at functional programming languages, there's a lot to love. And then I see some of the crazy contortions they have to go through when part of the problem they're solving calls for mutating something. And you go like, holy shit, this is a great paradigm from 90% of the problem. And then you're twisting yourself completely out of shape when you try to solve the last 10. — Ooh, exalt beautiful code is in the next one.

`2:12:03`

— We've talked about that at length and here's a great example that really summarizes the domain specific language quality of Ruby on Rails that you can make code actually pleasant to write and read. Which is really funny to me because as we talked about when I started learning programming, it wasn't even a consideration. I didn't even know that that could be part of the premise, that could be part of the solution. That writing code could feel as good as writing a poem. — class Project, ApplicationRecord belongs_to:account has many participants. Class_name, Person, validates_presence_of:name. — See, you could read it out. You didn't even change. — Anything like a haiku or something. — Right? Isn't that beautiful? — Yeah, it's nice. It's really nice. There's an intuitive nature to it. Okay, so I have specific questions there. I mean ActiveRecord, just to take that tangent. That has to be your favorite feature. — It's the crown jewel of Rails. It really is.

`2:13:04`

It is the defining characteristic of how to work with Ruby on Rails. And it's born in an interesting level of controversy, because it actually uses a pattern that had been described by Martin Fowler in the "Patterns of Enterprise Application Architecture." One of the greatest books for anyone working on business systems. And if you had not read it, you must pick it up immediately. "Patterns of Enterprise Application Architecture," I think it was published in 2001. It is one of the very few programming books that I have read many times over. It's incredible. In it, Martin describes a bunch of different patterns of how to build business systems essentially. And ActiveRecord is a little bit of a footnote in there. The pattern is literally called active record. You can look it up. — Nice. — It's called active record. I wasn't even creative enough to come up with a name of my own. But it allows the creation, the marriage of database and object orientation in a way that a lot of programmers find a little off-putting. They don't actually want to pollute

`2:14:05`

the beautiful object-oriented nature of that kind of programming with SQL. There was a rant by Uncle Bob the other day about how SQL is the worst thing ever. Baba, okay fine, whatever, I don't care. This is practical. We are making CRUD applications. You're taking things out of an HTML form and you're sticking 'em into a damn database. It's not more complicated than that. The more abstractions you put in between those two ends of the spectrum, the more you're just fooling yourself. This is what we're doing. We're talking to SQL databases. By the way, quick aside, SQL was one of those things that have endured the onslaught of NoSQL databases structured list data for a better part of a decade and still reign supreme. SQL was a good thing to invest your time in learning. Every program I'm working with the web should know SQL to a fair degree. Even if they're working with an ORM, an optic relational map or as active record. You still need to understand SQL. What Active record does

`2:15:06`

is not so much try to abstract the SQL away behind a different kind of paradigm. It's just making it less cumbersome to write. Making it more amenable to build domain models on top of other domain models in a ways that you don't have to write every damn SQL statement by hand. — We'll just say the active record is an ORM, which is a layer that makes it intuitive and human interpretable to communicate with a database. — Even simpler than that. It turns tables into classes and rows into objects. I actually think SQL is very easy to understand most of it. You can write some SQL golf too. That's very hard to understand. But SQL at its base, and much of the criticism against SQL was it was written for human consumption. It's actually quite verbose, especially if you're doing things like inserts over and over again. It's quite verbose insert into table parentheses, enumerate every column you want to insert, values, parentheses, every value that fits with that column. It gets tedious to write SQL by hand,