Slashdot Mirror


JRuby Great Addition To Java Development

An anonymous reader writes "JRuby combines the object-oriented strength of Smalltalk, the expressiveness of Perl, and the flexibility of the Java class libraries into a single, efficient rapid development framework for the Java platform. This article introduces JRuby, a sophisticated addition to your Java development toolbox."

3 of 51 comments (clear)

  1. JRuby versus Java [code comparison - short] by tod_miller · · Score: 4, Funny
    JRuby
    require 'java'
    module Swing
    include_package 'java.awt'
    include_package 'javax.swing'
    end
    module AwtEvent
    include_package 'java.awt.event'
    end

    $calculator = Swing::JFrame.new
    class << $calculator

    def init
    end

    end

    $calculator.init
    $calculator.setSiz e(400, 400)
    $calculator.setVisible(true)
    versus Java
    import javax.swing.JFrame;
    public class Calculator extends JFrame {
    public Calculator(){
    super("Slashdot Rul3z");
    setSize(400, 400);
    setVisible(true);
    }
    public static void main(String[] args) {new Calculator();}
    }
    and we have a winner
    --
    #hostfile 0.0.0.0 primidi.com 0.0.0.0 www.primidi.com 0.0.0.0 radio.weblogs.com
    1. Re:JRuby versus Java [code comparison - short] by bzhou · · Score: 4, Funny
      vs. Jython
      from java import awt
      from pawt import swing

      labels = ["0", "1", "2", "+",
      "3", "4", "5", "-",
      "6", "7", "8", "*",
      "9", ".", "=", "/" ]

      keys = swing.JPanel(awt.GridLayout(4, 4))
      display = swing.JTextField()

      def push(event):
      display.replaceSelection(event.actionCommand)

      d ef enter(event): # <= def, slashdot formatting bug?
      display.text = str(eval(display.text))
      display.selectAll()

      for label in labels:
      key = swing.JButton(label)
      if "=" == label:
      key.actionPerformed = enter
      else:
      key.actionPerformed = push
      keys.add(key)

      panel = swing.JPanel(awt.BorderLayout())
      panel.add("North ", display)
      panel.add("Center", keys)
      swing.test(panel)
  2. About that name by HughsOnFirst · · Score: 4, Funny

    So when I tell somone that this is the right tool for the job , how am I supposed to pronounce it?
    ja-ru-bee? ( gummie candy treat perhaps? )
    har-you-bee ?
    or jay-ru-bee as though it were named after Lee Harvey Oswald's killer Jack Ruby ( J. Ruby ) ?