I once discussed the phenomenon that is precisely communities with adjoining territories, and related to each other in other ways as well, who are engaged in constant feuds and in ridiculing each other -- like the Spaniards and Portuguese, for instance, the North Germans and South Germans, the English and Scotch, and so on. I gave this phenomenon the name of "the narcissism of minor differences", a name which does not do much to explain it. We can now see that it is a convenient and relatively harmless satisfaction of the inclination to aggression, by means of which cohesion between the members of the community is made easier. -- Sigmund Freud, Civilization and its Discontents
Look at Hibernate. As of the last time I used it (admittedly, several years ago), it was almost impossible to run raw queries against the underlaying database and get back simple result sets as arrays of tuples. You had either the abstraction, or nothing.
With ActiveRecord, you can at least get at the underlaying database connection via select_all and select_values, and turn Relations into SQL queries via '#to_sql'. It's not perfect by any stretch, and for some reason I don't understand Arel decided that being able to OR two queries together wasn't important, but you can leave the abstraction when you need to.
(Mongoid, the MongoDB ORM, is actually really well-designed in this regard; the Mongoid::Criteria works like Arel should, as does Sequel...)
ActiveRelation is very similar to the criteria api, but it still uses string parsign.
HQL is awesome.
That said, I haven't done Java for 3 years and am a 100% rubyist (and some lua)
The developments of rails are good. But they are simply all the stuff that maturing platforms will need. Rails is becoming JEE, but in a more developer friendly way. This is a good thing.
This is false, at least after tenderlove did all his work to re-write arel.
Here's the first Google hit I came across when looking to use PostgreSQL fulltext searches under Hibernate:
https://forum.hibernate.org/viewtopic.php?p=2447426
That's 50+ lines of code, plus some XML configuration, spread over four files, to perform a highly database-specific task that could have been better handled in raw SQL in a single line of code.
Also if I remember correctly, Hibernate, like DataMapper, requires that you specify your field types in the code, which makes migrations (updates to the DDL) a royal pain in the ass, and migrations are an important task in the operational lifecycle of an application.
I'm a big believer in having sole sources of truth, and so I treat the database as the only source for information about the structure of the database -- I don't want to have to specify that information in two places, where it can get out of sync.
Now, it's been years since I touched Hibernate, and it's probably gotten better. But from what I can tell, the above issues are design decisions; part of a conscious effort to hide the internals of the database from the developer, no matter the cost.
This is why people claim that ORM is an antipattern. Because, while an ORM solves 90% of your problems, for that remaining 10%, nothing beats being able to talk directly to the backend.
To execute custom sql, simply:
sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE FROM CATS").list();
one line of code.
When I think of "Python", I think of a mature, helpful, experienced, talented, well-educated community. I can generally trust their advice, I can trust their code, and I can trust their technical decisions. It feels like collaboration is important and encouraged.
The Ruby community, whether this is deserved or not, leaves a very different impression. Anything good is quickly and heavily overshadowed by the unnecessary and petty drama, the egos, the fixation on worshiping certain figures in the community (DHH, Zed, why the lucky stiff), poor technical decisions, inexperience, repeated displays of very immature conference behavior, and so forth.
In can reflect very poorly upon a language when the community is generally toxic, like in the case of Ruby, or very positively when the community is generally superb, like in the case of Python. This is true even when the languages themselves are rather similar, from a technical perspective.
I'm a Rubyist, and I've found that the vast majority of the community, events, interactions, etc are smart and civil. Yes, the Ruby community does have a bit of a publicity problem, but that's just the noisy/stupid minority.
Perhaps this is a common issue more broadly. (Are all PHP developers stupid? Are all lawyers money-hungry scum? Do politicians have no regard for intelligent discourse?) Our media (whether that be mainstream or Twitter and HN) is great at highlighting the controversy, but not a good source for a deeper understanding of the lay of the land.
Any community will have stratas of personality types that exist in various proportions:
* The loudmouth alpha types (DHH, Zed)
* The playful jesters (_why, Tom Preston-Warner) who are often evangelists
* The sharp-minded, code-focusing engineer types code (lots!)
* The newbies (lots, too!)
The Ruby community has been perceived as blighted with in-fighting, but it is, in my opinion, rather a case of certain people, the first type, trying to be public leaders, and failing at it. Those big sounds are just ill-considered publicity stunts. It's clear that DHH wants to be the Linus Torvalds of the Ruby community, blasting his way through perceived idiocy with profanity-filled speeches appealing to common sense and good engineering. Zed seems to want to be Jamie Zawinsky. Leadership does not come from being loud.
Ruby has its share of the playful and weird. Sometimes they give the impression of hyping something, because they bring with them their rosy-tinted version of the world where everything is fun and great. Sometimes they come across as glib and obnoxious because, well, they are, a bit. Overall I think they are an asset.
These two types are the people you encounter if you follow blogs and tweets, precisely because those two personality types depend on publicity. The Ruby community will certainly seem overrepresented by idiots if you go that route. But if you go on the Ruby mailing list you will see a different community, one that looks more like the Python people. Matz and many other core devs are conservative, highly technical, mature, and very helpful. There are also many low-visibility sub-communities that are very professional. My local Ruby meetup community in Oslo [1] is a wonderful bunch of highly technical, development-focused people who have none of the negative traits you describe. And if you go back to the question of what a community is supposed to provide -- help, insight, direction, ideas -- there are tons of great people.
That said, do I think the proportion of highly-skilled, high-technical is somewhat smaller in the Ruby community than the Python community? I do. Python has gained acceptance in more conservative, engineering/science/maths-oriented environments where Ruby has not yet reached, partly because of tools like SciPy. In fact, my feeling is that Python seems generally to attract a higher proportion of "engineer types" who are attracted by Python's rigidity (one way of doing things, etc.), compared to Ruby's often extreme malleability and laxness. This also means that the Ruby community is potentially missing out on some hard-core devs, and without support from the engineering/science/maths sphere it's never going to get things like SciPy.
And as for the newbies, Ruby has perhaps a bigger than usual share of inexperienced devs who are pollute the library space with lower-quality code. I blame this on the fact that Ruby is so simple to learn and has attacted many people through Rails, and this gives some devs a false feeling of confidence. I have had my share of time spent wading through other people's bug-ridden, ill-architected Ruby gems, but then if anything it's taught me to be careful.
[1] http://irb.no/
These result in two very expressive and potent languages with many similarities and with a lot of the best ideas of modern programming languages included (pure functions, lambdas, list comprehensions, etc.) but with fundamentally different core "belief systems" and zeitgeists.
Ruby is very, very much a "there's more than one way to do it" language, while Python utterly rejects that and adopts the "there should be one, and preferably only one, obvious way to do it" philosophy.
[1]: Obviously this is a very slap-dash comparison which isn't meant to be taken 100% at face value and is merely meant as a way to help illuminate the ideological differences between Ruby and Python, it's not an invitation to start a flame war.
Neither python nor ruby have any special support for pure functions, I suppose you could use some sort of decorator marking pure functions which one of those python subset compilers(or pypy) could use for performance optimization but I'm not aware of anything like this happening right now.
Also I don't think ruby supports list comprehensions it supports oo styled higher order functions, c# without the special syntax does the same thing. You may argue this is just a syntax but list comprehensions are just syntax that , you can rewrite them with nested for loops and appends(yields in the case of generator expressions)
I think in many although not all ways ruby is more of a smalltalk(but more practical).
Python doesn't exactly have an exact idealogical parent, although it has ABC as a historical parent(http://en.wikipedia.org/wiki/ABC_%28programming_language%29). Python outside of core imperative freeform do your own thing, want to write a oo based solution sure, want to write large imperative functions, go ahead, want to use modules to organize those go ahead. Want to use named function arguments or kwargs or objects or dictionary args go ahead. You can choose to use itertools, or your own yielding functions, or generator expressions sure.
Edit: I think I mean the communities are far apart.
(Makes me think of Scheme/Clisp too)
Meh, I use Ruby for most of my work (day and side projects) but have nothing against Python. If I was writing a script for something on the OS I'd probably use Python.
Some people just really want to feel part of a group, I guess, and publicly dissing "the other" makes them feel more included in that group, or something. As for me, I like to feel like part of a group too, but it's a more inclusive "programming" group, rather than focussing on any one particular toolchain.
I used to like those hello world concision contests, but in fact who cares? Who writes a single hello world code? What we need is a language solving the real problems met in most codebase, and I'd say the biggest fish here is the dependencies mess.
The less bloated the core syntax is, the clearer your ideas are which makes your code easier to read. I'm not saying methods should be arithmetic symbols - I think short words with not much syntax around them makes for more readable code.
ruby tends to read like pseudo-code, which is a great way to express the code idea of your algorithm when you're thinking about it, and when you're reading it back later.
I often have discussions with colleagues about different coding idioms in Python, and I hear often "this one is better because it is less typing". I don't think this is very valid. If everything is equal, then sure, go for less typing. But using locals() instead of explicit arguments when calling a template rendering because "it is less typing" seems not strong enough an argument to me.
I stay away from Python because it is similar enough to not give me any great benefits over Ruby, while it has some warts (to me) such as the whitespace handling, that makes it uninteresting because it is so similar that the payoff in accepting what I consider warts is too small to warrant it.
I'd have been a lot more willing to ignore the things I don't like about Python if the differences in other areas were major.
It's their very similarity that gives rise to the strong feeling. René Girard's theory of mimetic rivalry sheds light on this.
Edit: Alternatively, http://en.wikipedia.org/wiki/Narcissism_of_small_differences
Python - is "executable pseudoscript". It does not have ruby elegance, perl "worse is better", javascript ... minimalism(?)
I'm using python for prototyping. As communication tool.
I can describe all python scetches to every programmer, be it javer, c-sharper, C-developer or SQL-er.
Can I use perl/ruby/CSharp/Java/F#/Haskel?
Answer is NO.
Perl: sigils, regexp everywhere (when it not needed), parameters passing, "use strict", strange OOP - all those features makes it impossible for prototyping.
Ruby: it's the same as for perl. It looks more pleasant to eyes but it is no way "pseudocode" that everybody can read.
C#/Java - prototyping is a joke. And I can't use sharp-code for javer and otherway.
F# - F# is looking a lot like "pseudo-script". But the main strength - type system is not helping in prototyping.
LISPs - I think that LISPs are good for prototyping. The only problem - they are LISPs.
> Ruby: it's the same as for perl
Nothing you said about Perl can be applied to Ruby.
You need to explain that 0 is True.
You need to explain blocks, (int_number).times and other cute things.
And I heard a lot of complains for whitespace, but begin-end is more irritable for many.
Easy: it's not C.
The idea that zero is false only makes sense if you're trying to code very close to the metal. To everyone else it's baffling.
Right, except none of the reasons you gave for why perl is a poor pseudocode apply to Ruby, so you need to make that point yourself.
> You need to explain that 0 is True.
The truth values of integers don't usually come up in pseudocode.
> You need to explain blocks, (int_number).times and other cute things
I agree that the concept of passing around a block of code is hard to implement in less expressive languages, though cases like "each" and "map" can be simply translated to for loops. You could make the same criticism about Python's lambdas or list comprehensions.
n.times is perfectly useful pseudocode, though. Think of it as a shorthand for "for(i = 0, i < n; i++)".