×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

The Ruby Programming Language

samzenpus posted more than 6 years ago | from the read-all-about-it dept.

Book Reviews 172

bdelacey writes "In January 2008, just in time for Ruby's 15th birthday, O'Reilly published The Ruby Programming Language. The co-authors make a strong writing team. Yukihiro (Matz) Matsumoto created Ruby. David Flanagan previously wrote Java In a Nutshell and JavaScript: The Definitive Guide — he has a CS degree from MIT with a concentration in writing. Drawings are the work of Rubyist-extraordinaire why the lucky stiff and technical reviewers include well known Rubyists David A. Black, Charles Oliver Nutter, and Shyouhei Urabe." Read on for the rest of Brian's review.According to the Preface, Flanagan and Matz modeled this book after the K&R "white book" — The C Programming Language by Brian Kernighan and Dennis Ritchie. Like the "white book", The Ruby Programming Language has a simple structure and provides complete coverage. Just as K&R served as the de facto standard for "C", The Ruby Programming Language will likely be seen as the most authoritative language book for Ruby. Flanagan and Matz provide the following guidance for their readers:

"Because this book documents Ruby comprehensively, it is not a simple book (though we hope that you find it easy to read and understand). It is intended for experienced programmers who want to master Ruby and are willing to read carefully and thoughtfully to achieve that goal. ... [T]his book takes a bottom-up approach to Ruby: it starts with the simplest elements of Ruby's grammar and moves on to document successively higher-level syntactic structures from tokens to values to expressions and control structures to methods and classes. This is a classic approach to documenting programming languages." (p. 17)

You'll read all about boolean flip-flops, duck typing, lambdas, maps, metaprogramming, reflection and patterns of rhyming methods (collect, select, reject, and inject!). You'll also learn about new features in Ruby 1.9, like fundamental changes to text for Unicode support and the introduction of fibers fo coroutines. If it's in Ruby, it's almost certainly in this book. Chapters flow together nicely, although some could even stand on their own as educational materials for a computer science course (e.g. Chapter 7: Classes and Modules covers object-oriented programming and Chapter 8: Reflection and Metaprogramming elaborates on concepts like hooks, tracing, and thread safety).

In Ruby programming, difficult tasks are typically not only possible but often easy. It seems the authors take the same approach in their writing. For example, the complex topic of Domain Specific Languages (DSLs) sometimes creeps into deep discussions involving Ruby. Flanagan and Matz describe it simply and clearly: "A DSL is just an extension of Ruby's syntax (with methods that look like keywords) or API that allows you to solve a problem or represent data more naturally than you could otherwise." (p. 296)

During Ruby's first ten years, nearly two dozen books were in print in Japan but very few were available in English. That changed in 2004 when the introduction of Ruby on Rails created momentum for the language. A flood of new books followed, including Programming Ruby (2004, 2nd edition), The Ruby Way (2006, 2nd edition), Ruby for Rails (2006), and Learning Ruby (2007).

Programming Ruby, with lead author Dave Thomas, is self-described as a "tutorial and reference for the Ruby programming language." The Ruby Way, by Hal Fulton, was intended to complement Programming Ruby. Fulton noted: "There is relatively little in the way of introductory or tutorial information." Ruby for Rails, by David A. Black, has a clearly defined audience: "This book is an introduction to the Ruby programming language, purpose-written for people whose main reason for wanting to know Ruby is that they're working with, or are interested in working with, the Ruby on Rails framework." Learning Ruby, by Michael Fitzgerald, is a 238-page survey for "experienced programmers who want to learn Ruby, and new programmers who want to learn to program."

Programming Ruby and The Ruby Way each weigh in at over 800 pages. The binding on my copy of The Ruby Way came unglued and split in the middle after a year of use. The Ruby Programming Language is a slim, more manageable 444 pages and, in contrast, is the only one to cover Ruby version 1.9. In general, this is a great example of "less is more". Informative text boxes are sprinkled across the book with brief highlights on key technical thoughts. The first chapter's text box on "Other Ruby Implementations" (e.g. JRuby, IronRuby, Rubinius) could, however, be expanded into a several-page discussion of Ruby's various interesting architectures. Inclusion of IDEs and development tools (e.g. Eclipse, NetBeans, and TextMate) might also be helpful. These topics would nicely round out Chapter 10: The Ruby Environment.

The Ruby Programming Language has excellent cross-referencing. Section signs () feel like embedded HTML links that enable you to easily follow your coding curiosity around the book. Or you can just read it the old fashioned way, straight through. As an example, Chapter 3: Datatypes and Objects has subheadings (e.g. 3.1 Numbers) and well defined sections (e.g. 3.1.3 Arithmetic in Ruby.) The page-footers, table of contents and index also provide efficient navigational aids.

Artwork at the "edge of abstract expressionism" is something you might expect from The New Yorker magazine, but a computer book? The Ruby Programming Language introduces readers to "the edge of graphite expressionism". Original "smudgy residue" pencil drawings by why the lucky stiff creatively start each chapter.The Beatles' album cover for Sgt. Pepper's Lonely Hearts Club Band sparked intrigue and investigations into coded messages with hidden meanings. The same could happen here.

In Words and Rules: The Ingredients of Language, author Steven Pinker asks a simple question: "How does language work?" When I think about a new programming language, I have the same type of question in mind: "How does this language work?" Flanagan and Matz provide the answers in outstanding fashion. The Ruby Programming Language should help seasoned programmers who want to master Ruby. In addition, there is enough structure and sample code for determined novices to begin their programming explorations. Better than any other, this book defines the language. It is a classic and comprehensive guide for Ruby and a great 15th birthday present.

One long-time Rails developer sent me an email with their first impressions of The Ruby Programming Language: "I have been finding the book very useful, and I'm glad I did get it sooner rather than later." Matz said "Ruby is designed to make programmers happy." It looks like similar design thinking went into this book.

Brian DeLacey volunteers for the Boston Ruby Group

You can purchase The Ruby Programming Language from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered

172 comments

frist psot (-1, Offtopic)

Anonymous Coward | more than 6 years ago | (#22626776)

finally.

HEY TACO!! I'M TALKING TO YOU!! (-1)

Anonymous Coward | more than 6 years ago | (#22627120)

Come on, Taco - let's get rid of this new discussion system already. It's a PITA to use.

Oh, and this new thing with starting A/C's off with a Score: -1 isn't going to shut me up. Every time I post a comment like this, someone agrees with me, so I'm not the only one out there who feels this way. So let's stop taking lessons from the mafIAA's in assuming that everyone has corrupted morals. That's what the wonderful moderation system is for, innit?

What an appropriate CAPTCHA: unhappy. Was that calculated on your part?

Let's face it: (-1, Troll)

teknopurge (199509) | more than 6 years ago | (#22626796)

Ruby doesn't scale. Discuss.

What, it's good for RAD you say? Use something like http://wavemaker.net/ [wavemaker.net] and get RAD with Java.

Ruby: Memory issues, less scalable than Java. Lame.

Regards,

Re:Let's face it: (2, Informative)

DragonWriter (970822) | more than 6 years ago | (#22627204)

Ruby doesn't scale. Discuss.


Ruby isn't lightning fast, but its fast enough for lots of things, and its easy enough to interface with C (if you're using the main implementation) or Java (if you are using JRuby) if you need to refactor identified bottlenecks in a lower-level, higher-speed language.

As to scalability, I don't know of any particular problems with Ruby there. Green threads pre-1.9 and a Python-style GIL in 1.9 limit the ability to benefit from SMP architecture in one process on the one side, but the standard library comes with some fairly useful distribution tools. Is not, say, Erlang or Oz, but then neither is Java.

What, it's good for RAD you say? Use something like http://wavemaker.net/ [wavemaker.net] and get RAD with Java.


WaveMaker seems to offer a Web application framework and a visual builder for web apps that is tightly tied to that framework. This might be a viable Java alternative to Rails for some web applications, but its certainly not a general alternative to Ruby. And its suggests that your scalability complaint is probably similarly a misplaced reference to the various complaints (the main and most frequently cited one of which was retracted by the people making it) about the scalability of Rails, for which there are many alternatives even within the Ruby universe (Waves, Camping, Nitro, Sinatra, Wuby, etc.)

Re:Let's face it: (3, Insightful)

tcopeland (32225) | more than 6 years ago | (#22627344)

> As to scalability, I don't know of any particular problems with Ruby there.

Yup. It's strange - folks will post comments like "Ruby can't scale for a huge enterprise app!". The odd thing there is that for a huge enterprise app the opcode execution speed is probably not going to be the primary bottleneck. In fact, almost anything that reaches over a socket into a database is going to have bottlenecks that have nothing to do with how fast the Ruby interpreter can navigate an AST or set up a stack frame.

Re:Let's face it: (1)

ezzzD55J (697465) | more than 6 years ago | (#22630304)

Also, if the slowdown is a constant factor, as slow execution of interpreted languages or RTS-heavy languages are on average, then that has zero impact on scalability.

Re:Let's face it: (1)

SanityInAnarchy (655584) | more than 6 years ago | (#22627556)

Rails scales, it doesn't perform. As a language, it's impossible for Ruby to scale or not scale -- that is up to the app, unless you were going to suggest Erlang.

The difference between scalability and performance is important, and dirt-simple. And it will help you no matter what your platform is.

Re:Let's face it: (0)

Anonymous Coward | more than 6 years ago | (#22628760)

The difference between scalability and performance is important, and dirt-simple.

If the difference is so important and so simple, why didn't you say what the difference is?

Re:Let's face it: (1)

darthflo (1095225) | more than 6 years ago | (#22629076)

It usually boils down to scalability referring to the amount of memory used and performance meaning the time taken. Or, to explain it Ted Stevens Style: The computer's not a big truck you just dump something on, it's a tube of a given length and diameter. Applications are cylinders. Performant apps are flat cylinders, scalable apps are thin cylinders. A long cylinder with a big diameter will require the tube's full capacity for a long time; during which lots of big-diametered cylinders could pass thru sequentially or lots of thin, long cylinders in parallel.

Re:Let's face it: (3, Insightful)

SanityInAnarchy (655584) | more than 6 years ago | (#22630000)

It was more an invitation to RTFM, but I just realized that Google isn't helping much, and I can't find the original articles. So here's the short version:

Performance is how fast an app runs for a given amount of hardware. This is usually measured in how fast it is with respect to a single core of a single CPU.

Scalability is how well the app behaves when you just throw more hardware at it. That is, if you give it another ten CPUs and five gigs of RAM, will it be able to take advantage of that?

Ruby performance sucks. It is impossibly slow, even compared to languages like Perl or Python. I make no excuses for that. Look at the performance improvements of rails 1.9, and you'll get an idea of just how bad 1.8 is.

But Rails scales very well -- in the simplest example, the default configuration for Rails nowdays is a mongrel cluster, even on a single machine. It's a really strange and perverse design where you put a load-balancing proxy in front of at least three Rails/Mongrel webservers, each listening on a different local port. And unless you've done something stupid, this will Just Work, right out of the box.

But as long as your database server can handle it, you can just throw another server behind that load balancer. A lot of work has gone into making load balancers and database servers scalable, and you can take advantage of that, if you really need to. (For awhile, Ruby is still going to be the bottleneck.)

What this means is that I probably would not write a performance-critical desktop app (like, say, a game) in Ruby. But for web apps, it makes sense. If you can write the same app twice as fast, with half the people, you can afford to throw four times the server resources at it -- and as a bonus, you got it up in half the time as your competitor, who thought scalability == performance.

Re:Let's face it: (1)

DragonWriter (970822) | more than 6 years ago | (#22630190)

Ruby performance sucks. It is impossibly slow, even compared to languages like Perl or Python. I make no excuses for that. Look at the performance improvements of rails 1.9, and you'll get an idea of just how bad 1.8 is.


Clearly, you mean Ruby 1.9 vs. Ruby 1.8. Rails went from 1.2 to 2.0. Ruby went from 1.8 to 1.9, and in that step also switched to a bytecode compiler/VM (YARV) for a big performance improvement.

Why can't this book be free? (1)

hackingbear (988354) | more than 6 years ago | (#22626814)

Why do computer software worth less than paper-printed books? Last I check, software codes do not destroy rain forest like books.

Re:Why can't this book be free? (0)

Anonymous Coward | more than 6 years ago | (#22627006)

There is a free online version of this book. It's called Google "ruby index_word_of_topic_your_looking_for".

Re:Why can't this book be free? (1)

swimmar132 (302744) | more than 6 years ago | (#22627026)

It can't be free because the author wants to get paid for his work on it.

Re:Why can't this book be free? (4, Funny)

bladesjester (774793) | more than 6 years ago | (#22627064)

It can't be free because the author wants to get paid for his work on it.

But they can make their money selling documenta.... oh wait.

(sorry. I *had* to heh)

Re:Why can't this book be free? (1)

initdeep (1073290) | more than 6 years ago | (#22627248)

it can be "free" if you have no or very low morals.....

torrents, the new shoplifting.....

Re:Why can't this book be free? (1)

bladesjester (774793) | more than 6 years ago | (#22627342)

I really prefer paper, but I have to admit that I do try to find electronic copies of my books so I can take them with me if I'm on the road. It's sort of a pain to take a bookshelf full of paper books with you all over the place.

I wish more authors would just include a CD with the book that has an electronic copy of the book on it so I didn't have to hunt all over the place for them.

Re:Why can't this book be free? (1)

Dutch Gun (899105) | more than 6 years ago | (#22628558)

I wish more authors would just include a CD with the book that has an electronic copy of the book on it so I didn't have to hunt all over the place for them.
This really isn't up to the authors. It's up to the publisher. Take a peek at who's name is in the copyright notice.

This book can be "free", legally even... (1)

DragonWriter (970822) | more than 6 years ago | (#22627380)

it can be "free" if you have no or very low morals.....


It can also be "free" (of marginal financial cost) if you subscribe to Safari.

Re:Why can't this book be free? (0)

Anonymous Coward | more than 6 years ago | (#22627034)

Why do computer software worth less than paper-printed books? Last I check, software codes do not destroy rain forest like books.
Last I checked, using proper verb tense doesn't destroy rain forests either...

Re:Why can't this book be free? (0)

Anonymous Coward | more than 6 years ago | (#22627220)

Books don't either.

Re:Why can't this book be free? (1)

chromatic (9471) | more than 6 years ago | (#22627610)

Why do computer software worth less than paper-printed books?

It's somewhat easier--and consequently cheaper--to make a bit-perfect duplicate of a piece of software than a physical book.

Re:Why can't this book be free? (0)

Anonymous Coward | more than 6 years ago | (#22628800)

why you write like china man?

Re:Why can't this book be free? (1)

Unoti (731964) | more than 6 years ago | (#22629070)

Why do computer software worth less than paper-printed books? Last I check, software codes do not destroy rain forest like books.
Every computer language I've ever learned since BASIC I learned initially by reading in the bathroom, or while taking a break outside at work. Paper has always had the upper hand there over electronic, and will continue to have the upper hand there for a few more years.

The ruby programming language (0)

Anonymous Coward | more than 6 years ago | (#22626824)

Is very much like smalltalk. The remainder of this book has been intentionally left blank.

Huh? Is this the "new" English? (1)

smooth wombat (796938) | more than 6 years ago | (#22626872)

Drawings are the work of Rubyist-extraordinaire why the lucky stiff and technical reviewers include well known Rubyists David A. Black, Charles Oliver Nutter, and Shyouhei Urabe.


Error parsing sentence. Unable to comprehend.

Is this like the use of the word "your" instead of the correct "you're" as seen in more and more sentences, including a graphic on MSNBC.

Sorry, I'll stick to the old three score and twain. That's 62 in the "new" math.

Re:Huh? Is this the "new" English? (5, Informative)

farker haiku (883529) | more than 6 years ago | (#22626998)

Let me parse it for you.

Drawings are the work of Rubyist-extraordinaire "why the lucky stiff" [whytheluckystiff.net] and technical reviewers include well known Rubyists David A. Black, Charles Oliver Nutter, and Shyouhei Urabe.

The rest of it should be passable English.

Re:Huh? Is this the "new" English? (0)

Anonymous Coward | more than 6 years ago | (#22627722)

Thank you!

Thanks for the review! (5, Informative)

davidflanagan (645311) | more than 6 years ago | (#22626892)

Thanks for the kind review Slashdot! Thanks, Brian!

You can browse the table of contents of the book and read the beginning of each section at O'Reilly's website [oreilly.com].

You can find another review of the book at rubyinside.com [rubyinside.com]

Re:Thanks for the review! (1)

_14k4 (5085) | more than 6 years ago | (#22627512)

Having just started with Ruby, after Perl and Java and the usual collection of others... I must say that Ruby is a total relief. I actually have this "child like" joy with Ruby programming for simple things, complex things, and things in between. On that note, my oldest is working on his first program, in Ruby, and it's coming alone nicely...

Re:Thanks for the review! (1)

scragz (654271) | more than 6 years ago | (#22629346)

For anyone else with programming-inclined progeny, take a look at one of why's other projects, Hackety Hack [hacketyhack.net]. It's an interactive Ruby environment for beginners.

In the 1980s, a language called BASIC swept the countryside. It was a language beginners could use to make their computer speak, play music. You could easily draw a big smiley face or a panda or whatever you like! But not just BASIC. Other languages like: LOGO and Pascal were right there on many computers.

In this century, you may have dozens of programming languages lurking on your machine. But how to use them?? A fundamental secret! Well, no more. We cannot stand for that. Hackety Hack will not stand to have you in the dark!!

Re:Thanks for the review! (1)

almiray (82902) | more than 6 years ago | (#22627844)

David, I love your Java & JavaScript books, on your latest Ruby book: Where is the testing chapter? its 2008, unit testing is an old meme (According to Alberto Savoia in 2004), dynamic languages are very expressive but also require more thought process, which means testing should be second nature to people working with them.

I can't see a testing reference from the TOC, I hope there is something (meaningful) related to it included in the book, if not then I'm sad to say this book will help little to the next generation of Rubyists.

Re:Thanks for the review! (3, Informative)

davidflanagan (645311) | more than 6 years ago | (#22628012)

almiray, As its title implies, this book is strongly focused on the language itself. It includes one (long!) chapter on the core platform, but it hardly touches on the standard library. Since Ruby's testing frameworks are not part of the language or of the core API, I do not cover them. That doesn't mean that they're unimportant, just outside of the scope of this book. This is not a book about programming methodologies, or about web application development, or about design patterns. But it does cover the Ruby language in detail.

Re:Thanks for the review! (2, Interesting)

pileated (53605) | more than 6 years ago | (#22628762)

Well whilst the author is here, and while I'm part way through the book, let me ask a couple of questions. I should preface this by saying that I think Javascript the Definitive Guide made me hate Javascript all the more, while Java in a Nutshell and Java Examples in a Nutshell seemed to exemplars of good programming books. So needless to say I've puzzled over David's writing over the last few years. Why do I have such mixed feelings about books by the same author? I still don't know but maybe the following questions will help.

I was reading along today when I came to this: "Assignment to a constant that already exists causes Ruby to issue a warning. Ruby does execute the assignment, however, which means that constants are nor really constant." Now this is a bit of a surprising statement. Isn't this an elephant in the room? Shouldn't it get more of an explanation?

A few pages further on, while discussing parallel assignment, we get this: "a,(b,(c,d)) = [1,[2,[3,4]]] # Parens: a=1; b=2;c=3;d=4". Now I can figure out what is happening and what the book is trying to explain. But at the same time the book seems to ignore a second elephant in the room. Why in the world would someone ever write just a difficult to comprehend statement? Is is a common Ruby idiom? If so might it not be wise to offer some explanation of why it's an idiom?

As I think back on what I've read by David, and I realize I'm sort of leaving Matz out right here and don't know how much of the writing is his, I think I see a sort of matter of factness to it. My recollection of Ruby for Rails is that it is much more interested in explaining some of the odder parts of Ruby and Rails. Perhaps the authors just prefer a matter of fact style and figure that readers can go elsewhere for a explanation of what seem to me to be rather odd elements of Ruby?

I don't say this as a criticism but really more of a question. Don't the two examples I cite seem sort of odd? If so could someone explain why they are not explained any further. Is that not the intent or style of the book? If the answer to the last is true I think that's fine. All authors write in the way that best suits them. But I ask out of curiosity. If that is the case I think it might give other readers a better clue as to what to expect from the book. Some will like the matter of factness; while others probably would like something else to augment it.

And one last, sort of unrelated question: is anyone else disappointed by the drawings? When I read that the book would be illustrated by whytheluckystiff I thought that this would make a probably good book even better. But I find them very disappointing and far less visually interesting than what can be found on whytheluckystiff's web site.

Re:Thanks for the review! (5, Informative)

davidflanagan (645311) | more than 6 years ago | (#22629012)

Well whilst the author is here, and while I'm part way through the book, let me ask a couple of questions. I should preface this by saying that I think Javascript the Definitive Guide made me hate Javascript all the more, while Java in a Nutshell and Java Examples in a Nutshell seemed to exemplars of good programming books. So needless to say I've puzzled over David's writing over the last few years. Why do I have such mixed feelings about books by the same author? I still don't know but maybe the following questions will help.
Have you read the JavaScript book recently? The 5th edition is an improvement over the fourth... It is different than Java in a Nutshell--simply because it is a "definitive guide" rather than a "nutshell". This Ruby book is probably more like my JavaScript book than my Java books, so if you end up liking it well enough, maybe you'll give the JavaScript book another chance :-)

I was reading along today when I came to this: "Assignment to a constant that already exists causes Ruby to issue a warning. Ruby does execute the assignment, however, which means that constants are nor really constant." Now this is a bit of a surprising statement. Isn't this an elephant in the room? Shouldn't it get more of an explanation?
Frankly, I don't know the reason that constants are not constant. I could have pressed Matz to enlighten us on this point, but I suspect that the answer is not a simple one and would have been difficult to explain. In earlier drafts of the book I did actually draw attention to these rough spots in the language because they did, indeed, seem strange to me. As I spent more time with Ruby, however, I came to appreciate it more, and re-reading my drafts I felt I was being unnecessarily critical of the language I was documenting. So, as you surmise, I was left just being matter-of-fact about it.

A few pages further on, while discussing parallel assignment, we get this: "a,(b,(c,d)) = [1,[2,[3,4]]] # Parens: a=1; b=2;c=3;d=4". Now I can figure out what is happening and what the book is trying to explain. But at the same time the book seems to ignore a second elephant in the room. Why in the world would someone ever write just a difficult to comprehend statement? Is is a common Ruby idiom? If so might it not be wise to offer some explanation of why it's an idiom?
This is not a very common idiom, nor is it even very well known. The particular line of code you cite is, of course, extreme: I'm taking the destructuring parallel assignment syntax to an unreasonable level of nesting to test the reader's understanding of the concept. Its not a common idiom, but it is part of the language, so I document it. It actually seems pretty cool to me, not really an elephant in the room. In this case, were I writing a less formal book, I might have commented on how cool it is. In the same way, in a less formal book, I could have commented on how strange it is that constants can have their values changed.

And one last, sort of unrelated question: is anyone else disappointed by the drawings? When I read that the book would be illustrated by whytheluckystiff I thought that this would make a probably good book even better. But I find them very disappointing and far less visually interesting than what can be found on whytheluckystiff's web site.
Please keep in mind that we had to get these drawings through the internal bureaucracy at O'Reilly--we were asking a lot of the production and design teams to include them. I shouldn't speak for _why, but I think his goal for these drawings was to keep it mellow, and to be stylistically distinct from his work for the Poignant Guide [poignantguide.net].

Re:Thanks for the review! (1)

pileated (53605) | more than 6 years ago | (#22629190)

Thanks for the detailed response David. If I do need to use Javascript again (I currently don't) I'll take a look at the new edition. I must say I'm very fond of the newest Java in a Nutshell and Java Examples in a Nutshell.

I suppose what I've written are more questions about the style of the book than anything else and I think you've answered them well. I hope they'll be useful to other potential readers of the Ruby book. And I look forward to finishing it myself.

I realize that my comments on the drawings might seem like needless criticism and I certainly don't want to be critical. On the other hand I just went back to whytheluckystiff's web site to see the drawings again and I'm more impressed than ever by them. So I was hoping for something special in the drawings for the book. I ended up being a little disappointed. Maybe they'll grow on me, and if not there's always the web site..........

Thanks again for your response.

Re:Thanks for the review! (1)

DragonWriter (970822) | more than 6 years ago | (#22629930)

I was reading along today when I came to this: "Assignment to a constant that already exists causes Ruby to issue a warning. Ruby does execute the assignment, however, which means that constants are nor really constant." Now this is a bit of a surprising statement. Isn't this an elephant in the room?


In the context of Ruby, where "private" methods and instance variables are just a wee bit harder to get at rather than actually private, not enormously, though it would probably be cleaner (and consistent with how private methods, etc., are handled) if a "normal" assigment to an assigned constant raised an error, but there was a special method call that could be used to get around it.

Shouldn't it get more of an explanation?


What else is there to say to explain it? I mean, I could see providing an example where taking advantage of the fact that it only produces a warning rather than blowing up might be useful (if you can construct one), but as far as explaining, what more is there to say?

A few pages further on, while discussing parallel assignment, we get this: "a,(b,(c,d)) = [1,[2,[3,4]]] # Parens: a=1; b=2;c=3;d=4". Now I can figure out what is happening and what the book is trying to explain. But at the same time the book seems to ignore a second elephant in the room. Why in the world would someone ever write just a difficult to comprehend statement?


I would guess the only reason for anything that complicated in a multiple assignment would be because the author was writing a book using a needlessly complicated case to illustrate how the feature functioned so that people could understand the feature, even though they would never, ever, use it that way in practice.

At least, I hope so.

Is is a common Ruby idiom?


I've rarely seen a multiple assignment much more complex than the simple swap case ("a, b = b, a") in Ruby; I don't think anything remotely like that example is common.

As I think back on what I've read by David, and I realize I'm sort of leaving Matz out right here and don't know how much of the writing is his, I think I see a sort of matter of factness to it. My recollection of Ruby for Rails is that it is much more interested in explaining some of the odder parts of Ruby and Rails. Perhaps the authors just prefer a matter of fact style and figure that readers can go elsewhere for a explanation of what seem to me to be rather odd elements of Ruby?


As I recall, K&R is pretty matter-of-fact, too, and that's what the authors held out as their model. Really, I'm glad that The Ruby Programming Language is different in its tone and approach from The Ruby Way, Programming Ruby, and Ruby for Rails, because we already have those books, and they do what they do pretty well.

I love Ruby (0)

Anonymous Coward | more than 6 years ago | (#22626912)

I have a ruby red palm from jacking it to pictures of Kathleen

Trash (-1, Troll)

bluefoxlucid (723572) | more than 6 years ago | (#22626922)

Having used Ruby, I can say it's trash.

Re:Trash (4, Insightful)

dedazo (737510) | more than 6 years ago | (#22627128)

You're going to get modded as troll here, but I think there's been a huge backlash against Ruby lately (just read programming.reddit.com once in a while), and rather than blaming the language or the toolset itself I think the problem is that it was so excessively hyped (mostly because of Rails) that whenever people find a problem somewhere then the whole thing is declared as lacking.

Personally I don't like Ruby, but that doesn't mean the language is not good. It has some interesting syntactic sugar. And Rails didn't really invent anything new. MVC and ActiveRecord for example had been done to death before, but it packaged them in an attractive and simple little box with a nice glue language that made 80% of building a web app simple. It's always the remaining 20% that's hard, and I think Rails was not designed well enough to enable developers to jump the last hurdles. Much of the criticism I've read in the past few months about Rails is related to problems with how the public Rails API is designed and how too many developers are using runtime hacks to extend objects instead of having sane, language-specific inheritance/override methods for extension purposes. Again, nothing to do with Ruby the language, but you can't reall discuss Ruby without Rails because in the real world it's what currently drives its adoption. I doubt many people are writing desktop apps with it.

Let this be a warning to framework designers: your language, runtime and toolset better match the amount of hype you pile on your work. It's not good enough to have a cool language to go along. The popular Perl (Mason, etc), Python (Django, etc) and PHP frameworks prove it can be done.

Re:Trash (0, Redundant)

Foofoobar (318279) | more than 6 years ago | (#22628044)

Yeah RUBY devs will definitely MOD you as troll but the fact is you are right. The hype was far greater than the language could deliver and the fanboi's made it worse as they cannot face the limitations of the language. I mean no language is perfect and they all have serious flaws but for some reason RUBY devs think they are immune to criticism which seems to make it a bit worse.

I have sympathy for your loss of mod points due to others ignorance.

closet collectivist (1)

epine (68316) | more than 6 years ago | (#22629322)

The hype was far greater than the language could deliver and the fanboi's made it worse as they cannot face the limitations of the language.
Almost every serious book begins with a preface where the author praises his/her primary sources and then concedes "all the errors are my own".

Yet when random, excitable, anonymous forum-crawlers hype a software concept or language, if the hype doesn't come true, it's now the fault of the software. Isn't that an implicit form of collectivism? The entire Ruby community is smeared by hype generated from no particular quarter?

I've always had a soft spot for Perl 6. The engines of hype briefly chuffed into action, but then ... nothing ... as the Perl 6 initiative safely retreated into their hype-impervious cocoon of "maybe never". They must positively revel in their obscurity.

AI as a discipline has been forever tainted by some excitable fellows at MIT in the 1950s who fed the press what the press wanted to hear in the era of grandiosity leading into the space program.

No, actually, I simplified that. The whole discipline of AI has been forever tainted because millions of people *who ought to know better* refuse to forget what a couple of excitable guys once told the media back in the 1950s. The technological sophistication of the average journalist in the 1960s: "you mean like the Jetsons?" or "you mean like HAL?" In actual fact, improvements in computer chess was incremental and mostly linear. The correct answer in 1960 was "check back in about 40 years when the computers are a billion times faster and the software has become 100-fold more sophisticated". What actually happened: the journalist looked at the guy wearing dark-framed glasses, with a slipstick in his pocket protector, and said to himself "that's as close to sex as that guy will ever get, now who can I interview I can actually quote?" Our collective memory for accurate predictions: the 10ms time slice it takes our brain to write-off a social loser.

Hype itself is a short-term problem. The credence given to that hype (actually, the credence given to the obvious and unsurprising fact that the hype was hopelessly stupid) continues to cloud matters for decades afterward.

http://xkcd.com/386/ [xkcd.com]

With hype, it's even worse: someone with no credibility whatsoever in the first place (a pimply "fanboi" in an excitable moment) once made unrealistic claims about the future greatness of a new and unproven programming language (these predictions always work out), but my god, let's not ever forget this incident, as it must necessarily continue to shape and constrain the debate forever after.

Ruby has managed to survive the hype. Even more impressive, Ruby has managed to survive the people who won't forget the original hype and its excesses (but are strangely reluctant to name the parties responsible).

It's quite the impressive feat for a language to thrive under such a burden. I don't know a whole lot about Ruby, but given those facts, deep down it must be pretty good.

Re:Trash (1)

crayz (1056) | more than 6 years ago | (#22628200)

Yeah, I feel really sorry for Ruby [indeed.com]

Re:Trash (3, Insightful)

DragonWriter (970822) | more than 6 years ago | (#22630120)

Much of the criticism I've read in the past few months about Rails is related to problems with how the public Rails API is designed and how too many developers are using runtime hacks to extend objects instead of having sane, language-specific inheritance/override methods for extension purposes. Again, nothing to do with Ruby the language


Actually, the absence of features for explict overriding (vs. implict overrides as the default) is something to do with Ruby the language (just like dynamic rather than static typing, etc. are inherent to Ruby as a language.)

OTOH, the complaints about "monkeypatching" are pretty much just a variation on the complaints about dynamic typing: "the language doesn't bind your hands enough, and someone else might do (or has done) something I don't like that was enabled by that."

Fine, look, everyone knows where to find Java and C if they need them. Beyond that, if you don't like the way the Rails team (or certain third-party plug-in writers) have used the power to reopen classes and objects, its not like there aren't plenty of other Ruby web application frameworks, ORM solutions aside from ActiveRecord, and libraries available for most uses in Ruby. Maybe the one library you really want was programmed by someone whose ideas about how best to use the language don't match yours, but that's possible with any language no matter what features it has. If you want code written to your specs, you've either got to write it yourself or pay someone else to do it for you, and complaining about a language because someone has used it to write a library using techniques you don't like isn't going to solve anything.

but you can't reall discuss Ruby without Rails because in the real world it's what currently drives its adoption.


I dunno, I find it pretty easy to discuss Ruby without Rails. Rails is certainly the framework that made Ruby really visible in the US (though I gather it was fairly popular in Japan even before Rails), but I think that as it is getting exposed, the size of the non-Rails Ruby community compared to the Rails segment is probably growing.

I doubt many people are writing desktop apps with it.


I would imagine that if there weren't quite a few people doing that, you would have fewer GUI toolkits for it. And, of course, its also useful for system scripting; not every programming task is about a big app, whether web or desktop.

hyperbole (1, Interesting)

Anonymous Coward | more than 6 years ago | (#22626956)

"The Beatles' album cover for Sgt. Pepper's Lonely Hearts Club Band sparked intrigue and investigations into coded messages with hidden meanings. The same could happen here. "

ummm talk about bringing something in completely out of the blue.....yes, I'm sure this programming book will be very similar to Sgt. Peppers......
Besides, what exactly is "intrigue and investigations into coded messages....."? Will we all start deciphering treasure maps? Or perhaps purchasing books of arcane linguistic rules which allow us to manipulate complex electronic devices? Or has that already occurred? At least introduce some sort of musical/artistic metaphor theme in the beginning so this attempt to inspire some sort of creative dynamism isn't entirely bizarre. And can't we give the Beatles a rest? Do the Beatles always have to be the standard [creative reference] insert that brings up all the untrammeled free market capitalism + technology = wonderfulness tech-geek ideological koolaid shit? /end rant.

Other than that I find the review to be useful and thorough-sounding though not entirely critical (as in analytic i guess)...

Ruby Saved Us From Perl (1)

Anonymous Coward | more than 6 years ago | (#22626970)

I can't believe our company at one time actually had a good portion of our tools written in Perl. Those were the dark days back before Ruby.

Ruby has been a godsend. Clean, clear, powerful and maintainable.

Re:Ruby Saved Us From Perl (2, Interesting)

cmdr_tofu (826352) | more than 6 years ago | (#22627238)

Please mod the parent up. I am a fellow PERL->Ruby convert. While PERL always has a soft spot in my heart and has one of the best communities in the world, Ruby really is an *easier* language. It is clean, simple and extremely easy to write readable code. I am not a Rails expert, but for sysadmin stuff, Ruby and Python are great alternatives to PERL.

Re:Ruby Saved Us From Perl (1)

failedlogic (627314) | more than 6 years ago | (#22628322)

I wanted to ask a question related to this, and yours is the perfect response! ;)

I've looked at the Ruby syntax through a couple of books in the bookstore and from what I saw, I liked it a lot. For most stuff I want to do, Reg Ex, SQL Database search/output and Unix shell stuff, Ruby seems like a substantially easier language as you mention. I think C or C++ would be more complex than what I need and I never quite wrapped my head around why Perl is written the way it is. I haven't looked much at Python or similar languages.

As it sounds like you're doing some (or all) the things in Ruby that I'll ever need and are not using Rails, is Ruby the "best" alternative, or is there another language all-purpose I should look into? Please bear in mind as I ask this that I'm not an I.T. worker and don't have a comp-sci degree. I'm just looking for some efficient ways of automating some tasks I need to do or do everyday and would rather use a program than a GUI. :)

Re:Ruby Saved Us From Perl (0)

Anonymous Coward | more than 6 years ago | (#22628454)

Ruby really is an *easier* language. It is clean, simple and extremely easy to write readable code.
I don't believe you. There is a language that is easier to write readable code than Perl??? It must really wtfpwn Perl if it is that good.

Re:Ruby Saved Us From Perl (1)

mikehoskins (177074) | more than 6 years ago | (#22629656)

I, too, am a Perl to Ruby Refugee (tm) and I don't ever want to go back, in spite of the positives of (shudder) Perl. I spent 12 years in solitary in a Perl Prison. (OK, I exaggerate the pain a bit).

I have tried (strived) to write (and clearly document) Perl code and still have a harder time reading "well written" Perl that *I* wrote than (almost) anybody's Ruby code, not being a Ruby expert (yet).

Try reusing Perl code, outside of stuff written to be part of a Perl Module (.pm). Blech.

Anyway, rather than merely cursing the darkness, I suggest that Rails is a terrible way to learn Ruby. Rails is so much of a DSL that it hides Ruby underneath. It makes Ruby seem very web-centric and people don't realize that there's a quite stunningly elegant programming language underneath all of that (albeit) nice Rails DSL (Domain-Specific Language).

Is Rails nice, too? Yes, from what I've seen, but it made me say "what is that?!?!?" every time I tried to take up Ruby, when Rails was part of the equation.

"Plain Jane Ruby" on its own, is not hard to pick up, for Perl programmers. RoR might be, however, until you understand Ruby, itself and understand metaprogramming/DSL's. DSL's let you mold Ruby into something else that you'd like Ruby to be.

Learning from a DSL, like Ruby on Rails (RoR), muddies the water for quite awhile.

Re:Ruby Saved Us From Perl (2, Funny)

Hognoxious (631665) | more than 6 years ago | (#22628904)

Are you saying it's impossible to write readable code in perl?

I'm not saying you're wrong but I don't think we can really be 100% sure until someone actually tries.

Re:Ruby Saved Us From Perl (0)

Anonymous Coward | more than 6 years ago | (#22629594)

My company relies on Perl for running its unix systems.

As long as you use Perl for what it's intended and don't try to be too smart, then it's generally readable.

At least, that's my opinion as a C++ developer having to read other people's randomly placed scripts every couple of days.

Coroutines (1)

Simon (S2) (600188) | more than 6 years ago | (#22626994)

Did someone here actually use callcc for something "real" in production code that could not be done someway else or was best implemented with callcc? For what? Can you make an example? I am really just curious (personally I love callcc, but only ever used it as a style exercise).

Re:Coroutines (2, Funny)

sfraggle (212671) | more than 6 years ago | (#22627180)

You can use it to implement [soulsphere.org] the Intercal COME FROM [wikipedia.org] statement. No serious modern programming language should be without this feature.

Re:Coroutines (1)

Simon (S2) (600188) | more than 6 years ago | (#22627432)

This is actually the coolest thing ever :)
I didn't know about COMEFROM. This is pure genius:

$ cat test.rb
require 'comefrom.rb'
 
come_from 'a label'
puts 'hello'
label 'a label'
 
$ ruby test.rb
hello
hello
hello
hello
hello
hello
hello
hello
...

Re:Coroutines (1)

pnewhook (788591) | more than 6 years ago | (#22628010)

didn't know about COMEFROM. This is pure genius:

Why is joke syntax genius?

Re:Coroutines (1)

Simon (S2) (600188) | more than 6 years ago | (#22628240)

Why is joke syntax genius?

Just because it remained me the old times... you know

10 PRINT "I am the coolest guy"
20 GOTO 10
Making it the other way around is funny and brilliant.

Re:Coroutines (0)

Anonymous Coward | more than 6 years ago | (#22628630)

How can that be "the coolest thing ever"? Isn't Brad Pitt making movies any more?

Re:Coroutines (0)

Anonymous Coward | more than 6 years ago | (#22629484)

Why is joke syntax genius?
Go back to Java.

Re:Coroutines (3, Insightful)

krog (25663) | more than 6 years ago | (#22627508)

Call/cc can become useful in web applications where you have a batshit insane workflow. Seaside [seaside.st], the Smalltalk web framework, bets the farm on it. It's in other places like Perl's Jifty too.

Most of the web apps I write wouldn't benefit from this sort of treatment, so I haven't jumped in too far, but call/cc has its uses for sure.

Re:Coroutines (1)

Abcd1234 (188840) | more than 6 years ago | (#22628084)

Just to be clear, Seaside isn't "batshit insane". :) Frankly, I love the way it works... will it be the Next Big Thing (tm)? I have no idea... I don't even know if it's really a good idea in the long run. But it should makes building stateful transactions in the stateless world of the web incredibly easy.

Re:Coroutines (1)

krog (25663) | more than 6 years ago | (#22628142)

I never said Seaside was batshit insane, only the workflows of the apps which are well-suited to it. Seaside isn't insane, it's just esoteric.

Re:Coroutines (1)

Abcd1234 (188840) | more than 6 years ago | (#22628182)

Actually, I would disagree. In traditional webapps, we build systems that are stateful and transaction oriented. Thus is fundamentally a consequence of the way the web works. Basically, the nature of the web has dictated how we build our systems. Seaside, OTOH, allows one to build apps in a much more straightforward manner. Workflows with the user are, in code, represented as just that. Workflows. It is, I think, a much cleaner way to look at the problem.

But, we are getting off the topic, here, which is, of course Ruby. OTOH, I think Ruby is just Smalltalk's bastard, warped stepchild, so maybe it's not so off-topic after all. ;)

Re:Coroutines (1)

krog (25663) | more than 6 years ago | (#22628814)

In traditional webapps, we build systems that are stateful and transaction oriented. Thus is fundamentally a consequence of the way the web works.

Not so fast! I think you trivialize how well 90% of websites fit into a stateful, transaction-oriented architecture -- especially when hosting and serving requirements are factored in. I don't think that's a consequence of the way the web works, but rather the opposite; I think the way the web works is a consequence of the tools that power most of it.

Of course Seaside is not limited to crazy workflows and such; it just gets its chance to shine in situations like that, because the 90% solution falls apart quickly.

But, we are getting off the topic, here, which is, of course Ruby. OTOH, I think Ruby is just Smalltalk's bastard, warped stepchild, so maybe it's not so off-topic after all. ;)

Smalltalk has so many children! Ruby and Objective-C are my favorites, but in general, I'm happy to see pure message-passing semantics wherever I run across them.

Continuation-based web frameworks and Ruby (1)

DragonWriter (970822) | more than 6 years ago | (#22630258)

But, we are getting off the topic, here, which is, of course Ruby.


To bring it back on topic, there is a Ruby continuation-based web application framework (Borges [rubyforge.org]) that is (or began as) a port of Seaside 2 to Ruby.

Uses of continuations in the real world (1)

MarkusQ (450076) | more than 6 years ago | (#22628348)

Did someone here actually use callcc for something "real" in production code that could not be done someway else or was best implemented with callcc?

I don't have the code for either handy, but I've used it to implement an asynchronous discrete event simulations environment (loosely based on DEMOS [demos2k.org]) and a stateful-backtracking set up for intertwining syntax and semantics in a natural language system.

In the first case, a multi-threaded version has proved easier to maintain, and in the second case Moore's law caught up with me and it's now reasonable to just compute everything and not worry about the backtracking at all.

--MarkusQ

Another good book to pick up... (2, Informative)

tcopeland (32225) | more than 6 years ago | (#22627114)

...if you're doing Rails apps is Advanced Rails [oreilly.com] by Brad Ediger. It's got a ton of helpful hints on all sorts of things - sessions, memcached, how Rails uses Ruby's dynamic features, how plugins work, how to do complex associations, details on REST, etc etc.

The nice thing is that he doesn't fool around with explaining the simple stuff that you know already if you've done even one Rails app; he gets right down to business. Of course there are always interesting gotchas [blogs.com], but this is a book every Rails developer should have.

Ruby 1.9 and Programming Ruby (1)

DragonWriter (970822) | more than 6 years ago | (#22627278)

The Ruby Programming Language is a slim, more manageable 444 pages and, in contrast, is the only one to cover Ruby version 1.9.


This is true of the dead-tree editions of the three major books you list, though it may be worth noting that the 3rd Edition of the Pickaxe (Programming Ruby) is currently available (in PDF) as a beta book and covers Ruby 1.9.

Re:Ruby 1.9 and Programming Ruby (1)

Peter Cooper (660482) | more than 6 years ago | (#22627552)

That it does, but it's not as good as this one.

Re:Ruby 1.9 and Programming Ruby (1)

DragonWriter (970822) | more than 6 years ago | (#22628058)

That it does, but it's not as good as this one.


The Ruby Programming Language is a great book, from what I've seen of it (I've read a bit on Safari), but I still like Programming Ruby (and The Ruby Way and Ruby for Rails -- a great general Ruby book that doesn't have as strong a Rails focus as the name might suggest -- even though neither of those two has yet been updated for 1.9), too. I wouldn't particularly want to do without any of them, though if I had to choose only one right now, I might lean toward The Ruby Programming Language. But, fortunately, I don't have to choose only one.

David Flanagan (1)

drgroove (631550) | more than 6 years ago | (#22627318)

David Flanagan is responsible for writing O'Reilly's old, unreadable JavaScript books... not a lot of confidence that he did much better on Ruby. If an O'Reilly book has been written by Flanagan, I don't buy it.

Re:David Flanagan (1)

davidflanagan (645311) | more than 6 years ago | (#22627734)

"Unreadable" is a pretty subjective opinion. If you didn't like JavaScript: The Definitive Guide, then you probably won't like The Ruby Programming Language, either. But many people do like my JavaScript book and consider it the definitive book on the language. I've tried to do the same for Ruby in this book.

collect, select, reject, and inject (4, Funny)

A nonymous Coward (7548) | more than 6 years ago | (#22627460)

Sounds like they should have listed Arlo Guthrie as co-author.

I bet mods don't get the reference and mark me down.

Re:collect, select, reject, and inject (0)

Anonymous Coward | more than 6 years ago | (#22629186)

Ruby takes those method names from Smalltalk. I believe Dan Ingalls created the names of those methods in Smalltalk and was inspired by Alice's Restaurant. I believe I remember that from a post on Squeak-dev back in the 1990s.

But does it scale? (0)

Anonymous Coward | more than 6 years ago | (#22627492)

Mmm. Duck typing and superficially nice code.

Ruby. Fast, Reliable, Cheap - Pick 1.

fuc4 a s4onge (-1)

Anonymous Coward | more than 6 years ago | (#22627542)

Posts on Usenet are bring your own feel obligated to the NetBSD project,

Ruby book (0)

Anonymous Coward | more than 6 years ago | (#22627566)

Two words Common Lisp.

NEXT!

Give me a hard problem here, people, COME ON!

BTW Slashdot's comment system sucks donkey balls. Probably it is implemented in Ruby.

(LOL, v-word == "buries")

Which to learn first: python or ruby? (0)

Anonymous Coward | more than 6 years ago | (#22628334)

I'm a programmer and for some time now I want to learn both Ruby and Python.
Due to real-life time constraints I believe I'll manage to master only one in the near future.
Which one should I learn first? Do you think the order matters? Which one will bring a more immediate benefit to me? Maybe I should learn Ruby now and wait for Python3000?
What are your thoughts on this?

Re:Which to learn first: python or ruby? (3, Informative)

sciurus0 (894908) | more than 6 years ago | (#22628880)

There are more free resources for learning python.
http://docs.python.org/tut/
http://diveintopython.org/
http://www.swaroopch.com/byteofpython/
http://openbookproject.net/thinkCSpy/
http://www.greenteapress.com/thinkpython/
http://en.wikibooks.org/wiki/Non-Programmer's_Tutorial_for_Python

Re:Which to learn first: python or ruby? (3, Funny)

codepunk (167897) | more than 6 years ago | (#22628988)

Depends if you ever want to learn ruby or not?

Once you learn python you ain't gonna get past hello world in ruby. You will
sit there, look at the syntax and say what the hell do I want to learn this for.

Re:Which to learn first: python or ruby? (1)

mooingyak (720677) | more than 6 years ago | (#22629156)

It's all a matter of taste. I felt the exact opposite way when looking at the two languages.

I'd take either one in a heartbeat over perl though.

Re:Which to learn first: python or ruby? (2, Insightful)

mikehoskins (177074) | more than 6 years ago | (#22629470)

I agree. I'm having the same issue. In learning Ruby, I don't want to go past "Hello, World!\n" in Python, for exactly the same reasons.

After 12 years of Perl, though, I hope I'm done with it. Either Ruby or Python are going to take you far as a programmer, since both languages are modern and elegant, in different ways. Perl 5.x is like BASIC, in that it teaches you bad habits.

Ruby does have a sense of enlightenment, though. I can't comment about Python, concerning this aspect. It seems that its "Lispiness" gives you a sense of "Aha" quite often. I feel that I am learning a lot about comp sci using Ruby that I never got in C, C++, Assembly, Perl, or PHP. All languages gave me an occasional "Aha" moment, but not as often as Ruby (combined, maybe). This is part of the fun, IMHO.

I am no Rails user, either. I'm currently limiting myself to straight Ruby and JRuby. I'm doing "pure shell scripting" and tiny apps.

The whole ideas of DSL's and Metaprogramming and the fact that "everything is an object" (like Smalltalk but not like C#/Java) are way cool and modern. These concepts are changing the way I think about programming in ways Perl couldn't. To my dismay, every full-time Perl developer I talk to (so far) isn't convinced "unless there are lots of Ruby jobs."

I could be wrong, not actually learning much about Python (donning asbestos suit), but I feel that Ruby is a more powerful, more elegant language than Python, for most problems at hand (but certainly not all). Python, on the other hand, is more mature (including speed) and has more code libraries. Both are incredibly powerful and elegant, however, and are worth learning. (I may pickup Python some day, myself).

I'm not really commenting much on PHP at this time, having had several years in this (mostly web) scripting language. Perl is more directly comparable to Ruby and Python.

Whatever you pick, both languages have a C (native) version and have active Java and .net projects (both compiled and interpreted). This, in and of itself, has the potential to help overthrow Perl and PHP as rulers of the scripting universe. Who knows?

Pick one and consider taking a look at the other. Ruby is really fun, for most everyone who has sat down and really tried it. I assume Python can say much of the same.

I picked Ruby, for now, and have (mostly) not been disappointed.

Re:Which to learn first: python or ruby? (1)

cabazorro (601004) | more than 6 years ago | (#22629892)

I don't know python but if you can do something as succinct as

myList = []
10.times do |i|
      mList.push(i)
end
myList.each do |l|
      puts l
end

Again it is not about Rails of structuring things, Is the organic aspect of the language that works as an extension of your action with so little translation/morphing. With Ruby, my actions are more transparent. With Ruby I see the actions, not the syntax, which is what I want. Now, If this looks very similar to Python, great. I heard that python requires you to count your spaces, that stopped me right on the start. Cheers.

Re:Which to learn first: python or ruby? (2, Interesting)

DragonWriter (970822) | more than 6 years ago | (#22629966)

Once you learn python you ain't gonna get past hello world in ruby. You will
sit there, look at the syntax and say what the hell do I want to learn this for.


I learned Python pretty much immediately before learning Ruby, and I personally find Ruby more attractive, from a syntactic perspective, even before considering Python's interesting use of whitespace, which doesn't bother me as much as it does some people, but still isn't as attractive to me as it appears to be to Python fans.

Mormon! (0)

Anonymous Coward | more than 6 years ago | (#22629762)

Around here, the problem with Mormonism isn't the denomination, but the religion itself. Does this influence you?
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...