Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What will a Python programmer gain by learning Ruby?

I am going to be learning Ruby, Haskell and Prolog at university. Now, I'm wondering what should get most of my attention. I have half a year to do all three, which means I need to decide on one language to get my extracurricular time. The others I will learn just enough to do very good in the course.

I am familiar enough with Haskell and Prolog to know that learning them will teach me a few very important concepts of computer science. I'm not so sure about ruby.

Going through a few tutorials and introductions, I get the impression that ruby is a lot of shallow magic. Now I'm asking the ruby people: What will I have gained, should I decide never to use it again, after I've spent half a year learning it, that Python didn't already teach me.

This question is not intended to "make the case" for ruby, although I realise this is a potential topic of great argumentation.

I use Python for all my CS work now. I have done quite a bit of functional programming with it as well. I am also, already, quite familiar with object oriented programming (in Java, Python and C#). And I will, as I said, do some Logical programming with Prolog.

What then is left for Ruby to teach me?

To further dilute the question:

  • I'm not interested in writing fun programs, or cool web applications. I'm just interested in the Computer Science bits. Implementing algorithms, data structures and so on. (Although having fun surely won't hurt)

  • Ideally, concepts discussed need to be learnable in about 1.000 hours.

  • I'm not at all interested in Rails. Any technology that hides complexity is, in this case, detrimental.

I can't help this question being argumentative. But an ideal answer to this question will mention a profoundly important concept of theoretical computer science that ruby helps the programmer use and understand in order to gain scientifically adjuvant knowledge.

To candidates I came up with are Meta-programming and Multi-threading. I don't know if ruby is particularly great to learn either of them.

like image 573
Stefano Palazzo Avatar asked Oct 24 '10 14:10

Stefano Palazzo


People also ask

Should I learn Ruby if I know Python?

The Ruby programming language is frequently compared to Python for their similarities. Many developers say that learning Ruby is easier if you know Python due to their similarities.

What is the benefit of learning Ruby?

Developer happiness A vast amount of libraries and resources for learning, a helpful and active community, well established best practices and beautiful, readable syntax — all this makes Ruby a programming language that is a pleasure to work with. It's a language oriented on developer happiness.

What are the advantages of Ruby over Python?

Advantages of RubyRuby has a clean and easy syntax, which allows a new developer to learn very quickly and easily. Just like Python, it's open source. Ruby language was developed to make the developer's work faster, and it gives freedom to developers to develop any size of the web app in shorter time duration.

Is Python easier to learn than Ruby?

Whether you should learn Ruby or Python depends on the applications you want to use programming languages for. Ruby is more difficult to learn than Python and is best for web development and design. Python is ideal for data science use cases, and it's best for tech newbies.


2 Answers

For the most part, nothing. Most of Ruby's strengths/weaknesses are the same as Python's, except that Ruby is slightly more "functional". However if you have Haskell as an option, much more can be learned about functional programming from Haskell than from Ruby.

Second, if you're looking at things from a theoretical computer science perspective, then Ruby is far from a language of choice. Ruby and a lot of its libraries break a lot of standard OOP dogma which I believe many academics would find repulsive (this is based mainly on my chats about languages with various professors).

From an academic perspective I think Haskell would have the most appeal to you. If you're interested in AI or logic, then Prolog is also an excellent choice.

like image 171
robbrit Avatar answered Sep 24 '22 05:09

robbrit


Ruby and Python are quite similar in terms of the real CS that your brain will get out of it — the differences are largely cosmetic and pragmatic. Areas in which they are essentially the same:

  • Both languages are strongly, dynamically typed.
  • Both support many paradigms like functional, object-oriented, etc.
  • Ruby has a little more fluff/sugar (similar to Perl), while Python believes that explicit is better than implicit.

If you are interested in interpreters, frameworks, and testing, it can be worthwhile to battle the two, but from a theoretical standpoint you will learn much more from Haskell or Prolog.

like image 26
Josh Lee Avatar answered Sep 24 '22 05:09

Josh Lee