DHH · 2025-07-12 · source ↗ · whole document (17)
Beautiful code
`0:56:23`
He believes in humanity. He believes in the unlimited capacity of programmers to learn and become better. So much so that he's willing to put the stranger at his own level. This is the second part I truly appreciate about Ruby. Ruby allows you to extend base classes. You know how we just talked about 5.times is a way to iterate over a statement five times? That five is obviously a base class. It's a number. Do you know what? You can add your own methods to that. I did, extensively. In Rails, we have something called active support, which is essentially my dialect of Ruby for programming web applications. And I'll give you one example. I've added a method called days to the Number. So if you do 5.days, you get five days in seconds. Because seconds is the way we set cache expiration times
`0:57:26`
and other things like that. So you can say cache expires in 5.days. And you're gonna get whatever's five times — That's nice. — 24 times 60 times 60 is, or whatever the math is, right? Very humanly readable. In a novel programming language, you would type out the seconds and then you would have a little comment above it saying this represent five days. In Ruby, you get to write five days. But even better than that, Matz didn't come up with it. Matz didn't need the five days. I needed that because I needed to expire caches. I was allowed by Matz to extend his story with my own chapters unequal footing, such that a reader Ruby could not tell the difference between the code Matz wrote and the code that I wrote. He trusted me as a complete stranger from Denmark who had never met to mess with his beautiful story. That level of trust is essentially unheard of.
`0:58:27`
I know there are other program languages that allow things with macros and so forth. But none do it in a way like Ruby does it. None does it with an articulated vision of humanity, a trust in humanity like Matz does, that is the opposite end of the spectrum of Java. — Yeah, I mean for my aesthetic sensibilities, just the way you describe 5.days, that's really pleasant to me. Like I could see myself sitting alone, sleep deprived, and just writing that. It's just an easy thing. You can write it in a long way with a comment. You can write multiple lines. You could do, and now with AI, I'm sure it's gonna generate it correctly, but there's something really pleasant about the simplicity of that. I'm not sure what that is. But you're right, there is a good feeling there. And I'm sure we'll talk about happiness from all kinds of philosophical angles, but you know, that is what happiness is made of. That little — Exactly. — good feeling there.
`0:59:28`
— It's the good feeling that come out of a concept compressed to its pure essence. There's nothing you can take away from that statement that's superfluous. — But see, I also wanna push back a little bit 'cause I also a program named Perl a bunch. Just be cool. So like it's not all about compression. — No, you can compress it too far. Perl golf is a thing where you can turn programs into something that's unreadable for humans. Now the great thing about Perl was that it came out before Ruby. Matz was a great student of Wall, was a great student of Perl, was a great student of Python and Smalltalk and Lisp. He took inspiration from all of these prior attempts at creating good programming languages and really edited down the very best bits into this. So he was able to learn from his lessons. But what I found incredible about Ruby is that here we are 2025,
`1:00:29`
Ruby has been worked on for over 30 years, and essentially the first draft is 90% of what we're still using. There was almost a sense of divine inspiration possible in wherever Matz was writing that initial version of Ruby that transcended time to such a degree that no one has still even begun to reach it. This is the other thing I always find fascinating. I generally believe in the efficient market theory that if someone comes up with a better mousetrap or better idea, others will eventually copy them to such an extent that perhaps the original mousetrap is no longer even remembered. No one has been able to copy that essence of Ruby. They borrowed elements, that's totally fine, but Ruby still stands taller than everyone else on these metrics, on this trust in humanity and programmers. — And we should also say like, you know, maybe the perfect programming language that metric and then there's the successful language and those are often different.