April 08, 2004
Python better than Java?
According to Wes Felter Sleepycat rewrote Berkeley DB in Java. Specifically to avoid the "pain" of having to use JNI. JNI is the standard way of calling non-Java code from within Java.
The Java programmers that I disparaged in my last post have expressed similar misgivings about using this technology and tend to avoid it like the plague.
Whereas in Python you can extend the language in C, invoke operating system commands, interact seamlessly with java, write extension modules in Python but compile them to machine code and even call Berkeley DB using a a standard interface.
I know which programming language I'd choose.
Posted by Andy Todd at April 08, 2004 09:19 PM
Well, there is a "port" of Python's ctypes to Java, which has gotta be nicer to use than JNI. Also, on OS X, you should (in theory) be able to wrap something in ObjC and expose it to Java pretty easily (but we can do this in Python with PyObjC).
As someone who has been coding Java since version 1.0 and has become a Python convert, I can totally agree with the above article. One addition is that I can verify, from first hand experience, that coding in Python is much more productive than in Java. Also, the Syntax and overall language structure is much, much easier to grok and retain in your gray matter than Java semantics.
-- Dave Giffin
This is kind of a cheap shot. I'm not here to be an apologist for Java, and I think Python is cool, but of course it's easy to bridge between two languages built from the same pieces.
You hype Jython for interacting seamlessly with Java, but it's exactly the same thing as with SleepyCat: Jython is Python ported to Java.
Also, SleepyCat themselves say "In addition, they wanted to take advantage of abstractions and services available in Java that are not available under C."
In my opinion, the real pain of JNI is that you can't distribute the native libraries as part of an application; if you want to write Java on top of JNI, the user has to build the libraries for each deployment. For some combinations of library and operating system, this can be a serious headache.
SleepyCat ref: http://www.sleepycat.com/products/je.shtml