At work I am a member of a Software Engineering Reading Group. It works pretty much like any other reading group, except the books of choice have titles like “More Effective C++” or “Pattern Oriented Software Architecture”. (Both those books suck by the way.)
We just finished up the C++ book mentioned, and in a two weeks we will be picking a new book. Since the vote on the new book will not take too much time, I have been asked to spend 30-45 minutes talking about Ruby and why I love it so.
To be honest, I am really in no way qualified to talk much about Ruby. I have been doing development in Rails for a couple of months now, but I still feel that I am an utter newbie to the whole thing. So, I am looking for some advice on the things that you would choose to focus on when selling ruby to C++ programmers.
To me, the key features that make me love ruby are:
1. Expressiveness. I don’t think I have seen another programming langauge that was so amazingly easy to read. I don’t think I have ever written programs in another language that so stated so clearly what they did. To steal an example from David Heinemeier Hansson’s “Pursuit of Beauty” presentation:
transaction(david, mary) do
david.withdraw(100)
mary.deposit(100)
end
2. Everything is an Object. This is what always killed me about PHP, Perl, and even C++. Objects always seem to just be hacked onto the top. There was always a disconnect between built in types and user defined types. They should really all work the same. Ruby nails this. Everything is an object:
“this is a string”.upcase -> “THIS IS A STRING”
5.next -> 6
3. Blocks. I am starting to really like blocks. They have not quite gotten to be second nature to me, but they are starting to get there. (I never got into Perl enough to really grok closures. Don’t hold it against me. And yes — in ruby you can use blocks as closures.)
[ "H", "A", "L" ].each { |letter| print letter } -> HAL
My main goal is a brief intro to what the language looks like, and in doing so highlight the key aspects that make it such a fun (aka. productive) language to program in. What am I missing?
Also, what are it’s major downfalls? With the how common multi-cored processors are becoming we are making a lot of moves in my company towards writing software that is more suited to those platforms. So, I feel I should definately point out Ruby Threads.
What do you love, and what do you hate about Ruby?