Python & Java: a Side-by-Side Comparison
Not the first Java vs. Python comparison around, but one of the better ones, I think.
Posted to Python by Simon Brunning at August 14, 2003 02:30 PMI have to disagree.
IMO, most of it arguments are not sound, and some of them are even wrong. The guy who did this comparison either don't know enough of Java OR wanted Java to look as a terrible thing.
Note: I'm NOT saying that Java is better than Python, or otherwise. All that I'm saying is that the author is plainly wrong in most of his arguments.
note to me: Read articles at least 5 times before commenting them.
Some points the author made are valid, but the examples are either not clear, or plainly wrong (ex: "Each class must be defined in its own file (with the rare exception of inner classes). If your application has 15 classes, it has 15 files.")
I apologize for my previous harsh comment.
Posted by: Rafael Alvarez on August 19, 2003 08:28 PMMost of the points are not really a big deal. One can incease one's productivity by using, among others:
1. IntelliJ (absolutely fantastic!)
2. Ant
3. If you want weak typing so much, you can use beanshell or equivalents and still be in Java. No need to learn another language for that purpose.
The so called verbose file opening is also rather easily dealt with. Just create a helper class with a static method for your needs. The verbose nature actually gives increadible flexibility by allowing us to, say create a different Buffered class to maximise performance for certain reasons and use that. How do you do that in python? I dunno.
JMHO.
Posted by: Hamdi on August 20, 2003 04:55 AMRafael,
"Each class must be defined in its own file" may be wrong strictly speaking - each *public* class must be defined in its own file. But the essential point is valid - In Python, you can choose how to organise your classes in your files, in Java, you cannot.
Hamdi,
Well, I use Eclipse rather than IntelliJ, but yes, a *good* IDE can help out with some (but not all) of the boilerplate.
Ant is great, but writing a good build script is a job in itself sometimes.
Beanshell? Bletch! Learning Python doesn't take long, I promise you. (And Python isn't *weakly* typed, BTW, it's *dynamically* typed. See http://diveintopython.org/odbchelper_funcdef.html
You can build all kinds if file like objects in Python, if you need them. But I never have.
Thanks for the comments, guys!
Posted by: Simon Brunning on August 20, 2003 09:16 AMI think that we have to keep in mind that Python and Java are not designed to solve the same type of problems, so side-by-side comparisons which try to decide that one language is "bad" and the other one is "good" miss the point. I use Java to write large systems with many configurable components defined by strict interfaces. For this task, I find that the static typing of Java is quite useful when designing, defining, and implementing, and gives some level of confidence that the components have been implemented to the spec. Although I am not that experienced with Python, I have a hard time seeing how I could use it to construct these kinds of systems. I plan to use Python to build tools and utilities around the periphery, and for that it looks very good. I'd be interested in hearing other's experience with either language in a variety of problem domains.
Posted by: Dan Weston on August 23, 2003 07:50 PM