Some of the things I like in ruby thinking directly about java... being
both a ruby and java programmer:
- there is no type casting in ruby
- ruby has better loop constructs
- writing a class in ruby opposed to writing a class in java takes
much less time
- ruby eliminates the # of (, ), {, and } 's
- you can use characters like ?, !, etc.. in your method names
- you can use string interpolation, ex: "x: #{@myvar}" instead of
having to say "x:" + myvar'
- ruby doesn't force you to have 1 file per public class, you can have
all the public classes you want in a file (not that you have to do this,
but it's a nice option to have)
- ruby has multiple inheritance through mixins (this is sooo nice to have)
- ruby has a lower percentage of dr. diagnoses carpal tunnel sydrome
cases then java (ok, this is just an opinion...=)
- writing code in ruby, can improve the code you write in java (i say
this from prototyping code in ruby, then porting it to java at work,
because ruby allows me to focus on the design of my code more. Once my
design and testing is done in ruby it's so easy to port it to Java and
my java code looks better since I was able to put better design into
upfront, then having to worry about typing 18,000 lines of code
including the following characters: ;, return, int, char, String, byte,
[], {}, (), etc... )
- ruby has shortcuts for accessor methods which reduces alot of
redundant coding in java
I know I've got lots more, but I'm at work now...and need to get to that
5pm java deadline. =) If it were ruby it would have been done before
lunch...
Zach
P.S. - Although ruby's gui's are coming along, I still find Swing the
easiest RAD GUI to use, and yes over VB...I hate VB. And because of
JRuby I can utilize Ruby Code and a Swing GUI. Ah...raw power.
Hi,
1- Ruby does not have type casting.
Well, Ruby does not have a lot of things, but listing them will not
always explain anything.
I would rephrase this as, "Ruby has types, but does not need type casting."
Or, simply, "Ruby does not need type casting."
I'm wondering, too, if the things to list can be divided into aspects
common to most dynamically typed languages and features largely
specific to Ruby.
So one could start with, 'Ruby has strong, dynamic typing, which
means, among other things: [list of stuff]'
Then, "And in addition to all the goodness of a dynamically-typed
language, Ruby has [blocks, closures, continuations, ...]
One could also make distinctions between features built into the
language (e.g. blocks, continuations) and features available through
bundled or otherwise available libraries (REXML, YAML, O/R mapping,
Rake).
James