Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Python vs Ruby! (http://www.velocityreviews.com/forums/t823718-python-vs-ruby.html)

Joe Van Dyk 08-18-2005 09:07 PM

Python vs Ruby!
 
Which is better, Python or Ruby?

(ha, just kidding)

I've been fighting the good fight inside a really large corporation
trying to get Ruby on the "approved" list. I've brought this up a
couple times in the past on this list and have got some good
responses.

Perl used to be the language of choice for certain application
domains. Then, a few years ago, Python was seen to be better than
Perl, so Python was added to the "approved" list.

As there's an interest in reducing variability in software systems in
the company, any addition to the approved list has to have some pretty
good reasons as to why the addition is needed.

I have a couple main reasons why I prefer Ruby over Python:
1) Simple to extend existing applications written in C with Ruby.
2) Great syntax
3) Blocks
4) DRb
5) Rails

I don't think that's enough though, as #2 is pretty subjective and
there's probably an equivalent to DRb in Python and Rails is probably
way too bleeding edge (and I don't do web development stuff here). #1
is probably the most compelling reason.

I obviously don't want to push for Ruby as a replacement for Python,
that would never work. I'm pushing for Ruby to be available for use
in addition to Python. So, I think the question is: "Why would you
want to use Ruby in a situation where Python is available?"

Thanks,
Joe



Josh Charles 08-18-2005 09:17 PM

Re: Python vs Ruby! (Forcus on Performace)
 
> I've been fighting the good fight inside a really large corporation
> trying to get Ruby on the "approved" list. I've brought this up a
> couple times in the past on this list and have got some good
> responses.
>=20
> Perl used to be the language of choice for certain application
> domains. Then, a few years ago, Python was seen to be better than
> Perl, so Python was added to the "approved" list.


One concern I have is performance issues, especially when it comes to
GUI programming. After trying several different programs, I've
noticed a large difference in performance between Ruby (Using FXRuby)
and Python (Using PyQT) with Python coming out as the clear leader.=20
The Python Program (Eric3) was running about five times faster than
the Ruby (FreeRIDE). Those two ought to compare well, as they have
similar functions.

It's bothersome because I already dedicated a project to working in
Rails before I found this out, so I can only hope this is a Graphical
Toolkit Issue and not a language issue.



Kirk Haines 08-18-2005 09:35 PM

Re: Python vs Ruby! (Forcus on Performace)
 
On Thursday 18 August 2005 3:17 pm, Josh Charles wrote:

> It's bothersome because I already dedicated a project to working in
> Rails before I found this out, so I can only hope this is a Graphical
> Toolkit Issue and not a language issue.


Ruby performance with web tasks has been mentioned a great deal. Heck, I
think I've mentioned it in a praising way a couple times already in the past
week.

Rails has demonstrated adequate performance for real world tasks on many
occasions, now. 43things.com runs on Rails and they field quite a bit of
highly dynamic traffic without any problem on a very reasonable set of
hardware.

And while I don't use Rails, I have used Ruby exclusively for web work for
over three years, and I get what I deem to be very good performance from it.
Comparing web performance is very difficult because there are so many
variables that can influence the numbers, but an app that I have in
production for a fortune 500 company has been benchmarked by me to deliver a
9k, modestly dynamic page in .0035 seconds on a single processor, midrange
Linux box. For large groups of consecutive requests of this page (not
cached), it does 260-290 requests per second, consistently, depending on what
other load I have on the machine at the same time. In actual real, heavy
usage with real data, many of the pages will be larger or more complex, and
thus slower to deliver, but that one cheap box will still handle more traffic
per second than this company will _ever_ throw at it, and if it did start to
get bogged down, adding a second server at the level of performance that Ruby
gives me is a reasonable, economical solution.

At least when it comes to web applications, Ruby is plenty fast, and Rails in
real usage seems to deliver enough performance to handle pretty heavy usage.


Kirk Haines



Josh Charles 08-18-2005 09:46 PM

Re: Python vs Ruby! (Forcus on Performace)
 
> At least when it comes to web applications, Ruby is plenty fast, and Rail=
s in
> real usage seems to deliver enough performance to handle pretty heavy usa=

ge.

Thanks for the info. That really makes me feel more comfortable with
the decision I made to go with Ruby.



Devin Mullins 08-19-2005 12:43 AM

Re: Python vs Ruby!
 
Joe,

Suggestions, no expertise, grain of salt, etc.

Joe Van Dyk wrote:

>I have a couple main reasons why I prefer Ruby over Python:
>
>

Are they the same reasons that the company should prefer Ruby over
Python? (In what cases?) If so:

>1) Simple to extend existing applications written in C with Ruby.
>2) Great syntax
>3) Blocks
>4) DRb
>5) Rails
>
>

If you've got a lot of free time on your hands, implement each of these
as actual Python vs Ruby code samples, and then draw conclusions based
on reasons deduction from examination of the samples. (You can see here
how such-and-such is easier to implement, hence resulting in less
duplication.) Tie everything back to dollar amounts, but show your work.
Don't try to cover up the fudge factor -- measuring programming
productivity is a bit of a black art.

I didn't at all answer your question, but that's because I'm not
familiar enough with Python. I read through 5 chapters of "Dive Into
Python," got disgusted, and decided to try Ruby instead. Boy am I glad I
did.

Devin




Jamey Cribbs 08-19-2005 01:18 AM

Re: Python vs Ruby!
 
Joe Van Dyk wrote:

>Which is better, Python or Ruby?
>
>(ha, just kidding)
>
>I've been fighting the good fight inside a really large corporation
>trying to get Ruby on the "approved" list. I've brought this up a
>couple times in the past on this list and have got some good
>responses.
>
>

Yesterday I had to give a short presentation to the big boss about Ruby
and why I had chosen to use it at our company (and why I wanted to
continue using it).

>As there's an interest in reducing variability in software systems in
>the company, any addition to the approved list has to have some pretty
>good reasons as to why the addition is needed.
>
>

I have a similar issue, I had been using both Python and Ruby for my
programming needs and was told by my boss that I would have to pick one
and use it exclusively.

>I don't think that's enough though, as #2 is pretty subjective and
>there's probably an equivalent to DRb in Python and Rails is probably
>way too bleeding edge (and I don't do web development stuff here). #1
>is probably the most compelling reason.
>
>

I'm not so sure you will find an equivalent to DRb in Python. I have
looked. Oh, there are a couple of similar libraries in Python, but I
did not find them nearly as easy to use as DRb (of course, I'm not the
sharpest tack in the box).

>I obviously don't want to push for Ruby as a replacement for Python,
>that would never work. I'm pushing for Ruby to be available for use
>in addition to Python. So, I think the question is: "Why would you
>want to use Ruby in a situation where Python is available?"
>
>

Boy, isn't that the $64,000 question. I struggled with this one at my
job for months, as my boss put more and more pressure on me to choose
one and only one.

Because I have developed a moderately complex library (KirbyBase) in
first Python and then Ruby, I'm hoping that you will find my $.02 worth
on this topic interesting.

To me, from a practical programming perspective (say that 10 times
fast), Python and Ruby are *very* similar. Obvious differences are of
course, things like the indentation thing; Ruby feeling more like
object-orientated stuff was baked in rather than added on; Python being
a little faster, etc.

I went back and forth trying to decide. What finally sold me on Ruby
was a feature that I had little use for until Hal Fulton helped the
light bulb to go on above my head. Blocks! More specifically, blocks
used as closures.

Hal convinced me to rewrite KirbyBase and allow the user to specify
query syntax using blocks. When I finally figured out how easy it was
to add this functionality and how much power it gave the user to specify
queries, I was sold.

What really put me over the top was when I recently went back and
rewrote the Python version of KirbyBase and tried to duplicate all of
the functionality of the new Ruby version. Python doesn't have blocks.
It has lambda, but it is pretty crippled. In Python, a lambda can only
be one expression and you can't do assignment in a lambda. What's
worse, Guido doesn't even like lambda and he is planning on removing it
from the language.

Now, you can still do closures in Python by actually passing a named
function, but using blocks is just so much more elegant.

Before this, I had *used* blocks for things like #collect and #each.
But it was only when I started having my own user-defined methods accept
and use blocks that I really started to understand how powerful they
make Ruby.

Anyway, sorry for the long post. To make a long story short, I chose
Ruby. I still program in Python on the side. I'm hoping to soon
release a Python version of KirbyBase that is equivalent to the Ruby
version. But, without those blocks, it's just not as much fun (although
list comprehensions are cool!). Hope this helps answer your question.

Jamey Cribbs



Ara.T.Howard 08-19-2005 01:34 AM

Re: Python vs Ruby!
 
On Fri, 19 Aug 2005, Jamey Cribbs wrote:

<snip>

> Anyway, sorry for the long post. To make a long story short, I chose Ruby.
> I still program in Python on the side. I'm hoping to soon release a Python
> version of KirbyBase that is equivalent to the Ruby version. But, without
> those blocks, it's just not as much fun (although list comprehensions are
> cool!). Hope this helps answer your question.


thanks alot - very interesting.

-a
--
================================================== =============================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze. --Nagarjuna
================================================== =============================




Ben Giddings 08-19-2005 01:43 AM

Re: Python vs Ruby!
 
On Thursday 18 August 2005 17:07, Joe Van Dyk wrote:
> Which is better, Python or Ruby?


(checks the mailing list)

Um... Ruby?

But seriously, Python and Ruby are so similar that it will be really hard to
make a really compelling argument. I'd go with a few things.

1) Are there people there that miss Perl, or have found Python not as well
suited to what they're doing as Perl was? Ruby's Perl-like roots may come in
handy. I think Ruby is a much more suitable language for certain tasks than
Python because of its Perl roots. Tasks like modifying a bunch of files in
place, anything dealing with regular expressions, etc. Find the old Perl
hackers and show them Ruby, see what they think.

2) Do you share code in ways other than code files? Say on websites, inside
other files (like say word processor docs), as email snippets, etc? That's
one area where indentation-sensitive languages really suffer. In particular,
copying and pasting Python code from web sites can be a real exercise in
frustration. Getting it there in the first place can be even worse. HTML
wants to make whitespace insignificant, Python really cares about
indentation, the mix causes problems. That can be a real reason to push for
Ruby.

3) Rails and Instiki. You can (I haven't done this, but I've heard), easily
install instiki on a USB thumb drive. Having a really portable wiki like
that can be super valuable, and it's so easy to set up, did you know,
"there's no step 3"? If you show the applications, rather than the
underlying techologies, and convince people that the applications are
great... they may be more willing to accept the technologies the applications
use.

Finally, you should show how well Python and Ruby interoperate using things
like XML-RPC. If people are scared of a hodge-podge of different languages,
show how well the two can coexist.

Ben



James Edward Gray II 08-19-2005 01:55 AM

Re: Python vs Ruby!
 
On Aug 18, 2005, at 4:07 PM, Joe Van Dyk wrote:

> So, I think the question is: "Why would you
> want to use Ruby in a situation where Python is available?"


My best thought:

"Well boss, I'm just more productive with Ruby."

James Edward Gray II




James Britt 08-19-2005 02:39 AM

Re: Python vs Ruby!
 
Joe Van Dyk wrote:
> Which is better, Python or Ruby?
>
> (ha, just kidding)
>
> I've been fighting the good fight inside a really large corporation
> trying to get Ruby on the "approved" list. I've brought this up a
> couple times in the past on this list and have got some good
> responses.
>
> Perl used to be the language of choice for certain application
> domains. Then, a few years ago, Python was seen to be better than
> Perl, so Python was added to the "approved" list.
>
> As there's an interest in reducing variability in software systems in
> the company, any addition to the approved list has to have some pretty
> good reasons as to why the addition is needed.
>
> I have a couple main reasons why I prefer Ruby over Python:
> 1) Simple to extend existing applications written in C with Ruby.
> 2) Great syntax
> 3) Blocks
> 4) DRb
> 5) Rails
>
> I don't think that's enough though, as #2 is pretty subjective and
> there's probably an equivalent to DRb in Python and Rails is probably
> way too bleeding edge (and I don't do web development stuff here). #1
> is probably the most compelling reason.


What makes Rails so appealing is that it is *not* bleeding edge. Rails
takes a variety of good ideas that have been tried and tested under a
variety of circumstances, and makes them easy to use.

(That's not to say Rails doesn't incorporate advanced coding or smart
design; clearly it does, but the user need not be concerned with any of
that until he or she so desires.)

Even if you don't do Web stuff, you can hold up Rails as an example of
how Ruby helps make one build tools to help others be more productive.
Ruby enables productivity bootstrapping because how how well it allows
one to create DSLs.


>
> I obviously don't want to push for Ruby as a replacement for Python,
> that would never work. I'm pushing for Ruby to be available for use
> in addition to Python. So, I think the question is: "Why would you
> want to use Ruby in a situation where Python is available?"


Higher productivity. Ruby fits my way of thinking better, so I spend
less time pushing against the language.

Put it another way: What's so bad about getting paid to use Python?

James

--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys





All times are GMT. The time now is 08:56 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.