DHH · 2025-07-12 · source ↗ · whole document (23)
Rails manifesto: Principles of a great programming language
`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,
`2:16:09`
but it's actually very humanly readable. Active record just takes that tedious away. It makes it possible to combine things in a way that a humanly describable language just doesn't. It composes things into methods and you can combine these methods and you can build structures around them. So I don't dislike SQL, I dislike a lot of things in programming. I try to get rid of them. SQL wasn't really one of them. It was just a sense of I don't wanna write the same thing over and over again. It was a, can we be a little more succinct? Can we match it just slightly better to the optic orientation without trying to hide away the fact that we're persisting these objects into a database. That's where I think a lot of ORMs went wrong. They tried to live in the pure world of objects. Never to consider that those objects had to be consistent into a SQL database and then they came up with convoluted way of translating back and forth. Active record says, do you know what? Just accept it. This record, this object is not gonna get saved into some NoSQL database.
`2:17:09`
It's not gonna be saved. It's gonna be saved into SQL database. So it's just structure the whole thing around that. It's gonna have attributes. Those attributes are gonna respond to columns in the database. It's not more complicated than that stuff making it so. — Yeah, but I should say, so I personally love SQL because I'm an algorithms person and so I love optimization. I love to know how the databases actually work so I can match the SQL queries and the design of the table such that there is, you know, optimal, squeeze the optimal performance out of the table. Okay, based on the actual way that that table is used. So I mean, I think that pushes to the point that like there is value in learning in understanding SQL. I wonder, because I started looking at active record and it looks really awesome. Does that make you lazy? Not you, but a person that rolls in and starts using Rails you can probably get away with never really learning SQL, right?
`2:18:09`
— As long as you wanna stay at the entry level of competence. And this is actually my overarching mission with Rails is to lower the barrier of entry so far down that someone can start seeing stuff on their browser without basically understanding anything. Yeah, they can run Rail's new blog, run a couple of generators, they have a whole system, they don't understand anything. But it's an invitation to learn more. Where I get fired up, and this ties back to the AI discussion, is when that's turned into this meme, that programmers no longer have to be competent. I mean the AI is gonna figure it out. The generators is gonna figure it out. I don't need to know SQL, active record is gonna abstract it away from me. No, no, no dude, hold up. The path here is competence. I'm trying to teach you things. I understand I can't teach you everything in five minutes. No one who's ever become good at anything worthwhile could be taught everything in five minutes. If you wanna be a fully well-rounded web application developer,
`2:19:10`
that takes years. But you can actually become somewhat productive in a few days. You can have fun in a few days for sure. You're gonna have fun in a a few minutes and a few hours. And over time, I can teach you a little more. Active record says like, yeah, yeah. All right, start to here and then like next week we'll do a class on SQL. — And actually you have this beautiful expression that I love that that a great programming language. Like Ruby has a soft ramp, the ramp goes to infinity. — That's exactly right. — So yeah. It's super accessible, super easy to get started. — And it never stops. There's always more to learn. This is one of the reasons I'm still having fun programming. That I'm still learning new things. I can still incorporate new things. The web is deep enough as a domain. You're never gonna learn all of it. — Provide sharp knives. — This is a good one, because another way of saying this, the opposite way of saying this, the Java way of saying is do not provide foot guns, right? I don't wanna give you sharp knives. You're a child. You can't handle a sharp knife.