Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Before I'd read this article, I never understood why anybody liked LISP. After reading it, I was able to give LISP a fair enough shot and have since grown to like it.

It wasn't until I read this that I began to understand why some people cared about TCL.

I need an equivalent for Ruby. I can read the code. I've written a trivial amount of it. I've seen Rails. Yes, everything is an object... yes, the syntax is novel... I still don't understand why folks are so enamored with it.

share|improve this question

migrated from stackoverflow.com May 26 '11 at 0:34

This question came from our site for professional and enthusiast programmers.

2  
For me, the choice was down to user community. I was told I was an idiot for not using Twisted every time I tried to ask a question in #python. That got old. #ruby was full of friendly people. :) –  sarnold May 24 '11 at 3:28
    
Despite closing, I'm at this moment reading the Lisp article you linked to.... –  Mitch Wheat May 24 '11 at 3:32
4  
Have you tried reading _why's "why's (poignant) Guide to Ruby" - I'm not into that writing style, but you may be. –  Andrew Grimm May 24 '11 at 3:52
1  
Thanks, Andrew. That is both amusing and risks being helpful. You're my hero for the day. –  Ishpeck May 24 '11 at 5:17
1  
It takes a lot of the bad programmers away from PHP. –  Josh K May 26 '11 at 15:41
show 1 more comment

3 Answers 3

up vote 12 down vote accepted

matz himself is a nice resource for understanding the principles behind Ruby.

Ruby is the definition of beautiful code (pdf):

  • "[Code] is meant [...] to be read and understood by human beings"
  • "Beautiful code is really meant to help the programmer be happy and productive"
  • "[Ruby] is an extremely conservative programming language [because it sticks to if, while, etc...]"
  • "We often feel beauty in simple code. [...] when programs are obscure rather than comprehensible, the results are bugs, mistakes, and confusion"

Ruby is a 0.8 true language. It's not meant to be the one language that can co everything. It's not meant to be the perfect language for a specific task. It's meant to be a language that is just the right choice for most tasks :)

share|improve this answer
1  
That interview is, so far, the best document I've seen in understanding. Thanks. –  Ishpeck May 26 '11 at 19:09
1  
The "0.8 True Language" talk is better yet. –  Ishpeck May 26 '11 at 20:21
add comment

I don't have a link to a good paper on "Why you should use Ruby", but I can relate my experience from something I recently had to do. You might find it useful.

Context

When I'm trying to learn a new language, I write a simple application that solves a common problem. Its the same problem for every language (the little peg puzzle you see on tables at the Cracker Barrel restaurant). That gives me a feel for the base language and how to use it. Then, if there's a web framework for the language, I try to implement a web site in (again, the same web site for every language/framework).

Ruby/Rails

A little while ago, I implemented my website using Ruby/Rails. There was a fair amount of learning involved, but everything went fairly smoothly. When I had questions, I figured out what I needed to know and used Google to find the answer. Sure, there were lots of questions, but it was easy to identify what those questions were and to locate good answers via search. Most things just "worked as expected" one the first or second try, and it was obvious why things did/didn't work. It was a very positive experience for me.

JSP/Hibernate/Spring

A little less time ago, I decided to do the same thing using JSP, Hibernate, and Spring. I'm fairly experienced with JSP (having worked on multiple sites and services that use it, but without frameworks), but Hibernate and Spring were new to me. However, since I've worked with both ORM and MVC before (ex, Rails), I figured it shouldn't be too hard to learn the JSP version....

That, was not a good assumption. Hibernate and Spring are both very powerful. However, there are so many different types and combinations of configurations and annotations, that it's very hard to figure out what it doing what, and why. The error messages tell you what's wrong, but it's extremely difficult to figure out what question to ask to find out how to resolve the problems. Honestly, I could write a dozen pages on various things I found difficult to deal with. There was an awful lot of googling with "yeah, that's the error message, but the solution discussed uses a different type of configuration than I am, or just plain doesn't solve the problem". There was very little "look, sample code... and I can see from it what the writer is doing and why; that helps me".

Conclusion

At the end of the day, the Ruby/Rails implementation was a pleasure to work on. I learned a lot by just jumping in and trying to do what I wanted to, and then asking the questions that cropped up. The JSP/Hibernate/Spring version was... less pleasant. I felt like it would take months of working on such code just to get to the point where I knew what questions to ask when; like I'd need to be experienced on the platform just to be able to know what questions I should have for a given issue.

Note

I only recently started putting my work in SourceForge. As such there's only 2 implementations of the puzzle game (Java, Haskell) and one of the site (JSP/Hibernate/Spring, and it's nowhere near complete). I'll add the Ruby/Rails version of the site later; I have the code, but I want to remove certain parts that I used from other OS libraries and replace them with my own code. That being said, I included the links to them /shrug

share|improve this answer
    
I also learned Rails, then moved to JSP and Hibernate and agree 100%. The Java frameworks are overly complex and relatively poorly documented. –  kevin cline Jul 12 '11 at 17:26
add comment

I agree wholeheartedly with the previous answer's quotes from matz. I haven't been a programmer for very long, and I've done nearly all my programming in scripting languages. Ruby has been with me for about a year.

Here are some things I like about Ruby. Some of them might not be design principles, so forgive me. I'm sure others would chime in with more too.

  • Message passing. You mentioned everything is an object, and these objects pass messages to each other. Variable method calling based on input. (sanitized input if you're talking web applications, of course)
  • Metaprogramming is simple, readable, manageable, and encouraged.
  • Gems (libraries) are simple to write and are distributable in one command through rubygems.org.
  • Monkeypatching makes writing libraries that extend core functionality laughably easy. You can open up any class and concatenate functionality onto it or overwrite methods.
  • The standard library is broad and easy to use.
  • The standard documentation tool (rdoc) is dead simple.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.