Lately, especially after these security vulnerabilities became public, I've seen a lot of hate directed towards both the Ruby and the Rails community.
I'm curious as to why this is, and I'd like to get HN's input on this. The Ruby community has a lot of drama from time to time, but that's the only reason I can think of. Where is the hate coming from of people who say everybody should just throw out Ruby, stop using Rails, etc.?
Personally I don't have any beef with them, but when I ask people about the RoR community I hear lots of douchebagery stories.
One of the most frequent is how cocky everyone in RoR feels towards other programmers in other languages and how "cool" their framework is and so on.
This started towards PHP programmers, then moved to Python(Django) and recently it's Node.js who's getting lots of flames from them.
So yeah..
Reason I'm asking is that my main client works with Rails, but it's a big and rather old-world company where this choice was shockingly 'modern'. There's little to none off this sentiment you describe though. Rails was a pragmatic choice, so we use it.
Ruby itself is a great language, and that's what it is at the end of the day - it's just a language. What matters more is the community gather under it. As with any community, there are members that tend to be immature and arrogant which may reflect to anyone as a representation of the entire Ruby community as whole. Worse comes to worst, these "few members" can affect the culture of the community especially for new users of the language, turning the community and the language somewhat "cultish".
And then, through unfamiliarity with what others learned a long time ago, they do it wrong.
As a random example, unit testing has been the standard for perl (note capitalization - I'm referring to the interpreter here) since it was released in the mid-80s, and for the Perl community since CPAN was created in the mid-90s. And when I say standard I don't mean that someone writes tests, runs it, then packages. I mean that - by default - nothing gets installed anywhere until it has passed its full test suite. Furthermore if I release a module to CPAN, I'll get automated emails about every OS and version of Perl that it didn't work on.
Core ruby still does not have good unit tests, and you have to go out of your way to run unit tests for gems. If you do that, you will find that a good portion were only set up for the author to run - they didn't think anyone else would ever do that.
And yet I've had Ruby devs with a straight face trying to tell me that Ruby is awesome for its testing culture, and everyone else has a lot to learn from them.
They are missing a lot, and don't realize it.
And could it be that as a result young, excited and still green developers, comparing themselves to the 'bad' previous web generation, get a bit cocky about it?
These are not rhetorical questions; I'm actually asking this. I came from humble hack-together-crazy-bad-php-apps, went through getting used to more frameworky stuff with Drupal, and then ended up at Rails with a certain comfort and a definite increase in best-practice. My first introduction to unit testing was through Hartl's tutorials, perhaps because I have no formal programming background. I could see how some people after a similar process get cocky about how great they are because they write tests.
I'm not defending cockiness or whatever characterizes the Ruby community. I'm just wondering.
You cite PHP. I would also cite Java devs whose first dynamic language was Ruby, and then went overboard.
Either way, enthusiasm combined with lack of perspective leads to annoyance for people who have that perspective, who realize that you're still missing some basic lessons. (Monkeypatching anyone?)
(Rails does deserve credit for promoting "convention over configuration" as a design concept, but plenty of us were doing similar things years earlier.)
Don't pay attention to them. There are many nice people in the Ruby community. People who are there for the code, and not the drama.
Now, don't get me started about those Visual Basic guys... :)
Coming from a Java background, I used to bang my head on the desk everything I had to write a boilerplate code for anonymous functions/classes.. luckily, there was Intellij IDE to ease the pain.
(Joke)
Ruby is overrated. Python is in most ways Ruby's equal, and in some ways a superior community. Groovy, on the JVM, with Grails can do the same sorts of things as Rails and gives access to the whole JVM ecosystem of libraries that is far larger than the GEMs collection. Scala is an important language that more people should use because it guides a developer towards writing cleaner code and using architectural patterns that lead to much more maintainable code.
That said, I would rather see people build things with Ruby rather than with Java or C++, so I am not one of those who would throw Ruby out entirely. If people decide to replace PERL with Ruby, I would applaud that action, even though I believe that Python is a better way to go.
But due to the negative factors in the Ruby community I would not advise anyone to learn Ruby as their first language because of the great risk of becoming a first-language fanboy. Better to start with something else, even PERL, C++ or Java, so that they have some perspective on programming languages.
Perhaps that danger is very situational. In my surroundings Rails/Ruby is not the hottest thing anymore, but we work with it for generally well-considered reasons. I was introduced to Rails at this company, and never had any illusions of it being the end-all of frameworks and Ruby that of languages, as none of my 'mentor' coders at the company did either.
But in my general surroundings I can definitely imagine high rates of fanboyism.
I tried to find examples of Ruby's awful syntax in tutorials, but much to my surprise, the code in the introductory sections of a couple tutorials picked at random looks clean and the language seems nearly Pythonic. Contrast that with a function from an actual Ruby on Rails project [1]:
def fresh_commits(repo, n = 10)
commits = repo.heads.map do |h|
repo.commits(h.name, n).map { |c| Commit.new(c, h) }
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
y.committed_date <=> x.committed_date
end
commits[0...n]
end
Whoa! This code apparently calculates factorials (with the ! operator), absolute values (of course |x, y| looks like the length of a vector), and biconditionals (to someone with a math background, a <=> b means a => b and b => a). The function ends with an expression on the last line that doesn't look like it would have side-effects. WTF? There are question marks and colons in weird places in that file, too. I started to translate the function into Python, to show you how much cleaner it would be, but I simply couldn't follow what the multiple nested map's and uniq is supposed to do. I'm certain that the Python equivalent would be much easier to follow. (Even if you take "equivalent" to mean "list comprehension" or "itertools.map" instead of the most readable alternative, nested-for-loops.)I don't think this project is particularly good or bad. I merely picked a random piece of Ruby code from an app I installed recently, and I feel the difficulties I had with the syntax of this function are representative of my struggles with Ruby as a whole.
All the strange symbols make Ruby code very hard to read. For me, the effort required to learn a language is directly related to the number of operator symbols it contains. Ruby is nearly as bad as Perl or shell scripts. (The operators-are-bad penalty to my impression of a language is reduced if same operator exists in other languages I already know well, like Python, C, C++, or standard mathematical notation.)
In Python, by contrast, you can usually get a fairly good idea of what syntactical constructs do without consulting the manual, even if you're unfamiliar with them. (To be fair, lambda is an exception.)
[1] https://github.com/gitlabhq/gitlabhq/blob/5a214ee6f198a90f41...
There is a lot of bad code out there, but you shouldn't judge Ruby by a random code snippet- Ruby is just the tool, and the developer is responsible to write clean code.
I don't know what the code is trying to do with all the nested mapping.. it seems like the first 2 lines break encapsulation of the Repo model, trying to gather all the commits. This is unrelated to Ruby, it's a "bad" OO design (might be wrong, I didn't read the rest of the code)
So lets ignore that, and just rewrite from line 3 and below:
def fresh_commits(repo, n = 10)
commits = repo.heads.map do |h|
repo.commits(h.name, n).map { |c| Commit.new(c, h) }
end
commits.flatten.uniq_by(&:id).sort_by(&:committed_date).first(n)
end
Do you agree that the last line is clean & readable, even if you don't know "exactly" what "&:function_name" does?I guess all communities can't be as tolerant and high-minded as C++ and the level headed discussions I see going on in the Linux kernel mailing list.