views:

156

answers:

5

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 introduction, 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 stuff 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 shall, 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.

Edit 1:

  • Being marketable is not a requirement. I'll worry about that after i've got my degrees.

  • I really don't have any time to learn yet another language. Learning Ruby, Haskell and Prolog is required of me, not a choice.

+1  A: 

If you want to learn computer science stuff, learn Scala. That is the computer science language of the future. See if you can learn that one ;)

Otherwise, Ruby is a good language to learn if you want to more marketable after your studies, as it's probably the easiest to get a job with afterward.

Algorithms and data structures are all well and good too, but don't forget architecture and high-level design. This is really important - to be able to design large-scale stuff that doesn't stink of poor design. Out of the 3 options, Ruby has a lot to show you here. So does Scala.

All the languages can do CS stuff, so I don't see how a language will be a detriment. Sure, one language may be more elegant than another, but people used to express CS-level stuff in C and C++ back in the day, so really, you can't go wrong if you're just trying to learn concept and not becoming fluid with a language.

Once you know a set of concepts, it's much easier to understand any language that uses those concepts.

egervari
I've edited my question in response to your answer. Could you expand on your thoughts on Program Architecture and Ruby? I also should've mentioned that I'm already very versed in computer science, I'm not a beginner.
stefano palazzo
Ruby's a good language out of the 3 because you can do basically everything with it, and it has the side effect of being useful after your studies. It's really a no-brainer.
egervari
It's not so much that one language will be a detriment, but that Haskell and Prolog are so *utterly* different that they'll be beneficial. You can't really develop a deep understanding of, say, backtracking logic programming while working in, say, C, without doing all the heavy lifting yourself. On the other hand, working in Prolog pretty much requires and nurtures that understanding. Haskell is similar with its purity and powerful type system. You're not going to get a good understanding of anything like that within Ruby—not without serious Greenspunning, which is a waste of everyone's time.
Antal S-Z
Also: not that Ruby's a bad language! I've used it, and I quite like it (though I'm a Haskell convert now). But it's really similar to Python (which I've also used, and also liked), and knowing one of the two means you won't learn nearly as much from learning the other.
Antal S-Z
Well, that's the thing, what style of programming does he want to learn? He hasn't specified this at all. If he wants to learn metaprogramming, Ruby is THE language to do that in. If he wants to learn concurrency, Haskell is probably the best of the 3 (no?). I say go learn actors in Scala because that's the future... but whatever. If he wants to learn objects, out of those 3, Ruby is totally the way to go as well. Note, if he could use Scala, he do EVERYTHING he wants. EVERYTHING.
egervari
@egervari: Ruby certainly has powerful metaprogramming, but I'm not sure that that's is in any way a "deep" feature of Ruby from a theoretical standpoint, which is the sort of thing the OP's looking for. (Not that there's anything wrong with that.) As for OO, since the OP already knows Python, he's not going to learn anything extra about OO *per se* from Ruby other than what he'd learn from spending more time coding. And while Scala seems like a great language (really!), it still wouldn't help with logic programming. It would help with FP, but Haskell's at least as good for that anyway.
Antal S-Z
+5  A: 

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.

robbrit
To be fair, if he's learning how to design OO 'the right way', he can do so on his own. Ruby even gives you a BasicObject to mess around with that contains next to nothing but the core mechanics of what it is means to be an object in Ruby for example. Design is purely up to him. The API's are just cosmetic.
egervari
+2  A: 

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.

jleedev
+1  A: 

I've been programming professionally over 20 years, and have many different languages, from assembly and C through various SQLs. Having that range gives me a good toolbox to pick through when I need to do something.

Every language has its strengths and knowing what they are will help as you progress in your career. No language is the end-all, be-all of programming languages and the more languages you know, the more you can accomplish and the easier you'll find it to learn new ones.

Greg
That's a very nice answer, but it doesn't quite relate to my question. at all. :-)
stefano palazzo
In 20+ years you might feel differently.
Greg
+1  A: 

The answer to the following two questions are, overall, the same:

  • If I already know Python, what will I learn from Ruby?
  • If I already know Ruby, what will I learn from Python?

The answer to both being:

  • Nothing important, other than a slightly different way of doing things.

They're both dynamic OO languages. Ruby lends itself to being slightly more functional, while Python has certain other things that are nice (list comprehension). Overall though, you're not going to learn much that's generally applicable to computer science by going from one to the other.

RHSeeger