views:

629

answers:

8

I'm a C# .NET developer and I work on mostly ASP.NET projects.

I want to learn a new programming language,

  • to improve my programming skills by experiencing a new language,
  • to see something different then microsoft environment,
  • and maybe to think in a different way.

I focus on two languages for my goal. Python and Ruby.

  • Which one do you offer for me ?
  • Pros and cons of them on each other?
  • Is it worth learning them ?

EDIT : Sorry I editted my post but not inform here,

Ruby on Rails replaced with Ruby.

+1  A: 

It's always valuable to learn a new programming language. And both Python and Ruby are good ones to know. It's important to note that while Python is a language, Ruby on Rails is a framework. IMHO, you should learn Ruby before you learn Rails.

Go try ruby! to see if you like it. If you do, then try Rails. Otherwise, try Python. Both are similarly useful. To me, Ruby is more "fun". If you like Lisp, you'll probably like Ruby. If you like C, you might prefer Python. Try them both!

jcrossley3
Ruby is a language on it's own, like you said it's a framework. Why not say Python => Django as Ruby => Ruby on Rails?
Garrett
+5  A: 

First... good for you for wanting to broaden your knowledge! Second, you are comparing a language (Python) with a web framework (Ruby on Rails).

I think your best option is to try a few different frameworks in both Python and Ruby, do the same fairly simple task in each, and only then pick which one you'd like to learn more about. Rails is nice for Ruby, but it's not the only one out there. For Python I like Pylons and Django.

Pros and cons: Ruby is a little cleaner, language-wise, than Python. Python has a much larger set of modules.

Is it worth learning? Yes, to both Python and Ruby.

dwc
Please define "Ruby cleaner than Python". I would tend to say that the opposite is true, and that is why I would like to know what you mean exactly.
ΤΖΩΤΖΙΟΥ
Python has a few mixed paradigm things in it, while Ruby is more "pure" OO. For instance, why dir(foo) in Python for introspection? There have been a few times I've tried to remember a method in Python only to remember it's a function instead. It's little things like that, and mostly not important.
dwc
He did say Ruby, not Ruby on Rails.
Garrett
Take note, his post was edited.
fuentesjr
A: 

If you're looking to learn Ruby on Rails, the guides site has a great guide for getting started and the further guides for improving your rails-fu.

Also, Tore Darell has written a Survivor's Guide for Ruby on Rails which could prove useful to you too.

Ryan Bigg
+1  A: 

I'd get in on Ruby. Seems to have a larger (or at least more active) community, the pace of new projects & continued development is second-to-none, and the learning resources seem to outnumber & outpace those of Python. I could be wrong, but these are my impressions.

fig
About 3 years ago I had the exact opposite impression, that's why I chose Python over Ruby. Probably Ruby caught up since then regarding learning resources, but back then I found a *lot* more Python stuff (books, articles, blogs etc.).
paprika
There is no indication that this is true.
fuentesjr
+1  A: 

If you're a beginner, I would recommend you try Django if you decide to start learning Python. Of course if you decide Ruby is your choice of flavor, Rails is the obvious way to go. Whichever language you choose, I can assure you it will be a good choice.

Having said that, my personal choice is Python. I like the language, I like the community, and I use Python for almost every occasion. I use it for command-line apps, GUI apps, and I use it for web apps (Django). Oh and I use it for system administration scripts on Windows and Linux as well.

Having said that as well, I would recommend you learn a language like Haskell or Lisp as well. That will really open your eyes to a new perspective to programming. Furthermore, since you say you are mostly familiar with the .Net framework, I would really recommend you start with F# since you'll already be familiar with the libraries and it will make the transition much more smoother. Either way, good luck.

fuentesjr
F# is on my list :) I really want to learn it, but first I want to try a non-ms language. thanks, good for the answer. +1
Canavar
+2  A: 

Rule of thumb - Python if you like strict rules and Ruby if you hate them.

Another one: if you adore JavaScript - Ruby is your choice :)

vava
I love Ruby, but will do almost anything to avoid writing JavaScript. Their ideas of objects may be similar, but JS syntax is plain old ugly.
Sarah Mei
I have completely opposite feelings about syntax, I love curly braces.
vava
+12  A: 

Both languages are powerful and fun. Either would be a useful addition to your tool box.

Python has a larger community and probably more mature documentation and libraries. Its object-orientation is a little inconsistent and feels (to me, IMHO) like something that was bolted on to the language. You can alter class behaviour at runtime (monkey-patching) but not for the precompiled classes and it's generally frowned-upon.

Ruby might be a little more different to your current experience: it has some flavour of Smalltalk (method-calling is more correctly message-sending for example). Its object-orientation is built-in from scratch, all classes are open to modification and it's an accepted - if slightly scary - practise. The community is smaller, the libraries less mature and documentation coverage is less.

Both languages will have some level of broken backward compatibility in their next majopr releases, both have .Net implementations (IronPython is production, IronRuby getting there). Both have web frameworks that reflect their strengths (search SO for the Django/Rails debate).

If I'd never seen Ruby, I'd be very happy working in Python, and have done so without suffering when necessary. I always found myself wishing I could do the work in Ruby. But that's my opinion, YMMV.

Edit: Come to think of it, and even though it pains me, if you're seeking to leverage your knowledge of the .Net framework, you might be best off looking at IronPython, as it's more mature than the Ruby equivalent.

Mike Woodhouse
I agree with Python (and I'm a Ruby user 100%). IronRuby will eventually mature, but IronPython is complete already and can access all of your usual .NET libraries, if you want to take it that direction.
Clinton Judy
A: 

What? No mention of IronPython?

IronPython is the flagship language of the DLR. It allows you to use all the familiar .NET libraries, but through Python.

I would definitely try Python and IronPython. You'll learn a lot and might even sneak it into your current projects (you can embed an IronPython engine in a .NET application).

orestis