From: Ben Giddings Date: 2005-01-28T07:38:20+09:00 Subject: Re: Ten Things Every Java Programmer Should Know About Ruby E S wrote: > Here's the list so far: > ------------------------------------------------------------------- > Ruby classes are Objects (therefore String.new, not new String()) > Everything is an Object I'd emphasize this for Java ppl. Many of them think that Java is fully object oriented, but they then have to deal with the problems if "int" vs. Integer. I'd make this fully clear to them by using one of the really cool things like: 5.times { puts "Everything is an object!" } > Everything is an expression. A great example of this is: language = case(name) when "John", "Jane", "Mike" "English" when "Yukihiro", "Maiko" "Japanese" else "Unknown" end > ri is your friend. irb is your other friend. I'd say irb is your best friend. ri is cool and all, but nothing beats being able to fire up irb and see for yourself what happens. > method_missing Show off the roman numerals example from the pickaxe for this one, that's always impressive. > ruby has shortcuts for accessor methods which reduces alot of redundant coding in java And, ruby has no public members, so all access *must* be through accessors. That's a major deal for Java ppl, who are used to having to have a "foo" member variable, and then a getFoo() and setFoo() method. Start with the default accessor, then if/when needed, add bounds checking and whatever else you'd like. Ben