views:

7221

answers:

19

Considering the criteria listed below, which of Python, Groovy or Ruby would you use?

  • Criteria (Importance out of 10, 10 being most important)
  • Richness of API/libraries available (eg. maths, plotting, networking) (9)
  • Ability to embed in desktop (java/c++) applications (8)
  • Ease of deployment (8)
  • Ability to interface with DLLs/Shared Libraries (7)
  • Ability to generate GUIs (7)
  • Community/User support (6)
  • Portability (6)
  • Database manipulation (3)
  • Language/Semantics (2)
A: 

I know it's not on your list, but at least look at perl.

  • Richness of Api/Libraries to sink a ship.
  • Runs on more systems than most people realise exists.
  • Works well with Binary libraries.
  • Has a huge community.
  • Portability, See above.
  • Database manipulation: more ways to do it. ( Pick your favorite module )
  • And one of the most expressive/terse languages around.
Kent Fredric
A downside of perl for those unfamiliar with it is the lack of organization of its plethora of modules. There is, at least to my knowledge, no convenient way to find the most suitable of a number of available modules for a particular task. The fact that there are so many options is wonderful, but there should be a better way to sift through it all for modules that are considered production-ready and/or commonly used and/or full-featured and/or lightweight and/or compatible with various perl releases (for example, some newer versions of modules only support perl 5.10).
intuited
@intuited Perl isn't my favorite language, but you've got it completely backwards. Perl is the one language I know where it's easiest to find suitable modules. CPAN (http://search.cpan.org/) has lots of ways to determine suitability: automated tests performed on new submissions on many OS platforms; ratings and comments; sane naming and namespace conventions, etc. CPAN is better organized than RubyGems and PyPI.
Mark Thomas
@Mark Thomas: It seems like the cpan site functionality could use some work. I was until just now unaware of the [dlsip](http://search.cpan.org/dlsip) rating system that is displayed when you browse through categories, because it's not displayed when you do text searches, which is how I usually do things. This is a tremendously useful dataset, but I don't understand why it's not consistently displayed. Actually that seems to be the only context in which it *is* displayed — it doesn't even show up when you go to the module's page.
intuited
@Mark Thomas: I'm also still looking for the "advanced search" page that will let me search for modules meeting certain criteria from the dlsip, user ratings, version number, etc. Does this exist somewhere? __________ Granted, PyPI doesn't have this sort of functionality either, although the "Score" column in PyPI search results is at least vaguely useful. The tendency for Python module development to converge, in many cases into the standard library, makes it somewhat less important. It's also helpful that the "Production Status" of a module is usually given on that module's page.
intuited
Items that have been rated tend to come up higher precedence, and the score of their rating affects the order of rated items. =)
Kent Fredric
+22  A: 

I think it's going to be difficult to get an objective comparison. I personally prefer Python. To address one of your criteria, Python was designed from the start to be an embeddable language. It has a very rich C API, and the interpreter is modularized to make it easy to call from C. If Java is your host environment, you should look at Jython, an implementation of Python inside the Java environment (VM and libs).

Ned Batchelder
+6  A: 

I think you missed one criterion:

  • Familiarity among project team (10)
Greg Hewgill
I think any programmer worth his salt should be able to get his feet wet with any procedural or OO language with only one hour of tutelage by an experienced team member, and be productive within a work week. If a language or tool is best for the job, the cost of learning should be no object.
Pistos
Project team is equally unfamiliar with all 3! Looking to invest time to learn one of the 3.
Prembo
Prembo: fair enough answer. :)
Greg Hewgill
Pistos: if no one on the team has used the language before, you're going to write less maintainable code on your first time out. "Being productive" and "optimally professional code" are very different ballparks.
Dean J
+1  A: 

This sort of adding-up-scores-by-features is not a good way to choose a programming language. You'd be better off choosing whichever you know the best. If you don't know any of them, try them out for a little while. If you have a really specific project in mind, then maybe some programming languages would be better, but if you just have general preferences you will never come to a consensus.

That said, Python is pretty flexible, it's the most popular on your list so the easiest to solve whatever sorts of problems you have by searching, so I'd recommend Python.

lacker
+10  A: 

Just to muddy the waters...

Groovy give you access to Java. Java has an extremely rich set of APIs/Libraries, applications, etc.

Groovy is embeddable, although easiest in Java.

DLLs/Libraries (if you're talking about non-Groovy/Java) may be somewhat problematic, although there are ways and some APIs to help.

I've done some Python programming, but being more familiar with Java, Groovy comes a lot easier to me.

Ken Gentle
+6  A: 

Python has all nine criteria. It scores a 56.

I'm sure Ruby has everything Python has. It seems to have fewer libraries. So it scores a 51.

I don't know if Groovy has every feature.

Since Python is 56 and Ruby is a 51, Python just barely edges out Ruby.

However, I think this kind of decision can still boil down to some subjective issues outside these nine criteria.

S.Lott
With all respect, I don't think Ruby has the same amount of libraries as Python has, not to mention Groovy. If I e.g. take Ubuntu packages (including multiverse, which means basically it's Debian packages), there 920 package names with Python and 464 with Ruby. Groovy has no 3rd party libraries.
J S
Update: I looked at Rubyforge and PyPI and it it seems to support this estimate that Python has almost twice as more libraries than Ruby.
J S
Update two years later: There are more RubyGems listed than PyPI packages. But it's not a pissing contest. Both Ruby and Python are mature enough to have excellent libraries for just about anything you want to do.
Mark Thomas
A: 

You don't give a target OS, but if it's Windows, for that list I'd use .Net: C#, VB, whatever you feel most comfortable with. Bear in mind that my personal language of choice is Ruby, by the way. Away from Windows, I'd have to put Java as a starting point.

I'm not sure what's meant by the embedding requirement, but it's worth noting that within the .Net world there are IronPython and IronRuby - the former is probably somewhat more mature.

Mike Woodhouse
+1  A: 

Perl? Yikes.

As someone has observed Perl is like a big explosion in a punctuation factory. It's terseness is not an advantage if the resultant code is not self documenting.

Have used Groovy for some utility tasks, easy to get going. Full access to Java libraries, plus some cool addtions to it, like listing the files in a directory using a closure:

// process all files printing out full name (. and .. auto excluded)

new File(basedir).eachFile{ f->

    if (f.isFile()) println f.canonicalPath
}
Chris Brooks
"perl is too much punctuation/line noise" # the number 1 hallmark of somebody whos not tried it.
Kent Fredric
@Kent Fredric: Mostly agreed, though I would say "learned" as opposed to "tried". It does take some time, but then so does any language. For some reason a lot of people seem to consider any language that doesn't use the same conventions as one they already know to be inferior. If anything, it would seem logical that punctuation is *easier* to remember, since (perhaps ironically) once you get how it's used, there's usually only one mapping that makes sense, unlike languages that use words (which have synonyms) for the same concepts.
intuited
+1  A: 

For a java programmer, the obvious choice is Groovy.

Whenever you forget the Groovy syntax, simply use basic java.

A: 

ruby has jruby with access to...something of the java internals, if necessary.

rogerdpack
+2  A: 

try Groovy .. it has all features that you need there. You can use existing java lib without any modification on its classes. basically .. groovy is java++, it is more dynamic and fun to learn (just like ruby)

I dont like ruby or python syntax so I will put them behind. Groovy is just like C/C++ syntax so I like him lol :)

+2  A: 

Groovy? I'm just picking it up; try this (inside the groovyconsole):

File.metaClass.invokeMethod = { String name, args ->
    System.out.print ("Call to $name intercepted...");
    File.metaClass.getMetaMethod(name, args).invoke(delegate, args);
}

new File("c:/temp").eachFile{
    if (it.isFile()) println it.canonicalPath
}

The first code is AOP. All calls to any method of File object will be intercepted. No additional tools required. This is executed against existing Java class dynamically.

In the second block, you remove the 'f' closure parameter. Being just one parameter, it defaults to the built in "it" variable available to the closure context.

Here is what you get:

"Call to isFile intercepted...C:\temp\img.jpg"

etc.

Florin
A: 

Your comparing a compiled bytecode language vs. scripting language.

Groovy doesn't seem to be that scriptable, with all that lines of codes suddenly I felt I was brought back in 2001.

A: 

Nah... Groovy just looks and feels like Java..

I don't like to type all that Java lines "AGAIN".. just like what I did in 2001.

+1  A: 

From your critera, I'd pick JRuby:

  • Richness of API/libraries available (eg. maths, plotting, networking) (9)

Everything the JVM has access to, which is a lot

  • Ability to embed in desktop (java/c++) applications (8)

Excellent Monkeybars framework, which lets you design a swing GUI in your GUI designer, and then wire it up using clean ruby code

  • Ease of deployment (8)

Rawr can package your app as an executable jar

  • Ability to interface with DLLs/Shared Libraries (7)

Java shared libraries easily, C ones via jna + libffi

  • Ability to generate GUIs (7)

Swing just works. Not sure how easy it is to use QtJambi, but it's definitely possible.

  • Community/User support (6)

Lots. Ruby has an excellent community.

  • Portability (6)

Everywhere the JVM works

  • Database manipulation (3)

All the ruby database libraries and all the java ones

  • Language/Semantics (2)

Here's where ruby takes the definite lead over groovy and python. The language has had some really beautiful design decisions taken early on, which shows up in the consistency and power of the standard library. Blocks, in particular, make it a joy to use.

Martin DeMello
+8  A: 

Having worked with all 3 of them, this is what I can say:

  • Python

    • has very mature libraries
    • libraries are documented
    • documentation can be accessed from your debugger/shell at runtime through the docstrings
    • you can develop code without an IDE
  • Ruby

    • has some great libraries ( even though some are badly documented )
    • Ruby's instrospection mechanisms are great. They make writing code pretty easy ( even if documentation is not available )
    • you can develop code without an IDE
  • Groovy

    • you can benefit from everything Java has to offer
    • syntax is somewhat inspired from Ruby
    • it's hard to write code without an IDE. You have no way to debug stuff from your console ( this is something you can easily do in Python/Ruby ) and the available Groovy plugins have a lot of catching up to do. I wrote some apps using Groovy and as they get bigger I regret not going with Ruby/Python ( debugging would have been WAY more easier ). If you'll only develop from an IDE, Groovy's a cool language.
Geo
How would you say the maturity of Java's libraries compares to that of Python's?
intuited
Usually Java's libraries are of pretty good quality. And since you can use Jython ( to benefit from them while writing Python code ), I'd say you're good either way.
Geo
A: 

it would be worth trying REBOL.

I am mainly a Java/Ruby person. but I keep REBOL as my secret tool. I gave it a try this november (2009) and I liked it, and I am definitely going to learn more about it. It's already allowed me to meet some very difficult almost impossible deadlines already.

It's very concise. actually the most concise language, I have come across.

I like their philosophy : "KEEP IT SIMPLE". "DO IT IN 1 MB NOT 200 MB"

I believe in the long run Simple, lean languages will beat complex, bloated languages. thus the rise of ruby, and in my opinion Rebol in the near future (if they really keep it open)

the Rebol environment is around 600 KB (version 2). they are working on version 3 which is close to beta version.

After many years of developers asking for the owning company to open the language, Version 3 is going to be open, and this will hopefully increase its adoption by the developers community.

you can use the same code across 40 operating systems, and you can run the same code both in browser and at command line. this is really crucial with the RIA(rich internet applications) movement becoming more important.

to use JAVA, you need javafx, java, ajax, html, CSS, javascript, jsp, jsf and whole lots of other things to learn and use, like a java application server, a web server etc.. (OH WAIT .... so while we are on a roll, why not add 100 more technologies to learn to be able to create a simple RIA ?) that's simply stupid and inefficient.

by contrast with Rebol, you only need REBOL (600 kb only environment) . It's an internet based language and you can run another program hosted on a computer on the other side of the world (as long as you have authority) . this allows you to do publish your application to the world and also consume someone's else modules/programs/applications.

e.g to create a window with one field and button:-

view layout [ field button "click me"]

to print a web page:-

print read http://www.rebol.com

where else can you do that ? No other language can be that concise.

it's worth mentioning that java fx seems to have copied Rebol's gui approach (vid dialect) which uses a declarative approach for creating gui.

you can find more about it , at www.rebol.com. take a look and give it a spin.

batman
A: 

From your criteria, I would use Play! Framework. It's still a small project but the support is great, it's easy to get started with it. And you get all the power of Java.

mnml
The question is about languages not web frameworks...
Michal Bernhard
A: 

@batman: Thanks for the rebol reference. I am interested and will take a look. Please consider researching Smalltalk as it squarely fits the simplicity and conciseness that you find attractive about rebol. Since Smalltalk has been around for about 30+ years now, there's a lot of history that suggests maybe simplicity/conciseness won't win out against the more complex languages. I have used both Smalltalk and Java for enterprise/net development and know there's more to this comparison & ultimate victory. Still, the elegance, simplicity, and conciseness of Smalltalk were trounced by more complex languages.

Again, thanks for the pointer to rebol.

nofrets
This should really be a comment on batman's post, it's really not an answer.
Benson