Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This question is extremely subjective and open-ended. It might even sound like something I should just research for myself and make my own decision. But I'd like to put it out there and get some thoughts from others.

Long story short - I burned out with the rat race and am on a self-funded sabbatical this year. Much of it is to take a break from the corporate grind and travel around, but I also want to play around with new technologies and do some self-learning projects, to stay up to speed on programming, and well - I just love tinkering with programming, when there's no pressure!

Here's the thing: I am a lifetime C/C++/Java programmer. I'm a bit of a squiggly bracket snob since I've been working with this family of languages for my entire programming career. So I'd like to learn a language which isn't so closely syntactically related to this group. What I'm basically looking for is a language which is relatively general purpose, fun to learn, has some new concepts that are different from C++/Java, and has a good community. A secondary consideration is that it has good web development frameworks. A tertiary consideration is that it's not totally academic (read: there are real world jobs out there using it).

I've narrowed it down to Ruby or Python. My impression of Ruby is that it is extremely web oriented - that the only real application of it is as a server side scripting language for doing web stuff (mainly Ruby on Rails). I don't have much of an impression of Python at all, except that it seems to have a passionate fan base and appears to be a fairly versatile language.

TL;DR and to put it as succinctly as possible: which of these would be better for a C++/Java guy to learn to get some new perspectives on programming? And which is more open and general purpose and applicable to a wider set of applications? I'm leaning towards Ruby at the moment, but I worry to an extent that it looks like it's used as nothing but a server side web language.

share|improve this question

closed as not constructive by Mark Trapp Nov 4 '11 at 10:28

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
"For Python I'm not so sure"? Of what? How is this relevant? –  S.Lott Feb 1 '11 at 23:56
    
You can find a lot more on Ruby vs Python on StackOverflow. I am surprised that Lennart himself has not commented yet. regebro.wordpress.com/2009/07/12/python-vs-ruby stackoverflow.com/questions/1113611/… –  Job Feb 2 '11 at 0:30
    
@S.Lott: Sorry, wasn't clear ebough. Just meant that I don't have a very detailed impression of Python at all yet. Except that it's versatile and has a strong fan base. –  Bobby Tables Feb 2 '11 at 1:49
9  
Perl, of course. –  Bruce Alderman Feb 2 '11 at 2:09
    
This falls into the "What technology is better?" category of questions, which according to the FAQ are considered off-topic. –  ChrisF Feb 28 '11 at 11:38

8 Answers 8

up vote 30 down vote accepted

Don't let the fact the Ruby rose into the common parlance largely because of Rails (the web application framework) fool you. It is a general-purpose programming language, and you can use it for anything that you can use any other language for.

Play around with Ruby and see if you fall in love with it. You either will or you won't. It's kind of like the Grateful Dead's music; you either love it or you can't stand it.

Ruby will stretch your brain. In many respects, it is as far from C++/Java as you can get. I come from a C and C# background, and I found Ruby's dynamicness and meta-programming power to be quite intoxicating.

That being said, Python is an absolutely outstanding language, and it'll bust you out of your curlybracketness.

Why not learn both? I use both on a regular basis: Ruby for programming with Rails and Python for working with Google AppEngine.

share|improve this answer
1  
+1 for a Dead reference, ;) –  cschol Feb 2 '11 at 1:18
1  
Thanks. I'll go with Ruby first and see if I fall in love with it. :) –  Bobby Tables Feb 2 '11 at 23:39
5  
I'm a little late to the party, but trypython.org and tryruby.org are great sites to try out the languages. –  Brandon Tilley Mar 25 '11 at 1:20

I've hardly used Ruby, admittedly, but here are my impressions of Python:

  • when I write pseudocode to pencil out a function, I find that what I write practically is Python, and sometimes remarkably little rewriting is necessary to make it actual code. You might even skip the pseudocode all together and just express your thoughts directly in Python
  • when I need to do something that seems like a common task, Python tends to have the necessary functions (at a high level) built into its standard library. For instance, early on when I wanted to open a file and scan it line by line, the answer was as simple as 'for lines in myFile: dostuff(lines)'. This I believe they call the 'batteries included' approach, and it differs from some other languages I've used where everyday operations are a lot more fiddly

Those two things stand out to me.

share|improve this answer
    
I think those are exactly the reasons i prefer Ruby. Ruby is more OO and has less keywords. E.g. in Ruby "[1,3,5].length()" and "[1..10].each() ..." vs Python "len([1,3,5])" and "for i in range(1,11)" –  LennyProgrammers Feb 2 '11 at 9:03
5  
@Lenny - Ruby actually has more keywords: krijnhoetmer.nl/stuff/ruby/keywords vs. zetcode.com/tutorials/pythontutorial/keywords - for Python 2.6, that's 31 keywords for Ruby's 38. Also, 'more OO' seems to be used fairly subjectively here, since in both languages "everything is an object" applies (and even more literally with Python 3.x, as everything subclasses from object). Also, len(obj) is a shortcut for calling obj.__len__(), and for i in range also abstracts the operational details of operating generator objects. I think /equivalent but different/ is more accurate. –  Wayne Werner Mar 24 '11 at 10:49
    
i've got a feeling Lenny meant you use less keywords in your typical statement, for instance 'for i in range(1,11) has 3 keywords (for, in, range). Of course, sometimes more words is better. –  Andrew M Mar 24 '11 at 23:20
4  
range is not a keyword it is a function –  Kugel Mar 25 '11 at 0:10

If you are taking a whole year sabbatical, then I would suggest spending a week or two learning each and then decide for yourself which you like best. I have experience with both and in my opinion they are both so capable that you really just need to decide which one you prefer.

share|improve this answer
    
+1, Both seem pretty easy. Clojure, on the other hand ... is a lot of fun, but is also harder. –  Job Feb 2 '11 at 0:09

IMO, you should go with Python. The reason is that it is more versatile, you can use it for almost everything. Ruby is, as you noticed, more used in web development due to its web frameworks. Unlike Python, Ruby is not that good for development of gui desktop applications, numerical, statistical or image processing programs.

share|improve this answer
1  
Can you point out what makes Ruby "not that good for development of gui desktop applications, numerical, statistical or image processing programs"? When i was programming in Ruby in 2001/2002, i was happily doing all those things. –  LennyProgrammers Feb 2 '11 at 8:59
5  
@Lenny222. In Ruby there are no libraries such as numpy, scipy, sympy, PIL, matplotlib. Whatever numerical libraries they are, they are far behind that from Python. Similarly with documentation and libraries for development of gui applications. –  Marcin Feb 2 '11 at 9:24
1  
You say Python is more versatile and then point at libraries for why. I'll grant you that it's not as easy to do some things in Ruby for lack of a good library, but that doesn't mean Ruby itself is somehow less versatile. –  Twisol Feb 2 '11 at 9:52
    
@Twisol that's exactly the Why: Python being very simple (and consistent) is the reason why it's so versatile and why there are so many useful libraries (IMO). –  Nadir Sampaoli Apr 21 '13 at 10:37

Ruby has been around a lot longer than rails has, so let me put it out there in the world that Ruby != web, although it does that very well. There's a host of systems related things it can and does do. It just seems like the whole Rails framework swallowed up the rest of the Ruby world. And yes, I am a Ruby fan.

Python on the other hand has a lot going for it, and it has been integrated with nearly everything on Linux. That tells me it is probably fairly easy to incorporate into larger programs (compared to Ruby, Java, etc.). There's a fair amount of Ubuntu Linux infrastructure written with Python, which tells me that Python has application in systems programming. I hear its web framework is really nice, I haven't played with it yet.

That said, both Ruby and Python are equally capable languages, and you'll find them make your life a lot easier. Ruby has a lot more web heads in its community, but that's not the entirety of the community. I've used it on a number of infrastructure projects as well.

share|improve this answer

This is a special case of "Ideal Programming Language Learning Sequence" and similar questions. What you need is not "the one perfect language", you need multiple language paradigms and multiple learning experiences to open your mind up.

I know you said you narrowed it down to Ruby and Python, but I suggest you start with Racket (a popular Scheme). It's built for learning and it will nicely stretch your brain toward functional programming, interactive programming and dynamic typing. There are no jobs (literally zero), a very small, fragmented community, and no major web framework, which is exactly why you won't get stuck on it; fry your brains for awhile and then move on.

Second, you want to learn Ruby or Python for possible jobs. I suggest you learn both. Learning the second one of those two will be much easier than the first despite their differences. As for possible jobs, my gut feeling is that there's more Ruby work because of Rails, but I know there is also some Zope work in this area. Do invest in at least one of them, but also do check out the other one at least long enough to build something small.

Honestly, you will probably learn more your first week on the job with either of them than you ever learned by yourself; they both have big ecosystems with lots of tools and culture and idioms.

tl;dr: Both and Scheme.

share|improve this answer
1  
+1 All I saw was "the one perfect language" and "scheme". :) –  dietbuddha Feb 2 '11 at 5:31

I, too, came from Java/C++ background and have been programming in Python with the Django framework over the past 4 months and it's really great. Whenever I have a problem or question I can find explanations on existing posts. I can't vouch for Ruby since I haven't used it yet, but I'll definitely try it when I have some time.

I personally like how you can do stuff really quick with Python as it has a lot of useful functions built-in.

share|improve this answer

Id vote for Ruby. I came from .Net and C# background, tried Python first, but Ruby just charmed me=)
Im writing a lot of system stuff in it, and some Rails dev to. It is capable as Python in system programming, and is awesome at web. And it feels more polished to me..

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.