Opinion on Ruby maturity

Hi All,

This interaction happened on a University of Maryland LUG. I thought
that the level of sophistication of this analysis deserved to be
responded to by the experts.

There are two messages here. The first is the one that struck me as so
important. In my opinion the second letter admits marginal advantages to
ruby when compared to python. This may be important to one who has
already invested in python but not to the newbie deciding which craft to
take.

Please include the addresses Dr. Mike and/or the list in your reply.

John

···

-------- Original Message --------
Subject: Opinion on Ruby maturity (was: Re: Now what)
Date: Thu, 25 Jul 2002 06:37:52 -0400
From: Michael Henry drmikehenry@drmikehenry.com
To: John Knight john@johnknight.com

John Knight wrote:

[…]
I do not consider python an improvement over perl but in my view ruby is
more cleanly designed than either perl or python.

[…] I suggest
you look at ruby and demonstrate to yourself that it is an order of
magnitude more expressive than its predecessors. […] If
you come to believe that ruby is more transparent than the other
languages. i.e. the syntax not not get in the way of understanding then
you have thousands of programs to rewrite and put into the public
domain.

I’ve lately been sweating the question of Python vs. Ruby for
our shop. I’ve read several books, and IMHO I like Ruby as a
language better than Python for several reasons [1]. However,
I’m concerned over the maturity of Ruby-related tools and support.
particularly for a few key needs we will be having:

  • We need to script C++ apps, and eventually Java apps as well.

  • We need to make portable GUI’s. We are dumping MFC.

  • We need a stand-alone language for rapid filter-program
    development and the one-off system-administration tasks

A driving goal is to minimize the number of things we must
simultaneously learn (language, GUI library, …).

Since we need to use Java and Swing for GUI development,
I’d like to be able to use Swing with Python or Ruby.
There is Jython (Java-based Python, www.jython.org) that
provides mature-looking support for Python on a JVM.
There is JRuby (Java-based Ruby, jruby.sourceforge.net) that
has scant documentation and is beta-quality at this time.
I don’t know how soon JRuby might become fully usable.

In my position (no real experience with either Python or Ruby,
just a half-dozen books and lots of web browsing) I don’t
know whether I’d be painting myself into a corner with Ruby.

Does anyone have enough experience with Ruby to say
if the third-party libraries and support are enough?

Thanks,
Michael Henry

[1] - The advantages I see of Ruby over Python:

  • Ruby has single-inheritance with mixins (like Java interfaces)
    and should therefore map better onto JVM’s

  • Ruby supports regular expressions directly in the language (a la
    Perl):
    string =~ /this|that/

  • Ruby has an extremely elegant way to pass code blocks to a method,
    and uses it neatly for iterating over a collection:
    list.each do |currentListItem| print currentListItem end

  • Ruby can do “ruby -ne ruby_code_here” like Perl for ultra-quick
    one-liners. I can’t find support for this in Python, and it seems
    unlikely due to Python’s “whitespace as syntax” model

  • Built-in syntax to create range objects (e.g., start … end)

  • Neat case-equality operator for extremely flexible case statement

  • Ruby has private, protected and public attributes (Python has none)

  • Parentheses may be removed on method calls where unambiguous.
    Supports the principle of uniform access, where the outside world
    can’t
    tell whether it is accessing an object’s data member directly or
    through
    a member function, e.g.:
    x = obj.member # member could be a data item or a method call like
    member()

Hi

I haven’t looked at ruby at all but this might be of interest for your
comparison:

On Thu, 25 Jul 2002, Michael Henry wrote:

[1] - The advantages I see of Ruby over Python:

  • Ruby has single-inheritance with mixins (like Java interfaces)
    and should therefore map better onto JVM’s

I thought Python had mixins, but maybe there’s some subtle difference I
don’t grasp.

  • Ruby supports regular expressions directly in the language (a la Perl):
    string =~ /this|that/

In python, not having it directly in the language just means you have to
do “import re”. Maybe you want to be able to match using operators, in
that case yes you’d have to write your own wrapper class. I have done
it,
easy and works fine, but if you can get it built in obviously that’s
nicer.

  • Ruby can do “ruby -ne ruby_code_here” like Perl for ultra-quick
    one-liners. I can’t find support for this in Python, and it seems
    unlikely due to Python’s “whitespace as syntax” model

python -c “for x in range(3): print x”

  • Built-in syntax to create range objects (e.g., start … end)

built into python: foo = range(1,n)
x = foo[3:n-2]

  • Ruby has private, protected and public attributes (Python has none)

In python you can do name mangling, which might not be as elegant, but
provides some of the protective functionality. Prepend a
double-underscore
to the variable name and the interpreter will change it during execution
to __foo. Better than nothing.

Judah

I’ve lately been sweating the question of Python vs. Ruby for
our shop. I’ve read several books, and IMHO I like Ruby as a
language better than Python for several reasons [1]. However,
I’m concerned over the maturity of Ruby-related tools and support.
particularly for a few key needs we will be having:

  • We need to script C++ apps, and eventually Java apps as well.

SWIG (http://www.swig.org) is a tool designed specifically to assist in
developing scripting languages interfaces to C/C++ code, and supports a
number of higher-level languages (including Perl, Python and Ruby).
There were limitations in some very early versions of the Ruby module
for SWIG, but the latest releases are very strong and include support
for a wide variety of C++ language features.

Hi,

by "second letter" I guess you mean mine, and just to clarify, I wasn't
debating ruby vs. python. I couldn't if I wanted to, since I've never seen
ruby, not a single line. I just wanted to point out a couple of things
about python that you might not have been aware of.

regards

Judah

···

On Thu, 25 Jul 2002, John Knight wrote:

There are two messages here. The first is the one that struck me as so
important. In my opinion the second letter admits marginal advantages to
ruby when compared to python.

Python has this as well. While Ruby calls each() an iterator, Python
calls it a generator. E.g.:

from future import generators
def fibonacci(a=1, b=1):
while 1:
yield a
a, b = b, a+b
t = fibonacci() # t is an iterator!
for i in range(10): print t.next()

Python has only gotten this recently, and many people suspect that this
is due to the influence of its long-lost cousin.

Paul

···

On Fri, Jul 26, 2002 at 02:58:51AM +0900, John Knight wrote:

  • Ruby has an extremely elegant way to pass code blocks to a method,
    and uses it neatly for iterating over a collection:
    list.each do |currentListItem| print currentListItem end

Be sure to check the archives:

http://www.ruby-lang.org/en/raa.html

Where are good places to learn / learn about ruby?

Thanks again,
Jason

John Knight wrote:

···

Hi All,

This interaction happened on a University of Maryland LUG. I thought
that the level of sophistication of this analysis deserved to be
responded to by the experts.

There are two messages here. The first is the one that struck me as so
important. In my opinion the second letter admits marginal advantages to
ruby when compared to python. This may be important to one who has
already invested in python but not to the newbie deciding which craft to
take.

Please include the addresses Dr. Mike and/or the list in your reply.

John

-------- Original Message --------
Subject: Opinion on Ruby maturity (was: Re: Now what)
Date: Thu, 25 Jul 2002 06:37:52 -0400
From: Michael Henry <drmikehenry@drmikehenry.com>
To: John Knight <john@johnknight.com>

John Knight wrote:

[...]
I do not consider python an improvement over perl but in my view ruby is
more cleanly designed than either perl or python.

[...] I suggest
you look at ruby and demonstrate to yourself that it is an order of
magnitude more expressive than its predecessors. [...] If
you come to believe that ruby is more transparent than the other
languages. i.e. the syntax not not get in the way of understanding then
you have thousands of programs to rewrite and put into the public
domain.

I've lately been sweating the question of Python vs. Ruby for
our shop. I've read several books, and IMHO I like Ruby as a
language better than Python for several reasons [1]. However,
I'm concerned over the maturity of Ruby-related tools and support.
particularly for a few key needs we will be having:

- We need to script C++ apps, and eventually Java apps as well.

- We need to make portable GUI's. We are dumping MFC.

- We need a stand-alone language for rapid filter-program
development and the one-off system-administration tasks

A driving goal is to minimize the number of things we must
simultaneously learn (language, GUI library, ...).

Since we need to use Java and Swing for GUI development,
I'd like to be able to use Swing with Python or Ruby.
There is Jython (Java-based Python, www.jython.org) that
provides mature-looking support for Python on a JVM.
There is JRuby (Java-based Ruby, jruby.sourceforge.net) that
has scant documentation and is beta-quality at this time.
I don't know how soon JRuby might become fully usable.

In my position (no real experience with either Python or Ruby,
just a half-dozen books and lots of web browsing) I don't
know whether I'd be painting myself into a corner with Ruby.

Does anyone have enough experience with Ruby to say
if the third-party libraries and support are enough?

Thanks,
Michael Henry

[1] - The advantages I see of Ruby over Python:
- Ruby has single-inheritance with mixins (like Java interfaces)
and should therefore map better onto JVM's

- Ruby supports regular expressions directly in the language (a la
Perl):
string =~ /this|that/

- Ruby has an extremely elegant way to pass code blocks to a method,
and uses it neatly for iterating over a collection:
list.each do |currentListItem| print currentListItem end

- Ruby can do "ruby -ne ruby_code_here" like Perl for ultra-quick
one-liners. I can't find support for this in Python, and it seems
unlikely due to Python's "whitespace as syntax" model

- Built-in syntax to create range objects (e.g., start .. end)

- Neat case-equality operator for extremely flexible case statement

- Ruby has private, protected and public attributes (Python has none)

- Parentheses may be removed on method calls where unambiguous.
Supports the principle of uniform access, where the outside world
can't
tell whether it is accessing an object's data member directly or
through
a member function, e.g.:
x = obj.member # member could be a data item or a method call like member()

Hi

I haven't looked at ruby at all but this might be of interest for your
comparison:

On Thu, 25 Jul 2002, Michael Henry wrote:

[1] - The advantages I see of Ruby over Python:
- Ruby has single-inheritance with mixins (like Java interfaces)
and should therefore map better onto JVM's
   
I thought Python had mixins, but maybe there's some subtle difference I
don't grasp.

- Ruby supports regular expressions directly in the language (a la Perl):
string =~ /this|that/
   
In python, not having it directly in the language just means you have to
do "import re". Maybe you want to be able to match using operators, in
that case yes you'd have to write your own wrapper class. I have done
it,
easy and works fine, but if you can get it built in obviously that's
nicer.

- Ruby can do "ruby -ne ruby_code_here" like Perl for ultra-quick
one-liners. I can't find support for this in Python, and it seems
unlikely due to Python's "whitespace as syntax" model
   
python -c "for x in range(3): print x"

- Built-in syntax to create range objects (e.g., start .. end)
   
built into python: foo = range(1,n)
                     x = foo[3:n-2]

- Ruby has private, protected and public attributes (Python has none)
   
In python you can do name mangling, which might not be as elegant, but
provides some of the protective functionality. Prepend a
double-underscore
to the variable name and the interpreter will change it during execution
to <classname>__foo. Better than nothing.

Judah

Actually, the language’s inheritance model has very little influence
over how it’s implemented on top of a JVM.

But anyway: If Java support is very important to you then your bet today
should be Python, since Jython is more mature than JRuby (at the moment,
we’re working to change that).

/Anders

···

On 2002-07-25 John Knight wrote:

[1] - The advantages I see of Ruby over Python:

  • Ruby has single-inheritance with mixins (like Java interfaces)
    and should therefore map better onto JVM’s

A n d e r s B e n g t s s o n | ndrsbngtssn@yahoo.se
Stockholm, Sweden |


Gratis e-mail resten av livet på www.yahoo.se/mail
Busenkelt!

Hi J Milgram,
I am sorry I misstated your intention.
I read your letter to mean that python is more powerful than Dr. Mike
understood.
But that even so python did not have all the virtues that Dr. Mike
ascribed to ruby.

You clearly state that you do not know ruby and I undersood that. I
added your letter
to the mix to expand the conversation on ruby-talk. There are
python-ruby knowledgables
on that list.

For example, what is the difference between the mix-in models?

John

The “PickAxe Book”, aka Programming Ruby by Dave Thomas and Andy Hunt,
published by Addison Wesley, is
a must-have for learning about Ruby. After that, read this newsgroup.

···

On Fri, 26 Jul 2002 01:35:41 -0400, Jason L. Ashbaugh wrote:

Where are good places to learn / learn about ruby?

Thanks again,
Jason

No problem, that's quite OK. Just wanted to clarify.

If I *were* to play python-advocate, I'd put more work into it!

Judah

···

On Thu, 25 Jul 2002, John Knight wrote:

Hi J Milgram,
I am sorry I misstated your intention.
I read your letter to mean that python is more powerful than Dr. Mike
understood.
But that even so python did not have all the virtues that Dr. Mike
ascribed to ruby.