Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby to java or java to ruby converter

Reply
Thread Tools

Ruby to java or java to ruby converter

 
 
Vinod Kone
Guest
Posts: n/a
 
      01-21-2007
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

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Bill Kelly
Guest
Posts: n/a
 
      01-21-2007
From: "Vinod Kone" <(E-Mail Removed)>
>
> 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



 
Reply With Quote
 
 
 
 
Vinod Kone
Guest
Posts: n/a
 
      01-21-2007
Bill Kelly wrote:
> From: "Vinod Kone" <(E-Mail Removed)>


> 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


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Bill Kelly
Guest
Posts: n/a
 
      01-21-2007
From: "Vinod Kone" <(E-Mail Removed)>
>
> 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



 
Reply With Quote
 
Vinod Kone
Guest
Posts: n/a
 
      01-21-2007
> 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

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Ashley Moran
Guest
Posts: n/a
 
      01-21-2007

On Jan 21, 2007, at 10:41 pm, Vinod Kone wrote:

> 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=

 
Reply With Quote
 
Bill Kelly
Guest
Posts: n/a
 
      01-21-2007
From: "Vinod Kone" <(E-Mail Removed)>
>
> 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



 
Reply With Quote
 
Logan Capaldo
Guest
Posts: n/a
 
      01-22-2007
On Mon, Jan 22, 2007 at 05:16:51AM +0900, Vinod Kone wrote:
> 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.
> thanx,
> vinod
>
> --
> Posted via http://www.ruby-forum.com/.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BARRIER - ruby gem - code converter not found (UTF-16LE to IBM737) Ilias Lazaridis Ruby 8 05-19-2011 11:54 AM
Moyea Video Converter with iPad video converter brntkobe1 Computer Support 0 04-18-2010 08:22 AM
Writing a language converter in Ruby ? Zouplaz Ruby 10 03-26-2009 05:06 PM
[ANN] ruby-msg-1.2.17 (converter for outlook msg files) Charles Lowe Ruby 0 05-13-2007 06:55 AM
Wikipedia markup to HTML converter in Ruby? Andreas Schwarz Ruby 0 08-27-2004 10:16 AM



Advertisments