Python vs. Ruby, Again

The level of a language has always become an interesting phenomenon. I can see that most young languages tend to “raise” their language level; making it closer to humans (programmers) than to machines. The benefits of a very high level language is of course obvious: programmers code less and become more productive. Most computers todays are fast, and productivity is better than (insignifficant) performance gain in most cases. And up to today… I can see two languages that have top-notch language level: Ruby and Python.

Both Ruby and Python are the most famous all-purpose scripting languages. By all-purpose, I mean it is used to solve diverse and different sets of problems as easy as possible. By scripting, I mean that from coding to execution phase, one does not have to do a compilation phase (at least apparently so). Just from these factors, we can see that all-purpose scripting languages are very high level languages: more closer to natural language than machine language.

My views may not be that valid: I have never made non-trivial programs in any of the languages. My view can be regarded as the view of someone that is eager to learn either Ruby or Python, and make decisions based on preliminary tutorials, language power, and complexity. This first-time impression is more important than most people think – a good impression will let more people join the language community and then contribute to it, thus strengthening the language.

At the first glance, Ruby looks very powerful. For example, to print hello 5 times, we can write 5.times { print "hello" } in Ruby. Cool eh? Ruby’s paradigm (Everything is Object) is one of the best IMHO. Ruby does not merely “support” OOP; Ruby builds on OOP. Its magnificent access control, mixin mechanism, and operator overloading is often left behind by other modern programming languages (e.g. Java expelled operator overloading, Python has no real access control).

However, after skimming the whole Ruby tutorial, I feel that although some claims that Ruby is easy to learn, it is not that easy. There are lots of things one must learn from a typical C or Pascal programmers: closures, blocks, variable name convention… (we assume that that person knows OOP). These are language features, however, which made Ruby more complex than Python (and more complex can be better or worse; it depends).

Compare Ruby to Python. In Python we can’t of course write 5.times { print "hello" }. One should write for i in range(5): print "hello", a typical procedural flavor. Its grammar is much more concise than Ruby, and maybe the most concise of all programming languages, mainly because it terminates statement group automagically according to indentation. The learning curve is, IMO not very deep: Ruby’s is deeper. The new stuff (primarily slicing and list comprehensions) can be ignored when teaching starters. I also have the impression that Python has better and larger community than Ruby; for example, there are no Ruby game programming projects or community with size matching that of PyGame. Python is even used by Google.

Python sadly does not feature a great new paradigm shift: it merely simplifies coding to a certain extent (but it does it well, admittedly). Python also got a minus point in it standard libraries, because they have no standard class, module and method naming convention (it got mixed up in joinedwords or underscore_separated_words and even camelCase and PascalNotation). Ruby seems to be good at using PascalNotation for classes and underscore_separated_words for class methods, and even has wonderful conventions for destructive, non-destructive and query functions (with ? and ! in the end of function name), as well as class, instance, global, and local variables.

My conclusion is that while Ruby offers a better ideology in programming, Python’s community and simplicity wins over it. Both are great programming languages, and Python only wins by a tiny fraction. If Ruby expands well and gained substantial addition to its community base, I am sure that Ruby will tip over Python some day.

12 comments

times 5.

You can do the following in Python:

>> print "hello" * 5

Your point about python not being fully object-oriented still stands.

Sbobet Indonesia.

After read a couple of the articles on your website these few days, and I truly like your style of blogging. I tag it to my favorites internet site list and will be checking back soon. Please check out my web site also and let me know what you think.

Hay All.

I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Bola Tangkas

Its a great pleasure reading.

Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work 338A Casino

This is great and rewarding.

This is great and rewarding post,i consider to recommended it.

The blog post something new! .

The blog post something new! It is much updated information and covered in depth with qualified quality. Thanks much

Obat kanker rahim.

After I finished reading this article you turned out quite talented in writing. Obat kanker rahim

Obat kolesterol tinggi.

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon...
Pengobatan epilepsi
Pengobatan batu ginjal selain operasi
Obat asam lambung yang aman buat ibu hamil
Cara pemesanan obat herbal ace maxs
Obat tbc

Cara Pemesanan Ace Maxs.

Ordering Ace Maxs is your law in order to recover from various diseases, Allah Raziq Allah Malik Allah Khalliq Visit me and Join us =====> Cara Pemesanan Ace Maxs trust me :) its world !

andriana.

We stumbled over here from a different web page and thought I might check things out.
Cara Pemesanan Vig Power Capsule We’ve always promised to protect the things that are the most important to them: their assets, their peace of mind and even their dreams, La sélection alternative de la semaine #23″ : en français, le symbole pour « numéro » est « N° ». Pourquoi ne pas l’utiliser, au lieu du croisillon anglosaxon ?
C’est trop moche ? we i me andriana

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <pre> <i> <b>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.

Recent comments