Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > in search of a compelling reason to use ruby....

Reply
Thread Tools

in search of a compelling reason to use ruby....

 
 
Ryan Paul
Guest
Posts: n/a
 
      05-10-2004
i'm a python programmer, and I have recently been hearing a lot about
ruby. A lot of python people seem to think ruby is in some way inferior,
but I have yet to find any significant differences between the languages.
The only differences I have found so far have been superficial syntactic
things. The only real significant difference I have detected, is the
absence of a module system in ruby.

I would like to be able to make an objective and educated comparison. Ruby
seems to have a relatively small, but intensely devoted following.
Software that inspires such fervent support from a small community usually
possesses tremendous power that most people are just too dense to discern
(eg: ocaml, and BeOS). Consequently, I figured it would be worth my time
to find out what it is that the fanatics find appealing.

I am looking for:
- examples of tangible features that ruby has, which python doesnt.
- examples of scenarios where some facet of, or property specific to
ruby contributed to the simplification or improvement of a programming
project.
- facets of the language which may not necessarily be useful, but are
notably creative/innovative.

Additionally, I realize that there is more to a language than its syntax
and functionality. As a result, I am also interested in hearing about
facets of the ruby community and ruby ideology, and anything else that
ruby programmers feel contribute to their affinity for the language.

I have a feeling that most of the things that make ruby worth using can
also be found in python. From the perspective a python programmer who has
taken only a precursory glance at ruby, it looks like ruby suggests a
functional style, while python suggests an imperative style. It also looks
like ruby may be better suited for quick shell scripts, whereas python is
better suited for bigger programs. I realize that I probably suffer from
misconceptions, and i'm looking forward to having them corrected.

I sincerely hope nobody finds any of my comments offensive, I dont mean
them as criticisms of ruby. I intentionally withhold criticisms until I am
better versed in the benefits!

Thanks in advance!
-- SegPhault
 
Reply With Quote
 
 
 
 
Gavin Sinclair
Guest
Posts: n/a
 
      05-10-2004
On Monday, May 10, 2004, 8:43:57 PM, Ryan wrote, in part:

> I am looking for:
> - examples of tangible features that ruby has, which python doesnt.
> - examples of scenarios where some facet of, or property specific to
> ruby contributed to the simplification or improvement of a programming
> project.
> - facets of the language which may not necessarily be useful, but are
> notably creative/innovative.



I suggest you take a look at http://phrogz.net/ProgrammingRuby. It's
a high-quality dead-tree textbook that's freely readable online. It
assumes some decent background knowledge, which you obviously have.
The preface and the first couple of chapters will tell you most of
what you want to know, and from there you can pick out more advanced
things if you wish.

I certainly welcome discussions about particular features, but direct
Python/Ruby comparisons are very common on this list and almost always
generate more heat than light. That's despite the best of intentions.
The reality is that it's hard to think outside your own
experience/background. There's no quick answer to your questions, as
I have found in the past. For the curious, learning Ruby is extremely
worthwhile, even if you never write a line of code in it. You *will*
learn some novel approaches, no matter what your background, as Ruby
draws from many languages.

But like I say, there's no shortcut. If you spend an hour or so
reading the material in "Programming Ruby" (known fondly as "The
Pickaxe"), then you will understand much better where Ruby is coming
from and will (hopefully) start to appreciate some of its distinctive
features.

All the best,
Gavin




 
Reply With Quote
 
 
 
 
gabriele renzi
Guest
Posts: n/a
 
      05-10-2004
il Mon, 10 May 2004 10:42:02 GMT, Ryan Paul <(E-Mail Removed)>
ha scritto::

<snip>

you better look at the *many times* debated stuff:
http://www.ruby-doc.org/RubyEyeForThePythonGuy.html
I believe with come patience you may get better and more complete
answer to anything by looking at old threads.


>I am looking for:
> - examples of tangible features that ruby has, which python doesnt.


I believe the strongest one (and totally incompatible with python's
__call__ methods) is the usage of methods as syntax enhancer[1]

Say, when you type:

class Foo
private
def foo
end
end

you're setting a state calling the private() method, not actually
using a keyword. This, toghether with blocks, allows
you to write stuff like this:

irb(main):001:0> def with(obj,&block)
irb(main):002:1> obj.instance_eval(&block)
irb(main):003:1> end
=> nil
irb(main):004:0> with 10 do
irb(main):005:1* print id
irb(main):006:1> end
21=> nil
irb(main):007:0> 10.id
=> 21


but, in the end, ruby and python evolved toward common features via
different approaches (i.e. python property() is similar in effects to
ruby accessor methods, even if completely different)

And one thing that I don't see spotted in the oldest thread is ruby's
SAFE levels (controlling stuff like tainted input, FS access, and so
on)

>I sincerely hope nobody finds any of my comments offensive, I dont mean
>them as criticisms of ruby. I intentionally withhold criticisms until I am
>better versed in the benefits!


you've been kind enough to still be far from flaming

[1]
I can't say we define new syntax in ruby, but it looks like we do
 
Reply With Quote
 
Phil Tomson
Guest
Posts: n/a
 
      05-10-2004
In article <(E-Mail Removed)>,
Ryan Paul <(E-Mail Removed)> wrote:
>i'm a python programmer, and I have recently been hearing a lot about
>ruby.


Good.

>A lot of python people seem to think ruby is in some way inferior,
>but I have yet to find any significant differences between the languages.
>The only differences I have found so far have been superficial syntactic
>things. The only real significant difference I have detected, is the
>absence of a module system in ruby.


?? absence of a module system in ruby? What do you mean by that? We've
got modules.

>
>I would like to be able to make an objective and educated comparison. Ruby
>seems to have a relatively small, but intensely devoted following.
>Software that inspires such fervent support from a small community usually
>possesses tremendous power that most people are just too dense to discern
>(eg: ocaml, and BeOS). Consequently, I figured it would be worth my time
>to find out what it is that the fanatics find appealing.
>
>I am looking for:
> - examples of tangible features that ruby has, which python doesnt.


Continuations, blocks.

> - examples of scenarios where some facet of, or property specific to
> ruby contributed to the simplification or improvement of a programming
> project.


Here's one: Ruby's code blocks. Deceptively simple, but very powerful in
practice. They allow you to easily create domain specific languages very
easily in Ruby.

Quick example: I'm taking a Quantum Computing class. The prof is looking
for a language for designing quantum circuits. I signed up for the
project and createed a 'language' I call QDL (Quantum Design Language),
but it's reeally just plain Ruby under the covers - no parser needs be
created.

Here's an example of QDL:

circuit = QCircuit {
QBits = 4
l0 = QLayer {
feynmann(0,3)
feynmann(1,2)
}
l1 = QLayer {
toffoli(2,3,0)
}
}

Basically this describes the structure of a simple quantum circuit with
two layers and 3 gates. It can be simulated. I can now have my
classmates write QDL without having to know anything about Ruby at all.
Of course, if they're willing to learn a little Ruby it becomes much more
powerful since they can access all of Ruby from QDL.

The magic here is Ruby's code blocks (the code between '{' and '}'). They
can be passed around and 'called' or 'yield'ed to. I suspect it would be
very difficult to implement a QDL-like language in Python because Python
doesn't have code blocks like this (you would have to create a parser).

(BTW: QDL is implemented in about 400 line of Ruby, that includes all the
additional matrix operations (Kronecker product) and some simple error
checking).

> - facets of the language which may not necessarily be useful, but are
> notably creative/innovative.
>




>Additionally, I realize that there is more to a language than its syntax
>and functionality. As a result, I am also interested in hearing about
>facets of the ruby community and ruby ideology, and anything else that
>ruby programmers feel contribute to their affinity for the language.
>
>I have a feeling that most of the things that make ruby worth using can
>also be found in python. From the perspective a python programmer who has
>taken only a precursory glance at ruby, it looks like ruby suggests a
>functional style, while python suggests an imperative style. It also looks
>like ruby may be better suited for quick shell scripts, whereas python is
>better suited for bigger programs. I realize that I probably suffer from
>misconceptions, and i'm looking forward to having them corrected.


You can use Ruby for large projects as well. There are rumors of 20,000
to 30,000 line Ruby programs here. Personally, I don't think I've written
anything that was more than ~5000 lines of Ruby - of course, in my
experience, 5K lines of Ruby packs about the same functionality as
20K to 25K lines of C++ code.

>
>I sincerely hope nobody finds any of my comments offensive, I dont mean
>them as criticisms of ruby. I intentionally withhold criticisms until I am
>better versed in the benefits!



Mostly you need to try using Ruby on a small test project. Actually using
the language will give you a better feel for it than us telling you about
it.

Phil
 
Reply With Quote
 
Jim Weirich
Guest
Posts: n/a
 
      05-10-2004
Phil Tomson wrote:

> Quick example: I'm taking a Quantum Computing class. The prof is looking
> for a language for designing quantum circuits. I signed up for the
> project and createed a 'language' I call QDL (Quantum Design Language),
> but it's reeally just plain Ruby under the covers - no parser needs be
> created.


This is the same approach I used when writing a Build Control Language
to replace make. I used Ruby blocks to describe the actions associated
with tasks.

Example:

task :compile do |t|
java.compile t.source
end

By making making the entire build file Ruby code, I have an incredibly
powerful build language. This would have been much more clumsy without
the use of blocks.

--
-- Jim Weirich http://www.velocityreviews.com/forums/(E-Mail Removed) http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



 
Reply With Quote
 
Sascha Ebach
Guest
Posts: n/a
 
      05-10-2004
> I just wanted to thank everybody for the great responses. After going
> through some of the links you folks provided, and reading through some
> documentation, my curiosity has transformed into utter maniacal glee. Ruby
> solves a lot of the problems I had with python. Blocks are particularly
> enticing. I have spent a lot of time hacking around with python, trying to
> abuse metaclasses so I could use the python parser for domain specific
> languages. I'm delighted to find that ruby provides such an elegant
> mechnaism to facilitate the task. Additionally, it looks like ruby's
> syntax is significantly more elegant than python, in many respects.
>
> Now i'm going to port a bunch of my python code for practice! =D
>



Hphew. That was fast and easy, wasn't it? Glad you found solutions to
your problems so quickly.

--
Sascha Ebach Hexatex Holistic-Webdesign
Hugo-Junkers-Str. 26 50739 Köln
Web: http://www.hexatex.de (E-Mail Removed)
Tel: 0221 / 5994393 Fax: 0221 / 5994394


 
Reply With Quote
 
James Britt
Guest
Posts: n/a
 
      05-11-2004
Ryan Paul wrote:

>
>
> I just wanted to thank everybody for the great responses.


You're welcome.

I have a favor to ask. I'm guessing that most people on this list know
Ruby far better than they do Python. The Ruby/Python comparison is a
recurring theme, and we try to collect resources (such as the Ruby Eye
For The Python Guy page) so folks don't get callouses retyping the same
info. You being a Pythonista and all, I'd appreciate any comparisons
you can offer, or critiques of existing comparisons. There's little
point in referring people to resources that misrepresent Python, or put
up straw man arguments.



Thanks,


James Britt





 
Reply With Quote
 
Ryan Paul
Guest
Posts: n/a
 
      05-11-2004
On Tue, 11 May 2004 12:50:24 +0900, James Britt wrote:

> Ryan Paul wrote:
>
>>
>>
>> I just wanted to thank everybody for the great responses.

>
> You're welcome.
>
> I have a favor to ask. I'm guessing that most people on this list know
> Ruby far better than they do Python. The Ruby/Python comparison is a
> recurring theme, and we try to collect resources (such as the Ruby Eye
> For The Python Guy page) so folks don't get callouses retyping the same
> info. You being a Pythonista and all, I'd appreciate any comparisons
> you can offer, or critiques of existing comparisons. There's little
> point in referring people to resources that misrepresent Python, or put
> up straw man arguments.
>
>
>
> Thanks,
>
>
> James Britt


I've been taking a lot of notes while learning ruby, comparing the ruby
examples to python equivalents, and recording how both ruby and
python solve certain problems. I think I could probably clean up my notes
a bit, and restructure them into a relatively good comparison between the
languages. When I fill it out a bit more, i'll make it publicly available,
and drop a link here and in comp.lang.python (where I will probably be
lynched for my impertinence). So far, most of the criticisms of ruby that
flourish in the python community are based on misconceptions. (for
instance, a lot of people seem to know that ruby only supports single
inheritance, but what they dont know is that the mixin system MORE than
makes up for it)

I also want to write parts of it like a cookbook so that python
programmers can see how ruby handles some of the specific things that are
commonly done with python. The idea of 'switching languages' is really
unnerving for a lot of programmers, and I think its really important to
illustrate just how minimal the learning curve is. Ruby feels almost like
a logical extension of python, with some pleasant perl tricks thrown in
for good measure.

Presentation is always an issue, and i'm still deciding what the best way
to express the information would be. If I started a conversation with a
python programmer saying something like "have you ever tried ruby? it does
some neat things!" they would probably scoff, but if I said "what if you
could do assignments in anonymous functions?" I might capture their
interest.

There is a growing community of python malcontents that might be
interested in ruby. They have a lot of really creative syntax ideas, most
of which are ignored by the mainstream python community. I think it would
be of benefit to the ruby community to be aware of some of their interests
and motivations. Some of those programmers might be interested in
contributing to ruby, rather than working on their own independent
python forks, if I can illustrate ways in which ruby meets their
individual needs. To that end, I will probably spend some time looking at
python derivatives to see where the divergences are, and how (if at all)
their python extensions compare to some of ruby's development idioms.
'Prothon' is a good example of a python derivative on my list. I also mean
to show how ruby provides native support for many of the features hacked
into python by Xoltar's partial, functional, and datastruct libraries.

Ultimately, i'm interested in a flexible and powerful interpreted
language, and what I have seen of ruby's style indicates a progressive and
intuitive development paradigm that is bold enough to cast aside standards
and cliches to return the power to the user.

--segphault
 
Reply With Quote
 
gabriele renzi
Guest
Posts: n/a
 
      05-11-2004
il Tue, 11 May 2004 07:26:02 GMT, Ryan Paul <(E-Mail Removed)>
ha scritto::

<snip>
Hope you'll have fun using ruby

>There is a growing community of python malcontents that might be
>interested in ruby.


Well, it's true that there is a constant flux of people trying to make
ruby their own language. I tried this too

We just don't have forks/clones, stuff that is in many places for
python (CPython's core,Stackless' continuations,Prothon's prototypes
and '=' as an expression) is all available in core ruby or can be
easily done through smart usage of few features.

> They have a lot of really creative syntax ideas, most
>of which are ignored by the mainstream python community. I think it would
>be of benefit to the ruby community to be aware of some of their interests
>and motivations.


I use to read c.l.py from time to time, and I found prothon initially
interesting.
But, the core idea from Prothon (i.e. classless prototyped OO) is
already available in ruby[1], (provided that you define with()
properly and use Object.clone()), while many others like the funny
obj$met syntax and many things in David Mc Quigg's proposals (the
'python 3' and 'python 4' ones) does not sound really nice to me..

>Some of those programmers might be interested in
>contributing to ruby, rather than working on their own independent
>python forks, if I can illustrate ways in which ruby meets their
>individual needs.


You're missing the social point of view:
everybody wants to write the next big language

[1]
well, partially joking
 
Reply With Quote
 
Dave Burt
Guest
Posts: n/a
 
      05-11-2004

Ryan Paul wrote:
> I've been taking a lot of notes while learning ruby, comparing the ruby
> examples to python equivalents, and recording how both ruby and
> python solve certain problems. I think I could probably clean up my notes
> a bit, and restructure them into a relatively good comparison between the
> languages. When I fill it out a bit more, i'll make it publicly available
> <snip>
> I also want to write parts of it like a cookbook so that python
> programmers can see how ruby handles some of the specific things that are
> commonly done with python.
> <snip>
> Presentation is always an issue, and i'm still deciding what the best way
> to express the information would be. If I started a conversation with a
> python programmer saying something like "have you ever tried ruby? it does
> some neat things!" they would probably scoff, but if I said "what if you
> could do assignments in anonymous functions?" I might capture their
> interest.
> <snip>
> ... flexible and powerful interpreted language ... a progressive and
> intuitive development paradigm ... bold enough to cast aside standards
> and cliches to return the power to the user.
>
> --segphault


Sounds to me like you might have a great contribution to make to
Why Ruby? <http://whyruby.rubyforge.org/>
which is a project discussed in a thread on this group:
Promoting Ruby <news:(E-Mail Removed) m>
The aim of Why Ruby is to produce advocacy and presentation materials, to
the end of improving Ruby's take-up in the workplace.

I'm glad, too, that you've found Ruby such a help.

Dave


 
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
Examples of ClickOnce sites as compelling reason to chosoe this technology ilana ASP .Net 0 11-22-2006 10:04 AM
Need a compelling argument to use Django instead of Rails Ray Python 96 08-18-2006 04:53 PM
ASP.NET 3.0: Compelling scenarios for combining Master Pages and Web Parts? Michael Herman \(Parallelspace\) ASP .Net 5 07-05-2005 12:19 PM
10 Compelling Reasons USANA Should be Your Opportunity of Choice amos Cisco 0 04-02-2005 04:56 PM
in search of a compelling reason to use ruby.... Neil Mc Laughlin Ruby 0 05-10-2004 03:37 PM



Advertisments