views:

321

answers:

8

I'm considering learning a new language as an alternative to PHP. I'm considering Python and Ruby. Which one is a better language based on the following four criteria, and any other qualifiers you may have?

  • Which is more stable?
  • Which is more scaleable?
  • Which is more secure?
  • Which is easier to learn?

EDIT:

Keeping the original question intact, I'd like to add one more pair of questions.

  • Which is quicker to code with?
  • Which is quicker to learn? (Based on personal experience only please - to avoid holywars.)

EDIT2:

Sorry for not clarifying - mostly web development, some desktop programming would be a nice bonus.

+15  A: 
Both are stable 
Both are scalable 
both are as secure  
Both are easier to learn !!

So what matters?

Your taste. Taste them both and proceed with one that seems more palatable :)

pyfunc
I totally agree. I came from a PHP background and ended up learning Ruby and Rails but my main reason for making that choice was access to an excellent mentor to show me the ropes. @Moshe -- If I had to pick a reason to choose one over the other that would be it, go with one where you have access to someone with a good understanding of the language and you'll have a much easier time learning it.
Ganesh Shankar
@Ganesh Shankar - Well, a friend of mine does Python, so that may settle it.
Moshe
This is a very good answer.
Swanand
+1  A: 

I personally would prefer Ruby, as it goes wonderfully with the Rails framework and is a blast to learn and to work with.

I have only used Python a few times. While I know it is powerful, I have never really fallen in love with it the way I have with Ruby (and specifically the Rails framework)

webdestroya
@webdestroya : Thats the point!. I started out with both ruby and python and I have only continued to use python as it tasted better to me. :) There is not much that makes them different from each other.
pyfunc
A: 

http://c2.com/cgi/wiki?PythonVsRuby

http://www.nextdoorhacker.com/2010/02/ruby-vs-python-battle-to-death/

http://blog.peepcode.com/tutorials/2010/what-pythonistas-think-of-ruby

Just at the top of the Google results. I've read most before; good articles all. Fundamentally, they are very similar; there are a couple of important philosophical differences that make it a trollworthy subject.

Amadan
+1  A: 

To get a quick feel for each and see which one "tastes" better I would suggest taking each one for a spin on a selection of problems on ProjectEeuler. PE is more about algorithms and math but some of thee simpler problems are a great way to get going with syntax and some core library features such as file IO etc.

Paul Sasik
Interesting. ... Link for PE please? (I'm Googlazy.)
Moshe
+2  A: 

These two languages are so similar that any strong preference will be mostly subjective. They are both the correct answer.

Chuck
+1  A: 

No significant difference on the first four criteria.

No significant difference on coding speed either - you're going to be slow in both at the start, then you'll get faster. Ruby may be slightly better at managing libraries (Ruby Gems) but Python probably has slightly broader library coverage. No big deal either way.

Coming from PHP, I'd guess that Python might be slightly quicker to learn. That might be a reason for choosing Ruby - you might learn a little more.

There are a lot of "mights" and "slightlys" there. That's because the two languages are much more similar to each other than either is to PHP. Neither is particularly hard to learn - I'd suggest spending a little time with both and then going deeper with the one you prefer.

Mike Woodhouse
+1 for the Zen part about taking the _slightly_ longer way learning. :)
Mladen Jablanović
A: 

i think you should prefer ruby, while python is assumed easier to learn!

python is so friendly great language but you rarely find servers with python support most are expensive one's, ruby on rails is great framework many frameworks for other languages are drives from , great cake php is a sort of such a thing.

ruby on rails can be found on many servers. how ever if you have specified applications with special clients you can go to python and it's funny frameworks.

by the way, i had a lecture on ruby i had a article claim that ruby is a bit more efficient and more quick.

amin
run a VPS and install the python version you want.
Christopher Mahan
a presentation on ruby: http://www.scribd.com/doc/3677979/ruby-presentation
amin
dear christopher mahan Vps cost too much more than a simple web host not public usage is possible, ypu can't force your clients to pay for vps for dedicated or a expensive server.
amin
A: 

pyfunc pretty much said it, but I'd like to offer two more thoughts:

1) Ruby will probably end up being a tiny bit more familiar as it a) can often optionally use a more C-like syntax, b) is not structured quite as foreignly as Python coming from PHP

2) They can both scale well, but Python will probably give you the most bang for your buck (CPU wise - and if you use Ruby, you're probably pretty well off using Ruby Enterprise and mod_rails, aka phusion passenger).

That's all - even considering those points, the difference may well be negligible, as the power of the language is all about how you use it, regardless of its inherent pros and cons.

mway