Summarized using AI

Ruby's Creed

Bozhidar Batsov • June 16, 2023 • Verona, Italy • Talk

In the talk titled "Ruby's Creed," speaker Bozhidar Batsov explores the fundamental philosophy behind the Ruby programming language, particularly its focus on 'programming happiness.' Batsov compares Ruby's unique principles with those of other programming languages, identifying key differences and commonalities. Throughout the session, Batsov outlines several essential themes and concepts:

  • Philosophy of Ruby: Ruby is described as a language that prioritizes productivity and joy in programming, suggesting that a language should facilitate thinking and creativity.
  • Creed versus Motto: Batsov highlights the distinction between a language’s creed (system of beliefs) and its motto (short phrase encapsulating ideals), illustrating how Ruby’s focus is on subjective happiness with programming rather than strict rules or methods.
  • Cultural Behaviors: Batsov discusses how a programming language’s culture is defined by the behaviors it rewards or punishes, as opposed to the ideals it claims to uphold.
  • Examples of Other Languages: He contrasts Ruby with languages like Clojure and Python, which adhere to stability and clarity respectively, showcasing how Ruby supports multiple ways to achieve functionality, inspired by Perl's philosophy.
  • Subjective Happiness: Happiness in Ruby programming is considered subjective; different features appeal to different users, with examples of controversial features that may enhance happiness for some while frustrating others.
  • Recent Changes and Community: Batsov reviews various recent releases of Ruby, assessing their impacts, and emphasizes the importance of community feedback in shaping language updates, reinforcing that the Ruby community remains vibrant and resilient despite challenges.
  • Inclusivity and Flexibility: Ruby is promoted as a flexible language that accommodates different programming styles, from object-oriented to functional programming, allowing individual programmers to tailor their use of the language to their preferences.

Overall, the presentation encourages a celebration of Ruby's unique philosophy, which strives to foster happiness among its users while acknowledging the complexity of satisfying a diverse programmer community.

Ruby's Creed
Bozhidar Batsov • June 16, 2023 • Verona, Italy • Talk

Every programming language has some fundamental idea(s) that drives its design and evolution.
For Haskell that’s functional purity and state-of-the-art static typing, for Erlang that’s distributed programming and fault tolerance, for Clojure that’s simplicity and stability.

What all these examples have in common is that they are relatively easy to understand and map to design decisions in the languages. This, in turn, makes it possible to determine down the road whether a language sticks to its core values or deviates from them.

Ruby, however, is very different. It’s world famous for its unique creed - “optimizing for programming happiness”. But what does this really mean? How does one optimize for happiness?
Unfortunately I’ve never heard Matz speak about this, so in this talk I’ll offer you my perspective instead. I'll also discuss some of the recent changes to Ruby and whether they adhere to its creed or not. Controversy & fun ahead!

rubyday 2023 happened in Verona on 16th June 2023

Info and details of this edition:
2023.rubyday.it/

rubyday 2023

00:00:00.719 Hi everybody! Sorry to cut your coffee break short. I know that after so many great talks, your minds are probably a little bit overwhelmed, but I hope that they're not too overwhelmed because now we are going to have a deep dive into some deep philosophical topics.
00:00:06.000 So, I need some mental energy from everybody. Yes, that's the spirit! That's my spirit right now, even if it doesn't show. Being here is very special for me. In 2019, I was in Verona for the very first time, and little did I know that this was going to be one of the last Ruby conferences I would attend in person. This is actually the first Ruby conference that I have attended in person since 2019.
00:00:58.920 You all know that I was kind of skeptical about the delivery date. Even less believable things have happened, like Manchester City actually won the Champions League. Messi finally won the World Cup—I didn't see this coming! And more importantly, I know there's somebody from Napoli here. Congratulations! I know you've waited for a very long time.
00:01:22.960 Miracles continue. You know, if somebody was here, it was the former Prime Minister of Bulgaria, Boyko Borisov, who was considered Eternal, but he's no longer the Prime Minister of Bulgaria. So, it's true what they say: 'impossible is nothing.' But other things haven't really changed, like my name is still Bozhidar, and people are still struggling with it in English and in other languages. You can think of me as 'Buck'; that's cool.
00:01:55.799 I also tried to explore alternatives to Twitter, but I miserably failed, so I'm still on Twitter. I'm still from Sofia, Bulgaria, and it's a wild place. I still work at Toptal, but we did change our logo, and I forgot to update the slide, so please do not rat me out to the marketing department; they are vicious! I still work a lot on various open-source projects.
00:02:24.000 You probably know me for my work on the Ruby and Rails style guides and as the author of RuboCop. I really enjoyed the morning session by Alessandro; it is so nice to be in the audience and listen to somebody else talk about RuboCop—pretty cool!
00:03:05.000 I had a lot of free time on my hands, especially in 2020 and 2021. I indulged in a lot of Netflix TV series. I actually subscribed to every streaming service that exists—probably not the best use of my time. But I also broke my personal blogging record on both my blogs. Don't ask me why I didn't merge them!
00:03:24.000 So, you know, for the next pandemic, if you need some reading material, I have some ideas! The important stuff: back in Italy, a country with which I feel connected at multiple levels. I really like a good Aperol Spritz, a good Negroni, and a good Italian wine with light appetizers.
00:03:42.000 I enjoy good pasta, and afterwards, you need a good digestivo—or two. Someone might think that I have a drinking problem, and probably I do, because this is how my last conference in Verona ended! I honestly don't remember how I spent so much money, but I do remember how I got this grappa.
00:04:09.960 Another thing that is constant is my love for Ruby. I have been doing Ruby for so long that I can't even remember. Maybe it was just before they released Ruby 1.8. I remember that Rails was still a hot new thing, and people were excited about it—it was like crypto in 2005.
00:04:25.600 Today, I'd like to speak a little bit about the underlying philosophy behind Ruby because, in the words of Matz, our glorious leader, I think a programming language should have a philosophy of helping our thinking. Ruby's focus is on productivity and the joy of programming.
00:04:46.160 If you feel comfortable with Ruby's philosophy, that means Ruby is your language. That sounds really wise because Matz is wise; I don't expect anything else from him. However, it's not very clear to me what exactly this philosophy is in practical terms, and it's not clear to some of my biggest fans either.
00:05:07.760 So let's debunk this. Let's analyze the philosophy behind it. First, a few dictionary definitions. As usual, what is Ruby? There are two meanings: a precious stone consisting of corundum, with color varieties ranging from deep crimson or purple to pale rose. Sounds nice!
00:05:29.960 The second meaning is a programming language optimized for programmer happiness. Let's create a more complicated term: another noun—a system of religious belief, a faith. More popular from The Mandalorian, I guess, in recent days. I've noticed that 'creed' in modern society is often confused with another noun: 'motto.'
00:05:56.679 'Motto' is a short sentence or phrase chosen as encapsulating the beliefs or ideals of an individual, family, or institution. I want to illustrate this with a few examples. You probably know that Perl was one of the spiritual inspirations for Matz in the early days of Ruby, and Perl has this famous motto, 'There's more than one way to do it.'
00:06:25.840 In reality, in Perl, there are endless ways in which you can write a piece of code. Python has a very different motto; one of them is that there are many ways to do it, but one is objectively better than the others. I do like the Zen of Python: 'Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex.' Good stuff!
00:06:39.639 The rest is very long, so I'm not going to read it all. If you ask various people, Ruby's motto is that Ruby is optimized for programmer happiness, or Ruby is a programmer's best friend, or Ruby has the nicest community in the world. You know, but what does this really mean?
00:06:53.200 You can ask different people; they may tell you, oh, it's a dynamic, open-source programming language with a focus on all sorts of things—it's cool, easy to read, write, whatever these memes say. But I think, in reality, it's a lot more nuanced than this.
00:07:12.760 I always like to think about culture because I pretend that I'm a programmer, but in reality, I'm an engineering manager. And if you're an engineering manager, the word you're constantly thinking about is culture. Yes, that's the management buzzword number one.
00:07:27.840 Culture is explained in all sorts of ways, but I think that the best possible definition of culture is that culture is the behaviors that you reward and punish instead of the things that you claim you value but actually don't care about. So, really, we are defined as organizations, as individuals, by our actions and not by our words.
00:07:40.640 It's simple, but it's also true. And if we transplant this to the idea of creed, I have some examples of creed. Another programming language that I like is Clojure, which is known for its stability. Clojure has never broken backward compatibility since its initial release in 2018.
00:08:03.039 I think this is an instance of the actions of the team behind Clojure really being aligned with what they say. Clojure also states that it's preferable to have a small core, an essential yet easy-to-comprehend standard library. They also reflected this in their direction.
00:08:18.080 There have been fewer commits in the entire history of Clojure than in roughly six to eight weeks of Ruby development. One release of Ruby typically accounts for over 5,000 commits, and almost every release breaks something in a subtle way.
00:08:36.039 Clearly, stability, for instance, is not an element of Ruby's creed. We talk a lot about happiness, but what is this happiness exactly? I can tell you what happiness is in Ruby for me: I saw this snippet of code a long time ago, and I thought it rocked.
00:08:51.120 Because really, they pushed object-oriented programming to the limit! You can invoke methods on numeric types, which was rather uncommon for performance reasons back in the day. It’s beautiful, and that's all I have for you. Thanks for your attention!
00:09:22.720 Okay, you don’t believe me? So I'll continue. There is always one more thing. Experience has taught me that happiness is something very subjective. Like, if you ask me, happiness is programming in the greatest text editor in the world, and it's not that one.
00:09:43.040 Or happiness is having a bunch of parentheses in your code! But, you know, that's just me. I can watch reviews about mechanical watches all day long, but I cannot endure 30 minutes of a tech talk at home at this stage of my life.
00:10:01.080 So, that's just me. My views have been changing through the years. At some point, I thought that assembly was the greatest programming language, and you weren't a good programmer if you needed something high-level like C. I thought that C was for people who pretended to know how to program.
00:10:30.560 Now in hindsight, I'm like, okay, that guy was full of it, but maybe he got wiser with age. Happiness is something individual, and I think Matz realized this early on. That's why I think he borrowed some of Perl's ethos that 'there is more than one way to do it' and made it one of the mottos of Ruby.
00:10:47.320 This is reflected in much of Ruby's design. In most languages, it's very uncommon to have several names for the same method within the core library. People would say that this is confusing, and they might be right. But in Ruby, it's very common.
00:11:12.120 Many methods that are used daily have two or three names within the standard library, and you have to find the one that resonates with you. Maybe you're coming from a Smalltalk background and you really like the names 'collect', 'inject', 'detect', 'select.'
00:11:29.760 Maybe you're coming from a Scheme background or some other language that used 'map' and 'filter,' so you're probably not going to be happy using the Smalltalk terminology, and that's fine. You have to make a choice, decide what makes you happy.
00:11:45.080 I've decided for me; for instance, my preferred set of methods would incorporate single and double-quoted string literals, even if you don't really need them because they're useful. We need to have significant topics too, like, do you know that double-quoted literals have this amazing advantage in some cases?
00:12:09.280 We have different hash literals, and the situation becomes more complicated. I know that people, especially those coming from JavaScript backgrounds, really like the changes that were made in Ruby 1.9. Do we really need this? No, but for some members of the community, it was useful.
00:12:27.480 I think that all of the features that are often labeled as controversial in Ruby, like flip-flops for loops, etc., are useful to some people, and they make them happy. I always remember the five-year-long discussions to remove flip-flops.
00:12:47.720 We were getting rid of them because they were super confusing, and nobody uses them. It was approved by Matz, and then one Japanese developer says, 'I actually like them for one particular use case,' and Matz says, 'Okay, one person really likes this feature, so it stays.' This is what happiness is.
00:13:01.799 But, again, because this is very subjective, it's hard to distribute happiness uniformly. I always think about the things that make me happy in programming. I like simple and consistent syntax; these days, I prefer a functional style of programming.
00:13:26.799 I believe you witnessed today a nice demonstration of why a functional style of programming yields clearer code, subjectively speaking. I like a standard library that comes with batteries included, and I don't have to wonder how to work with regular expressions.
00:13:49.440 In Ruby, I really appreciate that we have a very mature ecosystem in this regard. RubyGems is great; Rakuten is great. We have a lot of great editor plugins—good stuff!
00:14:11.239 I like the ecosystem full of third-party libraries. We have Ruby on Rails kind of dominating, and everybody is a developer, which kind of makes me sad, but also I realize that we probably wouldn't have been here without the success of Ruby on Rails.
00:14:32.519 For me, it is very important what the community is behind the language, and I think that this was a topic we touched on yesterday with several people at the speakers' dinner. Today, the language landscape is more crowded than ever before.
00:14:50.080 Companies are pouring billions of dollars promoting the languages that they believe in, and that's fine. But what made Ruby special in the beginning wasn't some syntactic breakthroughs or an amazing VM behind it; it was the energy of the people, and this hasn't changed.
00:15:07.760 Many people have retired from the Ruby community over the years; people were saying every year, 'Ruby is dying! The end is near! Let's all switch to Rust, let's switch to Go, let's switch to TypeScript!' But we are still here.
00:15:27.860 The conference is celebrating its 10th anniversary right? And Yuko—the 20th anniversary of Ruby, the 30th anniversary of Ruby! A good community doesn't die easily. In the Emacs world, we know this.
00:15:46.040 Even though there are some Ruby features introduced in recent years that I'm not fully excited about, I still like the overall result. But I'm not going to go into detail now. I want us to do a fun game together.
00:16:05.440 So, we are going to grade the recent Ruby releases on a scale from one to five. Basically, if you really hate something, it's a one. If you love something, it's a five. If you can open your phones, or if you're the type of person who still can write with pen and paper, just follow along.
00:16:23.280 Let's see how many people have scored the recent Ruby innovations the same way I do. We are going to start with Ruby 2.7, just because this is the first release that happened after my last visit to Verona. My scores are in line.
00:16:42.480 Pattern matching—okay! A useful feature! I didn't really need it, and I don't think it fits a language like Ruby in the same way it does a language like Haskell or OCaml. But I think it's a nice addition—four out of five! Real keyword parameters: I was very divided about this.
00:17:02.760 On one hand, it's better than before. On the other, we are breaking backward compatibility and creating a lot of maintenance overhead. I remember how panicked people were when the warnings started about the final change in Ruby 3. Numbered block parameters... oh, I was definitely not super excited about this.
00:17:21.639 I told you I like readability more than conciseness. 'Explicit is better than implicit.' But okay, I can live with this. Begin range: I was kind of puzzled that people actually demanded this, but I don’t hate it.
00:17:39.280 I still pondered a lot, especially on the original syntax, how someone believed that this code underneath is objectively better and clearer than the code above it. But I realize that somebody was made happier.
00:17:53.360 I’m wondering if somebody was made happier from this sprawl of code, other than Go coders. I know that in Japan, they have a very strong culture of competing to write the most unreadable yet aesthetically pleasing programs, so I'm pretty sure that this is the real reason this feature was implemented.
00:18:11.800 We continue with the big release: full separation of keyword arguments. More pain, more gain, I guess. Something like this. Developers kept telling me for years that we needed this. Yet, they never needed it, so I was on the fence, but probably it's useful.
00:18:35.440 Fibers? Same; pattern matching is no longer experimental—good stuff. Endless methods? Just as useless as begin methods, but okay, we don't have begin. But you know we are making some weird progress.
00:18:56.040 I'm pretty sure this came up immediately in Ruby 3.1. Now here it gets really interesting because I told you that hash syntax has become progressively more... Uh, I don’t know, exciting for a lack of a better word.
00:19:15.440 I was also really surprised about the anonymous block argument syntax. It called for a lot of changes. Pattern matching gets improvements—good stuff! There is a lot of consistency, and anonymous method argument forwarding, I think this was a no-brainer in the most recent release.
00:19:39.439 Better inspectable refinements? I still think that this is one feature that almost nobody ever used. But I guess it's better to make it better.
00:19:59.840 The data class fixes some longstanding issues of the old struct class—good stuff! Maybe somebody is going to be using it now. Sets as a built-in class: this seems tiny, but it got me really excited because almost nobody in the Ruby community used sets just because you had to require them.
00:20:19.920 We kept using arrays as sets, which is messed up on so many levels, so making progress—small steps. Fiber storage? Still don’t need fibers, but I think that they needed the storage.
00:20:39.440 More pattern matching improvements? I keep wondering how many improvements we need there, but I think we are making progress. I don’t have the time to compare notes with you, but how many people see exactly the same as me? Nobody?
00:20:56.560 So, I'm right; happiness is individual. You know, humans are very weird beings. You give somebody stability and they're unhappy; 'Oh, there are no new features!' And the same people are super excited when they get a lot of shiny new stuff.
00:21:10.480 And there is always the grumpier bunch: 'Too many features! Oh, you ruined my life. This was so beautiful, and now you made it ugly!' They really hate the new stuff. And the lack of new stuff makes them very happy.
00:21:26.120 I used to be one of the first group; now I’m one of the second. I’m not sure if this is an age thing or if I've acquired some life wisdom. But I have something for you to ponder.
00:21:48.560 So, Ruby is mostly an object-oriented language—supposedly as pure as they come—but it borrows a bit from functional programming. A lot of efforts were made in the early days of the Ruby community to promote Ruby as a spiritual successor to Lisp.
00:22:02.480 It was a language inspired by a lot of functional programming research. We were very proud of being a dynamically typed language; duck typing was all the rage back in the day. And in recent years, we changed our tune.
00:22:18.000 Now we want static typing. We want to emulate some other languages that have completely different values—completely different creeds. This leaves me puzzled. At the end of the day, what are we aiming for?
00:22:39.160 Is Ruby just a Swiss army knife? A multi-purpose tool that can get more or less everything done? Even though there are some compromises—like, obviously you can cut with this small knife, but you can cut better with a machete.
00:22:54.640 Or, DHH famously said, I believe around 2008, that Rails is an omakase. I hope I'm not butchering this. Basically, this is a dish that the chef prepared to their exact specification, and if you don’t like it, you know nothing about food.
00:23:08.480 It's perfect; the problem is in you. DHH also told us around 2007 that database constraints were a bad idea and nobody needed them. So, I wouldn’t take anything at face value, but still, I think there is some wisdom.
00:23:23.840 At the end of the day, I think that Ruby is a la carte; Ruby is something that you have to make your own. This is the recipe for success. There are bits of Ruby that you're probably going to love and bits you're going to dislike.
00:23:36.839 But Ruby doesn't force you into using one specific style of programming. Unlike many other languages, I know that, for instance, many people were put off by Haskell because they felt that it was so weird to work with basic things like output.
00:23:52.960 Ruby tries to be practical. We think some things are probably better traded apart that is easier to follow, but you're free to go wild and do anything that you want.
00:24:07.680 If you want, you can be as imperative if it makes you happy. You can try a more functional style of programming. Dynamic typing is the default, and it has served us well. But if you feel that this is a problem, now you have the option to incrementally add static typing.
00:24:24.760 I think that this philosophy made the introduction of the community style guides and RuboCop immensely painful in the Ruby community. For the first few years, people were told that everything goes, and then we decided that maybe we need some common standards.
00:24:43.480 Many of the people who were attracted to the original culture and the original promise were upset that someone was trying to prescribe better approaches in a community famous for 'everything goes.'"
00:25:08.520 I have been in so many discussions about what happiness, good style, and whatnot is in Ruby that if I never hear Ruby style and single and double quotes for the rest of my life, it would be too much.
00:25:26.800 So at the end of the day, what is Ruby's creed? I think that Ruby's creed is to give you a language that is flexible enough that most programmers will be somewhat happy with it. Because absolute happiness is a myth, unless we're talking about text editors.
00:25:46.080 And I think that when you have a language where the benevolent dictator for life actually listens to the community and tries to please everybody, Matz could have been ignoring many of the requests for improvements.
00:26:04.120 But we can see that he is really trying. All of the features that we’ve seen in the recent Ruby releases were things that have been discussed for years and years and years.
00:26:21.840 There was a lot of deliberation over some, regarding others, but I think it is really valuable to be part of such a community. This is something worth celebrating because, as a community, we are winning.
00:26:41.840 That's all I have for you this time, and the feedback is always welcome. Anyone want to share something or ask something? I mean, it's a philosophical talk, right? So you can have opinions.
00:27:12.560 Anyone from the stream? It doesn't look like it's too late for philosophy. Seems I know, right? No, but then, oh! There's a question over there.
00:27:33.600 Languages offer, so that’s true. Solargraph was problematic for a while. I think this is what encouraged Shopify to step in and try to provide better tooling. I think we have to be very grateful that in our community we have actually a few companies that are willing to invest in development tooling.
00:27:55.440 I think this is the biggest difference between the commercially funded, supposedly open-source languages. Go is open-source in theory, but in practice, it's fully controlled by one company, and there are many such examples.
00:28:12.600 Shopify's solution is better, but I also heard that they laid off a lot of people from the team working on development tooling. I think that our dreams about a great LSP server will have to wait for a little bit.
00:28:31.440 This was also part of the reason that drove us to embed an LSP server in RuboCop itself. For the function of linting and formatting, which I guess is the bare minimum that most people need.
00:28:50.600 Maybe you don't need a super complicated LSP server that constantly breaks and interrupts your workflow. But, yeah, I think that more companies should probably collaborate on one project for the benefit of everybody in the community.
00:29:10.000 I was also surprised that Shopify started this project. I'm not sure how much they tried to collaborate with Solargraph, but I always think that it's better to focus efforts into one project than to try to fork the community.
Explore all talks recorded at rubyday 2023