Programming Paradigms

Summarized using AI

Something Interesting

Dave Thomas • August 27, 2009 • Earth

In this insightful talk from the LoneStarRuby Conf 2009, Dave Thomas reflects on his 10 years of experience with Ruby, exploring its multi-paradigm nature and the community that surrounds it. He expresses gratitude to Ruby’s creator, Mats, and discusses why Ruby continues to captivate his attention.

Key Points:
- Longevity with Ruby: Thomas emphasizes that despite his short attention span, Ruby's flexibility and expressiveness have kept him engaged for a decade.
- Appreciation for Mats: Acknowledging Ruby's origins, he highlights the significance of Mats and others in establishing the Ruby community.
- Multi-Paradigm Language: Ruby allows for various programming styles, including object-oriented and procedural, offering programmers freedom to choose their approach.
- Imperfection as Strength: Thomas champions Ruby's imperfections, equating them with a more human touch in programming. He uses quotes to convey that perfection inhibits creativity and progress.
- Messiness in Ruby: He illustrates Ruby's quirks and flexibility, which make it intriguing for developers. This includes discussing how its syntax allows for various interpretations of code.
- Development Evolution: Tracking Ruby’s growth from version 1.0 to 1.9, he notes its increasing complexity and richness, which keeps the language vibrant.
- Community Dynamics: The Ruby community's evolution from a small group to a large network impacted its structure and connections. Thomas learns from the community's complexities and dynamism.
- Final Thoughts on Ruby and Community: He concludes that the messiness of Ruby, akin to human nature, makes it exciting and enjoyable to work with, reinforcing his commitment to the language as long as it remains fun.

Overall, Thomas's reflections underscore Ruby's appeal as a programming language that is both flexible and imperfect, celebrating the chaotic yet creative spirit of its community.

Something Interesting
Dave Thomas • August 27, 2009 • Earth

Something Interesting by: Dave Thomas

LoneStarRuby Conf 2009

00:00:18.800 Got it. I am celebrating something like my 10th year using Ruby. Anyone that knows me knows that I really have the attention span of a gnat, so for me to continue using Ruby after 10 years is a real testament to the language. One of the things I wanted to talk about today is why I'm still using Ruby after 10 years and what keeps me interested in it. Before I do that, I want to share an experience I had two years ago when I was invited to the Ruby Kaigi, the Japanese Ruby conference. It was a long flight, but I thought, 'I really want to thank the home of Ruby,' and particularly, I wanted to thank Mats for creating it and giving me 10 wonderful years.
00:00:52.960 Of course, when I turned up to give my talk, Mats wasn’t there. But I think all of us owe a big thank you, regardless of whether we've been using Ruby for 10 months or 10 years, to Mats and also to the other people in Japan who have developed Ruby. For the rest of the community that's built upon it, I just really want to take this opportunity right now to thank Mats for that. I believe it's been absolutely wonderful. So here I am, standing in front of the LoneStar Ruby Conference. You know, I used to say, 'Here’s what I'm going to talk about,' and everything else, but I think it would be better if I had some kind of objective measure of what I'm doing.
00:01:44.720 Fortunately, two years ago, there were one of the deepest commentators on the Ruby community standing in front of you, talking about the quality of the people in the community and the quality of keynotes given in the community. I’d like to set the tone for what I’m going to do here. It can only get better. So why am I interested in Ruby? Why do I keep coming back to it? One reason, but not the main reason, is that Ruby is this multi-paradigm language. It's an object-oriented language; in Ruby, everything is an object. But unlike the majority of object-oriented languages, it doesn’t force you to be an OOP programmer. You can still write procedurally if you want.
00:02:10.280 Or if you prefer, you can write in a prototype-based style. I’ve been doing that more and more—I don't use classes, but instead, I create hierarchies of objects and add things to those objects. It’s a very liberating way of programming and it's actually the way JavaScript works underneath. While there are many people who try to argue that Ruby is a functional programming language too, I would say Ruby is functional programming in much the same way that a Trabant is a car—it kind of helps, but it’s not really there. That’s okay. Another cool thing about Ruby is that it's all these paradigms at the same time, and one of the incredible achievements of Ruby is its syntax, which draws from everything from Perl to Modula-2 and beyond, creating a coherent whole.
00:03:27.159 One of the reasons Ruby works for me is that it doesn’t tell me how to think. Instead, it works the way I think. I don't think purely object-oriented or functional; I think, 'Hey, I want to get this job done,' and Ruby allows me to do everything I need to do simultaneously. However, the downside of Ruby thinking the way I think is that it also means it’s imperfect, and that is why I like Ruby—it is grossly imperfect, and it's gloriously imperfect. Now, is that a big deal? Yes, I think it’s a massively big deal. Let’s look at some famous quotes about imperfection. It is absurd to look for perfection; that’s in a Sting song, right? To look for perfection is to live in hell. It conveys the idea that you can never really achieve it; you can waste a lot of time chasing it.
00:04:40.720 The pursuit of perfection often impedes improvement. Sometimes, we sit there saying, 'Oh, I’ve got to do this and this and this,' while thinking of all the reasons why we shouldn’t or can’t do something instead of just getting on with it. I love that quote: 'Perfectionism is slow death.' If you can't change anything, you might as well just wither away. Perfectionism is the energy of creation; without it, nothing can be made. Every process involves breaking something, and if you can’t change something because it’s perfect, nothing will ever get done. There is no redecoration in a pristine chapel. No good work can ever be perfect, and the demand for perfection is always a sign of misunderstanding art.
00:05:54.600 Perfectionism is the voice of the oppressor. It's true; you can oppress people with the idea of perfectionism because in that mindset, there is only one way to do things. Only mediocrity can be trusted to always be at its best, and the essence of being human is that one does not seek perfection. I believe Ruby is, if anything, the most human programming language we know. We have this wonderfully ironic sentence: 'Perfection has one grave default: it is apt to be dull.' No one wants to live in a perfect world—fortunately, Ruby is not perfect. It has its quirks, and I’m going to show you some of the trivial cases now.
00:06:58.480 First of all, the Ruby language itself is gorgeously messy. Here’s a line of code: what does this actually mean? It’s a method that takes a block, but a lot of people think it's a method that takes a hash parameter. That little excitement of uncertainty can always be clarified by adding parentheses around it. For instance, if I type this, it’s a method that takes a hash. If I ask, 'What is this?' people might say, 'That’s a syntax error.' Surprisingly, it actually can turn from a syntax error to a method that takes a hash by simply removing the hash literal characters.
00:08:26.000 Let’s look at another example. If Ruby knows that m is a variable somewhere, what does that mean? It means it's going to send the divide operator to m, passing n as a parameter, and then pass the result to o. However, if there is no prior assignment to m, the interpretation changes completely. Now, we might view this as a call to m, passing it a single parameter, which could be a regular expression. If not, it might be interpreted as calling the method m and dividing its return value by n.
00:09:09.600 These are just a few surprising quirks in Ruby, even for experts. Now, everyone knows that programming languages have keywords, right? In C, keywords are predefined reserved identifiers that cannot be used as identifiers in your program. This pattern is consistent through languages like Java and Python as well. However, Ruby allows for more flexibility. Look at this code for example—if I assign the string 'cat' to the variable c and then define a method on it using the word 'begin', guess what? It works!
00:09:54.000 I guess 'def' is not too much of a keyword really in that sense. We can take it even further—let's define a method called 'de' on object and do something like this: c.de hello do. This means I can define a method without being restricted by the usual keyword limitations! In Ruby, you can write code that looks and feels natural. There’s more than one way to do things, and this flexibility allows different ways to express the same task. For example, if you want to output the numbers 0 to 9 one per line in Ruby, there are multiple ways to do it, all of which work perfectly.
00:11:07.960 You could use a simple loop, or use an enumerator. You could even call 'puts' with arguments from an array to produce the same output, or opt for a splat operator with a range—again, valid and effective. What’s impressive is that all of these methods exist, allowing you to choose how you want to express your intention. However, some people adopt certain practices just because they’ve seen others do it, which means there’s a danger of following trends without understanding the reasoning.
00:12:10.640 I love that quote from David Levithan's book, 'The World in Six Songs.' It states that the best poetry and art in any medium is ambiguous. Ambiguity invites participation. If I give you clear-cut instructions, it's not going to be poetic; but ambiguity creates room for interpretation and engagement. This is vital because it speaks to Ruby as a language rich in ambiguity. A language without ambiguity is a dead language, and Ruby is very much alive and thriving.
00:13:49.720 Now let's talk about the progress of Ruby. The way Ruby is being developed is incredibly messy. You see, as a publisher, I have actually banned certain quotes at chapter tops—one being, 'A Journey of a Thousand Miles Begins with a Single Step' and another is, 'Perfection is achieved not when there’s nothing more to add, but when there is nothing left to take away.' People have often held onto this concept of minimalism and perfection. But I argue that the real beauty lies in encompassing everything—if you are everything, then by definition, you're perfect.
00:16:01.560 In an era of rapid development, Ruby is busy expanding. Back in 1997 when Ruby 1.0 was released, the download size was about 1.5 MB. Now it has grown to about 40 MB! If you plot that on a log axis, it appears to be linear growth. However, as we progress towards Ruby 2.0, we might be looking at a terabyte download, which is kind of thrilling considering how far we’ve come. Looking at the number of core methods, Ruby has gone from a couple of hundred to thousands—many of which do similar things. Is it a bad thing? Not at all! It allows for a richer, bolder language which is just fun to explore.
00:19:52.640 Ruby 1.9 introduced incredible changes, like fibers and enumerators, character encoding improvements, and a new regular expression engine. These enhancements make Ruby an exceptional language worthy of embracing. Indeed, it allows us to create beautiful regular expressions and match patterns, capturing context within our code. In essence, I think messiness is valuable; it keeps things interesting. I constantly find new things in Ruby that surprise me, which keeps me on my toes.
00:24:41.280 I love the community surrounding Ruby because it mirrors the messy nature of the language. When Ruby was created, it started as a small group of people, individuals venturing into the unknown, simply seeking something different. It wasn't easy; it took a lot of time and courage for that community to form, involving other individuals and creating an identifiable structure. In the early days, the first International Ruby Conference happened in a bar with only about 30 people in attendance. Everyone knew each other, and as Ruby grew, so did the number of developers...
00:27:39.600 In those formative years, people would come into Ruby and go, 'Oh, that’s cool,' and they would stick around. Then something shifted in the community as Rails experienced a gold rush, drawing in a multitude of new people. It became somewhat challenging for a time as the influx of new arrivals made it difficult for the original members to maintain connections. The community evolved through that explosive growth, just like every frontier town does, creating new structures to support a wider range of users.
00:31:09.480 I have learned a lot from the way the Ruby community functions, through both its beauty and its complexities. Here, we're looking at how informal connections blossom into organized clusters. This is evident as we aggregate all these groups of Ruby enthusiasts who participate in unique ways, gathering like-minded individuals in passionate pursuit of Ruby’s potential. Ultimately, I’ve realized that the idea of a singular 'Ruby Community' is simplistic; many communities exist that share a love for Ruby, comprised of individuals all contributing in their excellence.
00:35:03.760 If we understand that people are just as messy as the syntax of Ruby, and embrace the chaos and creativity, then we realize that's what makes Ruby exciting for me after all these years. Messiness can be fun, and that's why I'm still doing Ruby after 10 years, and I hope to continue as long as it's still fun. Thank you!
Explore all talks recorded at LoneStarRuby Conf 2009
+14