The Artima Developer Community
Sponsored Link

The Philosophy of Ruby
A Conversation with Yukihiro Matsumoto, Part I
by Bill Venners
September 29, 2003

<<  Page 3 of 4  >>

Advertisement

Freedom and Comfort

Bill Venners: One of the design philosophies in the Python community is providing one and only one way to do things. If you provide fifty different ways to do the same thing, then you've provided convenience for code writers. People can write things in their favorite way. The tradeoff is for code readers. When I read your code, you might have written it one way. When I read the next person's code, they may have written it another way. So as a reader I end up needing to be familiar with all ways to accomplish the task, not just my favorite way of writing it. That's the design tradeoff. The Python community seems to prefer the one and only one way approach, but Ruby seems to provide multiple ways to do the same thing.

Yukihiro Matsumoto: Ruby inherited the Perl philosophy of having more than one way to do the same thing. I inherited that philosophy from Larry Wall, who is my hero actually. I want to make Ruby users free. I want to give them the freedom to choose. People are different. People choose different criteria. But if there is a better way among many alternatives, I want to encourage that way by making it comfortable. So that's what I've tried to do. Maybe Python code is a bit more readable. Everyone can write the same style of Python code, so it can be easier to read, maybe. But the difference from one person to the next is so big, providing only one way is little help even if you're using Python, I think. I'd rather provide many ways if it's possible, but encourage or guide users to choose a better way if it's possible.

The Joy of Ruby

Bill Venners: In an introductory article on Ruby, you wrote, "For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative side of programming, So Ruby is designed to make programmers happy." How can Ruby make programmers happy?

Yukihiro Matsumoto: You want to enjoy life, don't you? If you get your job done quickly and your job is fun, that's good isn't it? That's the purpose of life, partly. Your life is better.

I want to solve problems I meet in the daily life by using computers, so I need to write programs. By using Ruby, I want to concentrate the things I do, not the magical rules of the language, like starting with public void something something something to say, "print hello world." I just want to say, "print this!" I don't want all the surrounding magic keywords. I just want to concentrate on the task. That's the basic idea. So I have tried to make Ruby code concise and succinct.

Bill Venners: Allowing programmers to write code that's concise and succinct is one way to make them happy.

Yukihiro Matsumoto: Yes, so they can concentrate on the problem itself. Sometimes people jot down pseudo-code on paper. If that pseudo-code runs directly on their computers, it's best, isn't it? Ruby tries to be like that, like pseudo-code that runs. Python people say that too.

Bill Venners: Yes, Python people do say that Python is executable pseudo-code. What else is in Ruby to make programmers happy?

Yukihiro Matsumoto: In our daily lives as programmers, we process text strings a lot. So I tried to work hard on text processing, namely the string class and regular expressions. Regular expressions are built into the language and are very tuned up for use. We also need to call into the operating system a lot. Ruby can call every system call in Unix and most of the Windows API. This brings the power and function of the operating system to the interpretive language environment. So you can do daily systems administration and text processing programming. That's the major domain of at least my life, so I worked hard on making that good.

Bill Venners: So basically Ruby helps me enjoy my life by helping me get my job done more quickly and with more fun?

Yukihiro Matsumoto: It helps me do that. I'm not sure Ruby works for you, but I hope so.

<<  Page 3 of 4  >>


Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us