Ruby to java or java to ruby converter

Discussion in 'Ruby' started by Vinod Kone, Jan 21, 2007.

  1. Vinod Kone

    Vinod Kone Guest

    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/.
     
    Vinod Kone, Jan 21, 2007
    #1
    1. Advertising

  2. Vinod Kone

    Bill Kelly Guest

    From: "Vinod Kone" <>
    >
    > 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
     
    Bill Kelly, Jan 21, 2007
    #2
    1. Advertising

  3. Vinod Kone

    Vinod Kone Guest

    Bill Kelly wrote:
    > From: "Vinod Kone" <>


    > 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/.
     
    Vinod Kone, Jan 21, 2007
    #3
  4. Vinod Kone

    Bill Kelly Guest

    From: "Vinod Kone" <>
    >
    > 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
     
    Bill Kelly, Jan 21, 2007
    #4
  5. Vinod Kone

    Vinod Kone Guest

    > 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/.
     
    Vinod Kone, Jan 21, 2007
    #5
  6. Vinod Kone

    Ashley Moran Guest

    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=
     
    Ashley Moran, Jan 21, 2007
    #6
  7. Vinod Kone

    Bill Kelly Guest

    From: "Vinod Kone" <>
    >
    > 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
     
    Bill Kelly, Jan 21, 2007
    #7
  8. 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/.
     
    Logan Capaldo, Jan 22, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Ryan

    Java WMA to MIDI Converter

    John Ryan, Aug 17, 2003, in forum: Java
    Replies:
    2
    Views:
    4,528
    Tommy88
    Oct 14, 2009
  2. Andreas Schwarz
    Replies:
    0
    Views:
    118
    Andreas Schwarz
    Aug 27, 2004
  3. Charles Lowe
    Replies:
    0
    Views:
    233
    Charles Lowe
    May 13, 2007
  4. Zouplaz
    Replies:
    10
    Views:
    212
    James Coglan
    Mar 26, 2009
  5. Ilias Lazaridis
    Replies:
    8
    Views:
    212
    Ilias Lazaridis
    May 19, 2011
Loading...

Share This Page