As a longtime Perler, I dislike Python's significant whitespace. That's why
I could never go for it. Ruby just feels right to me. I enjoy writing it
and it feels liberating when I do.
I still like Perl, but Ruby is quickly winning me over.
Let's be clear about this, though: people *are* allowed to like and
use more than one language This is a point that sometimes gets
obscured in these "winner-take-all" language comparison discussions.
Don't be a party pooper.
Next thing you know, people will start thinking it's OK to like and use more than one Web framework, or more than one editor, or more than one OS.
And what fun would that be?
···
On Sun, 9 Jul 2006, Troy Denkinger wrote:
--
James Britt
"You harmonize; then you customize."
- Wilson Pickett
I have found that switching languages rapidly, frequently, even in a
"staggered/parallel" manner is for the most part counter-productive.
...
Add multiple programming languages and you lose focus.
I find this not to be true when the languages each are used for the
special purpose they're best suited for. I've seen this to be true
for hardware design, where switching from C models to VHDL or Verilog
makes sense; and for web stuff where switching between (whatever)
and SQL is common; and for embedded DSP stuff where switching
between C and assembly is not uncommon.
I'd even go so far as saying that a mix of Ruby with C extensions is
better in all ways than Java or C# or C++ since in the former case you
can more often use the right-tool-for-the-job while in the latter case
you're using a crippled compromise language that sucks at OO and that
sucks at low-level stuff.
I think many of the more interesting ruby projects (
* _why's Hpricot;
* David Balmain's Ferret;
* Ara's NArray+mmap
) are proving this out, since they're excellent examples of
using Ruby where appropriate and using C where appropriate
and are producing results that go a long way to bringing the
best of both worlds to the user.
And this thought lets me drift back on-topic to the original
Python question -- I find Ruby's C interfaces (both RubyInline
and the traditional one) cleaner than that of most languages,
including Python back when I looked at it. And this cleanliness
is why I care very little about ruby performance concerns - it's
very easy to apply micro-optimizations this way if you need to.
I pity a
programmer who has to write a Ruby - FORTRAN bridge that is called by a
Java ERP application for an engineering firm located in Quebec.
Hmm.. I did Ada/Fortran and Fortran/Forth bridges as
one of my earlier programming jobs. Close enough?
I'm just curious; where does Haskell fit in this? I think in this
taxonomy it might fall under "lisp" because of the broad "functional"
language category, but I've found that doing serious stuff in Haskell
stretches my mind more than the bits of common lisp I've learned (but
that's probably because I have never gotten heavily into CL macros).
I remember several years ago someone responded to a slashdot interview
question with a list of about twelve language categories, with several
languages fitting into multiple categories; the idea was that a
well-rounded programmer would know at least one language from each
category. I'll see if I can find it.
As for the original subject of this thread, I just find ruby more fun
to program in. I definitely do not think that ruby code is more
obvious to the untrained eye than other languages - if that were the
only category, python would indeed win. However, the experience of
writing python feels like explaining things in detail to a somewhat
dim coworker. While there's something to be said for that approach, I
find that it often gets in the way of what I want to do - I want a
fast way to translate ideas into running code. Since there's not yet
a telepathic compiler, we're stuck with using some sort of language,
and I see no reason to use a language more cumbersome than necessary.
I suppose that the whitespace usage comes into play here, although I'm
definitely not opposed to using significant whitespace, having been
bitten a few times by ruby code that looked right indentation-wise but
left off the "end". I just wish python whitespace were optional the
way it is in Haskell.
That being said, the dynamic language I use the most is still perl. I
was never nearly as put off by all the bits of "snoopy swearing" as
some people seem to be - I suppose I learned perl at a time when my
mind was flexible enough that it just twisted certain structures into
a perl shape. Perl also has the advantage of being much faster for
most operations than ruby or python.
When I want to move text A in spot one over to text B in spot two, I
use perl. That's what it's for, and it does that job amazingly well.
(It's not all regexps either. The one-liner to convert fixed length
records into newline-delimited regexps is nice and tight.) It's
disturbing how many business problems boil down to moving text from A
to B.
When I wanted to document an algorithm for my father (who speaks none
of the same computer languages I do aside from C/C++, and has spent
his career largely in VB or at the VB/COM interface), I used python.
I was already doing extensive documentation, so at that point...
When I want to play with programming, I choose ruby. When I want to
experiment, and don't really know where I'm going to end up, or how
I'm going to want to do something, ruby is there and ready to be
twisted however I want. In short, when I want to have fun, I choose
ruby.
(those business analysts who are looking at this and thinking of right
now mandating python use for everything are well advised to go
(re-)read the book "Peopleware", and realize that developers having
"fun" has very serious economic advantages)
Not so much flames as challenges ...
> to make it one. Its quite possible to learn and work with more than one
> language at the same time, or at least in a staggered/parallel manner.
> Many top developers are of the view that learning and using more than
> one language is beneficial, helps you grow as a programmer.
I have found that switching languages rapidly, frequently, even in a
"staggered/parallel" manner is for the most part counter-productive.
Programming in *any* language is an activity that requires a mix of
intense focus on the programming tasks *and* an intensely active
communication in a spoken human language with customers and colleagues.
Add multiple programming languages and you lose focus.
I might not have made my above point ("it is quite possible to ...")
clear. What I meant was, once you've learned those (more than one)
languages, to a reasonable degree of proficiency, then its quite
possible to work with more than one at the same time (strictly
speaking, in a staggered manner - I haven't yet seen anyone who can
write more than one program (whether in one language or two) literally
at the same time ... in a given project.
I've done that in real-life projects (and this is often a genuine need
in such projects); e.g. have programmed in Informix ESQL/C (which is
actually like two languages - C and SQL in one source file) (for
database apps), plain UNIX C (for system tools or one-off programs to
be used by me and developers), Java (for biz apps again, as well as
system utliities), standalone SQL scripts (run from an SQL client), and
UNIX shell scripts (for automating tasks and calls to other programs) -
all in a single large long-running corporate project.
The organization not having resources for hiring specialized developers
for each individual language can also be a reason for needing to have
people (rather, the same person) develop in more than one language on
one project.
Occasionally a project will need multiple languages. I've found those go
slower and are more difficult than projects where you can wallow in your
knowledge of a single language and a single application domain. I pity a
programmer who has to write a Ruby - FORTRAN bridge that is called by a
Java ERP application for an engineering firm located in Quebec.
Not so occasionally, IMO - at least in larger corporate projects - see
1st para above.
Yes, indeed, learning multiple languages does help you grow, provided
they aren't too similar. There's a note about that on someone's blog --
give me a day or so and I can track it down. But briefly, he claimed --
and I somewhat agree -- that there are two broad classes of language.
Why should learning languages that are somewhat similar but with some
differences, not help you grow? (challenge:-) E.g, Case in point:
Python and Ruby.
There's the "Algol Family", into which class C/C++, Java, Python, Ruby,
Perl, etc. fall, and there's the "Lisp Family". If you're like most of
us, you spend most of your time in the Algol family. His point was that
you grow more if you learn a Lisp family language than if you learn
another Algol family language.
Incidentally, where I disagree is that I think there are six families:
You forgot Prolog-style languages - which are different from Lisp. I'm
not a language lawyer or expert, but have checked both those out a bit,
and I do feel that the programming paradigm in Prolog is different from
Lisp. Can't speak from a theoretical standpoint (e.g. some Lispers may
say that Prolog is in the same family as Lisp), and if I remember, Paul
Graham's On Lisp or some other Lisp book has an implementation of
Prolog in Lisp - though that may not be against my point that Prolog is
a different family than Lisp).
Ruby, I'll give it a shot. And there are language-specific IDEs for
Ruby. But don't *real* programmers use Emacs?
<ducking>
I was quite skilled at vi before vim came out, and managed very well
with that, though I'm aware (now) that vim has lots more features, and
am slowly checking them out.
A couple of times I've heard people (newbies mostly) mutter "magic..."
to themselves, standing behind me and watching me type code ....
Nothing special about it - just years of typing .... I'm sure many
others are the same .......
Vasudev Ram
···
Actually, I've never bothered to learn Emacs. It had a (justified)
reputation as a memory hog, so I learned vi. I'm pretty sure GNU Emacs
is no longer a memory hog, but I'm so firmly down the "vim" path that
Emacs seems like a distraction.
Matt Lawrence wrote:
>
>> Besides ROR, can you give me a reason why perfer ruby instead of
>> python?
>
> Did you see the lovely young ladies (I hope you know who you are) at
> the last RubyConf?
And ... which would *you* give a lovely young lady -- a ruby or a
dangerous reptile?
I have a friendly pet snake I'm often trying to give to lovely young
ladies.
Oh, yes, I saw that page, but for what I saw, most of them are in early
development or dead. The only one apparently working is the Ruby/Gnome.
Am I wrong? Who is doing GUI development in Ruby and what are they
using? (please, Tk is awful both in Ruby and Python) I think that in
GUI development, Ruby is far behind Python, and that is something that
keeps me from stepping into Ruby.
Any help would be appreciated, and sorry for my English.
Well, we've got rdoc. What specific python doc feature do you miss?
Maybe being able to type "help( some_obj.some_method )" at the
interactive prompt?
Personally, I didn't like the Python way of putting doc strings
*below* the thing they were documenting... always seemed upside-down.
Coming to Ruby from Python, that was the first thing I said to myself:
"I wish documentation were 'built in' like Python". Rdoc is great,
and I use it everywhere now, so my documentation desire is met. But I
had to say that I missed something from Python No other Python
specific features come to mind that I miss.
I'm blessed right now to be coding Ruby full time for my job. We're
writing tools to test the avionics for the Kepler Space telescope --
this involves generating 110 mega-pixel test images, running them
through the avionics, and then verifying that none of the pixels got
lost or mangled.
The flexibility of Ruby has allowed me to
1) write C code for the parts that need to be fast
2) write Ruby code for the parts that the users want to change all the time
3) use meta-programming to write some DSL syntax so the test engineers
can write their own image generation and validation scripts
4) rake to deploy everything -- I'm amazed no one has mentioned rake yet
5) gems to distribute everything -- another one I'm amazed no one has mentioned
Oh, and the Ruby community is just awesome ... thanks to
Matz - for writing this thing
Guy Decoux - for the mmap library
Jim Weirich - for rake and gems
Ara Howard - for all the awesome answers about threads and numeric
coputing with Ruby
Mauricio - rcov makes our Software Quality Engineers happy
howachen - for this fun thread
Blessings,
Tim Pease
PS We should have an official "Thank Matz" day. Send him money, or
an Apple iCard, or write a Ruby program that is a haiku and actually
parses and runs -- hmmm ... Ruby Haiku day for Matz
···
On 7/10/06, John Gabriele <jmg3000@gmail.com> wrote:
Interesting. Someone there said that Python is more like Java
and Ruby is more like Smalltalk. I've never written any
Smalltalk, but I know some Lisp. IMO, Ruby and Python are both
somewhere between Lisp and Java, Python closer to Java, Ruby
closer to Lisp.
I have learned many programming languages in the last two years
and the ones I like most are Ruby, Lisp and Haskell. There is one
thing these three languages have in common: It's easy and natural
to construct domain specific languages in them, allowing you
to write code that expresses more directly the problem at hand.
Consider Rake/Rant syntax:
task :a do
...
end
task :b => :a do
...
end
Or a well known (in the Haskell community) DSL in Haskell
is Parsec; an example from the Haskell wiki:
parseInput = do
dirs <- many dirAndSize
eof
return dirs
data Dir = Dir {dir_size::Integer, dir_name::String} deriving Show
Of course, Lisp is *the* language for DSL construction.
Python, and more so Java do not allow you to construct a DSL.
Thus in Python and Java, on the syntax level you are always
limited to the few constructs the language provides: Defining
classes and methods, constructing objects, calling methods,
arithmetic expressions, branches via if/else, switch/case.
This gets more limiting the bigger a project grows. Java people
compensate this via huge frameworks that interpret XML files.
Ruby's design is also more coherent than Python's. One example
where Python really f****d up are properties. Python's properties
are an ugly mess, just IMO.
If you already know Java/C#/C++, you'll gain much more in
learning Ruby than Python.
···
On Tuesday 11 July 2006 17:00, jmdeschamps@gmail.com wrote:
Doug H wrote:
> howachen@gmail.com wrote:
> > Besides ROR, can you give me a reason why perfer ruby instead
> > of python?
> >
> > seems to many users, they are very similar in nature...
> >
> > such as
> >
> > 1. non C or Java style syntax
> > 2. focus on codes readability, not like Perl
> > 3. ..
>
> Go ask this same question over on comp.lang.python and you'll see
> why you might prefer ruby.
Funny you ask: http://groups.google.ca/group/comp.lang.python/tree/browse_frm/thre
ad/40d8d11e12cb00ba/12306d4d9b0ce50c?rnum=11&q=ruby+or+python&_done=
%2Fgroup%2Fcomp.lang.python%2Fbrowse_frm%2Fthread%2F40d8d11e12cb00ba
%2F7256adbbc7f79afe%3Fq%3Druby+or+python%26rnum%3D1%26#doc_74bfb0743
eff1367
Jamey Cribbs wrote:
> James Britt wrote:
>>> Besides ROR, can you give me a reason why perfer ruby instead of
>>> python?
>>
>> The Ruby community is better-looking.
>>
> And more modest.
>
And more funny.
And has shorter answers. ;)))
···
From: Robin Stocker <robin@nibor.org>
Subject: Re: Why Ruby over Python?
Date: Sun, 9 Jul 2006 01:21:05 +0900
As a longtime Perler, I dislike Python's significant whitespace.
That's why
I could never go for it. Ruby just feels right to me. I enjoy
writing it
and it feels liberating when I do.
I still like Perl, but Ruby is quickly winning me over.
Let's be clear about this, though: people *are* allowed to like and
use more than one language This is a point that sometimes gets
obscured in these "winner-take-all" language comparison discussions.
Don't be a party pooper.
Next thing you know, people will start thinking it's OK to like and
use more than one Web framework, or more than one editor, or more than
one OS.
And what fun would that be?
Wait a minute ... there's *another* OS? This changes *everything*!
--
I got into Ruby because of Rails. I like Ruby because of the
readability, funcitonality, and object oriented approach not to mention
the integration with Rails. Perl is great and has a bunch of
packages/support because its been around a bit longer. I just finished
reading David Black's book about RoR and it increased my interest in
Ruby considerably. I guess to sum it up... less headache's >_<