Ruby to java or java to ruby converter

V

Vinod Kone

hi,

am a newbie to ruby and was wondering whether there is any ruby2java or
java2ruby converter? we are planning to compare both the languages based
on some benchmarks..so thought a converter would come in handy. any
suggestions?

thanx,
vinod
 
B

Bill Kelly

From: "Vinod Kone said:
am a newbie to ruby and was wondering whether there is any ruby2java or
java2ruby converter? we are planning to compare both the languages based
on some benchmarks..so thought a converter would come in handy. any
suggestions?

Benchmarks aside, you might take a look at JRuby: http://jruby.codehaus.org/

It's a port of Ruby running on the JVM. So you can mix Ruby and Java code.

(One note about comparing languages based on benchmarks: Usually, all
that matters is whether the language is fast enough for the problem you're
trying to solve. If one language is "fast enough" and another language is
"even more fast enough", it doesn't really matter.... :)


HTH,

Bill
 
V

Vinod Kone

Bill said:
From: "Vinod Kone" <[email protected]>
Benchmarks aside, you might take a look at JRuby:
http://jruby.codehaus.org/

It's a port of Ruby running on the JVM. So you can mix Ruby and Java
code.

thanx Bill,

I looked at the jruby site b4 posting this...but couldnt understand
whether it solves my purpose? From the looks of it...it looks like ruby
running on top of JVM..isnt it? why would i want that....i mean all i
want was given a piece of code in java/ruby..i would want a piece of s/w
to convert it to ruby/java (approximately)

thx,
vinod
 
B

Bill Kelly

From: "Vinod Kone said:
I looked at the jruby site b4 posting this...but couldnt understand
whether it solves my purpose? From the looks of it...it looks like ruby
running on top of JVM..isnt it? why would i want that....i mean all i
want was given a piece of code in java/ruby..i would want a piece of s/w
to convert it to ruby/java (approximately)

Perhaps you could tell us more about what kind of benchmarks you
want to run in both languages. What sort of programming problems
do you want to solve with Java-or-Ruby? Web applications? Locally
installed applications with graphical user interfaces? Something else?

There are already websites out there with benchmarks comparing
given algorithms in many different programming languages. What do
you hope to learn by comparing a given piece of code in java/ruby?
Do you want to know which was easier to write? Do you want to
know which one ran faster?


Regards,

Bill
 
V

Vinod Kone

Perhaps you could tell us more about what kind of benchmarks you
want to run in both languages. What sort of programming problems
do you want to solve with Java-or-Ruby? Web applications? Locally
installed applications with graphical user interfaces? Something else?

There are already websites out there with benchmarks comparing
given algorithms in many different programming languages. What do
you hope to learn by comparing a given piece of code in java/ruby?
Do you want to know which was easier to write? Do you want to
know which one ran faster?


Regards,

Bill

i understand that comparing programming languages is a non-trivial issue
and it depends on the "type of tasks" that you want the program to do.
what we are trying to look into is how java and ruby fare w.r.t to
different "kind" of programs..for ex: memory intensive, io intensive,
regular expression matching etc. the benchmarks would be cpu time,
memory usage, length of code etc etc.

tx,
vinod
 
A

Ashley Moran

i understand that comparing programming languages is a non-trivial =20
issue
and it depends on the "type of tasks" that you want the program to do.
what we are trying to look into is how java and ruby fare w.r.t to
different "kind" of programs..for ex: memory intensive, io intensive,
regular expression matching etc. the benchmarks would be cpu time,
memory usage, length of code etc etc.


Personally, I think the best use of your time (and the most important =20=

benchmark) would be estimating how much longer/shorter it would take =20
to develop in Java/Ruby. If the time to develop in Ruby is one week =20
less, and the cost to have a developer on a job is (say) =A31000, all =20=

you have to ask is will the Ruby version need more than =A31000 of =20
hardware extra to run?

I will probably recommend soon that we upgrade our web servers to 4GB=20
+ RAM so we can start Mongrel clusters with impunity. We will easily =20=

save the cost of that in developer hours. Likewise with a =20
particularly intensive data processing tool written in Ruby - it will =20=

cost far less to replace the CPU in our internal server than to =20
rewrite the tool in another language.

Ashley=
 
B

Bill Kelly

From: "Vinod Kone said:
i understand that comparing programming languages is a non-trivial issue
and it depends on the "type of tasks" that you want the program to do.
what we are trying to look into is how java and ruby fare w.r.t to
different "kind" of programs..for ex: memory intensive, io intensive,
regular expression matching etc. the benchmarks would be cpu time,
memory usage, length of code etc etc.

For length of code, Ruby seems to do very well: http://rubyurl.com/pvT

For CPU time, Ruby does poorly--and yet, here we all are, using Ruby to
code all manner of applications. Because Ruby is "fast enough" for most
things.

As matz, the designer of Ruby points out, computers are getting faster
and faster, so he may purposefully spend more CPU time if it saves
developer time:
http://www.rubyist.net/~matz/slides/ll2/mgp00020.html
http://www.rubyist.net/~matz/slides/ll2/mgp00006.html


Regards,

Bill
 
L

Logan Capaldo

hi,

am a newbie to ruby and was wondering whether there is any ruby2java or
java2ruby converter? we are planning to compare both the languages based
on some benchmarks..so thought a converter would come in handy. any
suggestions?
I think if you want to do this the right way you shouldn't use an
autoconvertor. Something written in one language may be written
differently in another language in a simpler, more efficient way than
perhaps an autoconvertor could detect.

e.g.: You might use a block in ruby to iterate over an array. The
ruby-to-java convertor would either have to know enough about the
running program to determine it was iteration, or it would have to
convert the block to an anonymous inner class, which is much more
heavyweigth than a ruby block, at least for iterating an array. That's
ok because in Java you'd use a for loop anyway. Something you might do
with mixins in Ruby you might do with inheritance in Java, etc. Despite
the both of them being OO languages, the idioms used are different and
your convertor (unless you've got some AI hidden away) is not going to
be able to convert them properly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top