Live data from Hacker News

Can anyone explain why Ruby is so popular?

news.ycombinator.com

21–30 of 46 posts

Re: Can anyone explain why Ruby is so popular?

#21
I am a perl dev for almost 3 years and i learned it at my job after i tried ruby and python.

For more than a year i felt i should have chosen ruby because of how intuitive it feels: you read the code always from left to right, whereas in perl you often either go from right to left or from the center of the line outward. Besides that, fuby also has that principle of less surprise.

However, after I got accustomed with perl, i started to love its expressiveness and flexibility. And now, I almost got to love the "there's more than one way to do it" mantra. Regarding Python, I see it more close to Perl from a readingness perspective, but with much less flexibility embedded.

Re: Can anyone explain why Ruby is so popular?

#22
Metaprogramming syntax isn't built in to ruby. Instead, it's really internally consistent and lets you leave out a few tokens, which means it's really easy to write libraries with beautiful interfaces.

The built-in features usually try to solve the general case, rather than focusing on specific use-cases. For example, in python you have iterators, which make it easy to have a block of code that is run multiple times with different bindings. In Ruby, you have block syntax, which solves the more general problem of "let me pass this anonymous block of code to this function", and they built iterators on top of that.

Re: Can anyone explain why Ruby is so popular?

#23
post #4

Ruby is popular because of Rails. If you're not going to use Rails, I don't see much reason to learn Ruby as in my opinion Python is easier to learn and is applicable to so much more than Ruby. That said, I agree that the syntax did feel like a hybrid of Python and Perl (with a bit of crack mixed in) - but once I started playing around with it, I really started to appreciate the syntax.

Rails is a big part of Ruby's popularity, but let's not forget the impact of Chef and Puppet as well.

Re: Can anyone explain why Ruby is so popular?

#24
post #13
post #5

I'm interested in the answers to these questions: 1. What does Rails do that Django doesn't? (Feel free to substitute any other Web framework for Django if you think it'll help your answer be more illustrative.) 2. Why hasn't the Python community seen whatever Ruby's doing and copied whatever makes Ruby popular? Are there any Python/Ruby experts reading this who are willing to port or reimplement the good parts of Ru…

For #1 everything I've seen points to rails and Django having a nearly 1 to 1 correspondence. It's just preference for the most part.

It really doesn't - Rails comes with a lot of things that Django does not by default. Off the top of my head, Django does not come with database migrations, environment based configuration or an asset pipeline. You can add those things to Django, but you need to either use a 3rd party library or roll it yourself. I believe Django database migrations are coming, based on South, but if they'll land in 1.6 I don't know.

Re: Can anyone explain why Ruby is so popular?

#25
post #5

I'm interested in the answers to these questions: 1. What does Rails do that Django doesn't? (Feel free to substitute any other Web framework for Django if you think it'll help your answer be more illustrative.) 2. Why hasn't the Python community seen whatever Ruby's doing and copied whatever makes Ruby popular? Are there any Python/Ruby experts reading this who are willing to port or reimplement the good parts of Ru…

> 1. What does Rails do that Django doesn't?

The answer is, basically, "Have a larger ecosystem without being Java." There are a few things each has by default that the other doesn't, but by and large I don't think people pick Rails because it has 8 million features and Django only has 7.95 million.

> 2. Why hasn't the Python community seen whatever Ruby's doing and copied whatever makes Ruby popular? Are there any Python/Ruby experts reading this who are willing to port or reimplement the good parts of Ruby in Python?

Just about anything worthwhile already has an equivalent. The reason Ruby is popular is not really about features. Ruby is popular because Ruby managed to capture people's imagination. When the new generation of webdev was first coming around in the mid-2000s, Ruby had a huge burst of enthusiasm. Everybody was enamored with Ruby on Rails, and Ruby itself had lots of fanatical evangelists like Why who were eager to teach people. Python, ironically, was hampered by the fact that it was more mature and thus it was harder to get people excited about it. Additionally, Rails was the killer app for Ruby, while Python took a relatively long time to put out a comparable product. I don't remember if Django existed, but there certainly wasn't the situation you have today where Django is basically the "Python Rails" and they're seen as being on roughly equal footing. Instead, Pythonistas were all talking about how you should take Twisted and twelve other libraries and you just write all this glue code and then it's sort of like Rails if you squint really hard — and nobody really found that exciting either.

This isn't to say that Ruby doesn't have actual benefits to recommend it. Rails is a very nice, mature environment for web development, and Ruby as a whole has a very nice ecosystem these days. But the reason it got where it is is because Ruby won people over eight years ago, and it's gotten where it is today from that momentum. It isn't that Ruby is miles ahead and Python is simply inferior, but that Ruby just got a head start in that field and inertia matters a lot.

> 3. Are there any other reasons to prefer Ruby over Python besides Rails? For example, do Gems do things that are impossible with Pip?

The culture of the two languages is sort of different. Python invariably loves explicitness. Ruby isn't as crazy infatuated with "magic" as it used to be, but it's still much more acceptable over there to do weird tricks that let you write code the way you want to (e.g. "this magically executes in a context with functions that aren't available elsewhere") instead of the old-fashioned way. A lot of people prefer the latter, so they like Ruby. A lot of other people hate that kind of code, and they will be much happier using Python.

Re: Can anyone explain why Ruby is so popular?

#26
post #18
post #10

Earlier quoted context omitted.

I don't know about the first question, but: 2) Because Python would become Ruby, or at least Pubython, then. What attracts most people to Ruby is its humanist syntax, not sure what Pythons guiding philosophy behind the syntax is, but I tried both and ruby was just a lot better. 3) There is loads of little things that are just personal preference for me, but the choice of language always boils down to personal prefere…

> Pythons guiding philosophy behind the syntax Python's syntax philosophy in a nutshell: The more your program looks like line noise, the harder it is to read. Operators should be simple and minimal, operations like list comprehension should match existing usage in English, mathematics, or C. > ruby was just a lot better Here's a Ruby snippet. I don't want to pick on this particular project [1], rather, I've found th…

"Implications"? Is that a weird word for a block or what?

Re: Can anyone explain why Ruby is so popular?

#27
post #19
post #9

I love Ruby's syntax. I tries Python, but I didn't like it as much as Ruby, what putt me off about python is the meaningful indentation (although I do not mind that in CoffeeScript). Also, Ruby itself is not slow, but CRuby (MRI, YARV, whatever you call it) is slow; Rubinius ("rbx") is a wonderful (and my personal favourite) alternative for MRI. In fact, I use rbx and EventMachine for a fun app that has a growing num…

Can you elaborate on what put you off Python's indentation?

Not the OP, but meaningful whitespace is an abomination unto the world.

It's difficult to elaborate on something that is a matter of taste, but some of us need our code blocks visually bookended.

Re: Can anyone explain why Ruby is so popular?

#28
post #26
post #18

Earlier quoted context omitted.

> Pythons guiding philosophy behind the syntax Python's syntax philosophy in a nutshell: The more your program looks like line noise, the harder it is to read. Operators should be simple and minimal, operations like list comprehension should match existing usage in English, mathematics, or C. > ruby was just a lot better Here's a Ruby snippet. I don't want to pick on this particular project [1], rather, I've found th…

"Implications"? Is that a weird word for a block or what?

He/she means that `=>` looks like a mathematical implication, just like `|...|` looks like absolute value bars.

Re: Can anyone explain why Ruby is so popular?

#29
post #25
post #5

I'm interested in the answers to these questions: 1. What does Rails do that Django doesn't? (Feel free to substitute any other Web framework for Django if you think it'll help your answer be more illustrative.) 2. Why hasn't the Python community seen whatever Ruby's doing and copied whatever makes Ruby popular? Are there any Python/Ruby experts reading this who are willing to port or reimplement the good parts of Ru…

> 1. What does Rails do that Django doesn't? The answer is, basically, "Have a larger ecosystem without being Java." There are a few things each has by default that the other doesn't, but by and large I don't think people pick Rails because it has 8 million features and Django only has 7.95 million. > 2. Why hasn't the Python community seen whatever Ruby's doing and copied whatever makes Ruby popular? Are there any P…

> Python took a relatively long time to put out a comparable product. I don't remember if Django existed, but there certainly wasn't the situation you have today where Django is basically the "Python Rails" and they're seen as being on roughly equal footing. Instead, Pythonistas were all talking about how you should take Twisted and twelve other libraries and you just write all this glue code and then it's sort of like Rails if you squint really hard — and nobody really found that exciting either.

This is the most informative part of your comment. I came to Python around version 2.6, and Django was already pretty near its modern form. I also first started hearing about Rails at that time, so my perception was "Python has always had Django, and Rails is a new thing." If Rails is older than Django, that explains much.

> Python invariably loves explicitness

Before I used Python, Java and C were my main languages. I was amazed at how short programs became in Python. For this reason, saying "Python loves explicitness" strikes me as strange, since it gets rid of braces, semicolons, variable declarations, the 'new' operator...

> A lot of other people hate that kind of code, and they will be much happier using Python.

This is totally me. I've ranted elsewhere in this thread about Ruby's syntax. Maybe some clever person will write a Python-to-Ruby translator someday so you can use Rails without having to deal with Ruby syntax.

> inertia matters a lot

I'm just a little surprised the momentum isn't swinging back to Python. Since IMHO Ruby's syntax makes the language...very undesirable, and if I was forced to use it to take advantage of tools that only exist in Ruby-land, I'd be looking to switch back to Python as soon as the tools were ported -- and even devote effort to helping with ports.

Everybody was excited about Perl in the beginning, but very few people still code in Perl these days. I think Ruby suffers from similar problems and will eventually be eaten by Python.

Re: Can anyone explain why Ruby is so popular?

#30

I personally love the syntax, and in my own experience is not that slow, I use it with Sinatra and my productivity is huge. I'm also a C# and Delphi developer. I learned Ruby cause I had the need the learn an scripting language, and the reason to not learn python was that it looks like it is stock for ever in the 2.7 version, so I chose Ruby and I'm very pleased with my decision.

It's interesting that the two responses on here (yours included) so far mention that it was learned for scripting. The main reason I made the initial post is because I see it being used for much more than just scripting, ie. rails and ruby motion. It seems somewhat naive to use a scripting language in leui of a real language when coding something industrial. So I still am at a loss... Thank you for your comment, yeah…

> python's requirement of object methods requiring the self arg

I originally hated it too, but it's grown on me. I've come to the conclusion that it's good to have that explicit signal that something is a member variable rather than a local. And I've started adding explicit "this." to member variables in all my Java programs.

Post reply on HN