PDA

View Full Version : Whats better Java or Python



Jeremywilms
July 17th, 2007, 01:06 AM
Okay don't say python beause you programm in pythn,and don't say java because you program in java. I really want to know the truth. Whats the advantages an disadvantages?

hod139
July 17th, 2007, 01:09 AM
This thread is just asking for trouble. Better get out your ultra strong flame retardant suit.

samjh
July 17th, 2007, 01:12 AM
Are you looking for a flame war?

:popcorn:

I used both Java and Python. Around 7 years using Java, and maybe 6 months using Python.

I prefer Java for larger projects or projects that require reliable, stable outcomes, with minimal performance penalty. I prefer Python when writing simple programs for fun.

Gazing into my crystal ball, I see a very black future for this thread. ;)

Jeremywilms
July 17th, 2007, 01:14 AM
This thread is just asking for trouble. Better get out your ultra strong flame retardant suit.

Excuse me that is extreamly rude. Don't talk to me like that you may have more posts, but I am still a member of this forum. And as far as I know this is what forums are for, asking questions in most cases. Please do not spam my post.

yabbadabbadont
July 17th, 2007, 01:21 AM
Excuse me that is extreamly rude. Don't talk to me like that you may have more posts, but I am still a member of this forum. And as far as I know this is what forums are for, asking questions in most cases. Please do not spam my post.

If you had a few more posts, you probably would have realized that it was a joke.... :D

Now for an on-topic response. It depends upon what task you are trying to accomplish. Both have their strengths and weaknesses.

samjh
July 17th, 2007, 01:21 AM
Excuse me that is extreamly rude. Don't talk to me like that you may have more posts, but I am still a member of this forum. And as far as I know this is what forums are for, asking questions in most cases. Please do not spam my post.

I'm sure he wasn't intentionally being rude. And his number of posts indicate that he probably has experience with discussion topics similar to these where the outcomes were not pretty or useful.

When you ask for opinions on whether one language is better than another, there are going to be zealots who will evangelise their chosen language with their lives. Debates between such zealots invariably end up in flame wars.

A better approach is to look at the stickied threads listed on the top section of this forum, especially the Guide to Languages one, and form your own opinion. Even better, just try each language for a couple of months and see which one you prefer.

The suitability of either language depends on many factors, including the type of projects you are going to be doing.

hod139
July 17th, 2007, 01:28 AM
Excuse me that is extreamly rude. Don't talk to me like that you may have more posts, but I am still a member of this forum. And as far as I know this is what forums are for, asking questions in most cases. Please do not spam my post.
I was far from rude and was only warning you that this question has been asked many times before (my more posts suggest that I have seen this question before), and never has a fruitful outcome occurred. I would also suggest that you do some searching before asking questions:
http://ubuntuforums.org/showthread.php?t=484391 (this one looks extra related)
http://ubuntuforums.org/showthread.php?t=489534
http://ubuntuforums.org/showthread.php?t=459528
http://ubuntuforums.org/showthread.php?t=478911
http://ubuntuforums.org/showthread.php?t=467744

As you stated, you are a member of this forum and you may post whatever you like. I was only trying to point out that this question has been asked many times already, and you will not get the answer you are looking for.

shynko
July 17th, 2007, 01:31 AM
if you're asking for which langauge is better it would be a good idea to say what you're using it for. Are you wanting to make small applications with a shiny gui wanting to become a game programmer, or want to see some flames :lolflag:

AusIV4
July 17th, 2007, 01:32 AM
Excuse me that is extreamly rude. Don't talk to me like that you may have more posts, but I am still a member of this forum. And as far as I know this is what forums are for, asking questions in most cases. Please do not spam my post.

It's true though, people are fairly particular about their languages. I wouldn't be surprised if there turn out to be some heated debates.

I learned Java about 4 years ago and have used it in classes quite a bit. I've always been bothered by some inconsistencies throughout the language. For example, if you want the length of a string, you use the public method string.length(). If you want the length of an array, you use the public variable array.length. If you want the length of a list, you use the method list.size().

I've been using Python for a couple of months, and I find it much more consistent. Arrays, dictionaries, strings, etc. all inherit lists, so they are all accessed with len(list).

Formatting is another issue. I work with friends on code from time to time, and there is a huge amount of variance among us on what kind of java code looks good. Python leaves no room for debate. Your code won't run correctly if it's not formatted correctly.

Both have fairly straightforward libraries for writing GUIs. If I have to work with XML (or files in general), python wins hands down.

As far as execution time and efficiency, I haven't noticed a huge difference, but that doesn't mean there isn't one. Some people might have strong opinions on this subject.

Generally, I'd rather use python if given the option. I haven't been using it as long as I have Java, but I already feel more comfortable with the language.

rekahsoft
July 17th, 2007, 01:41 AM
both; use to tool that is best suited for the job at hand ;)

xtacocorex
July 17th, 2007, 03:16 AM
FORTRAN 90
Next time, read the sticky threads.

Jeremywilms
July 17th, 2007, 03:27 AM
Well if there both the same strangths(or vary similer) then.....Well would'nt python be better, its easier. Though it is less orginized and I don't know if it can accsess or create classes, can it?

pmasiar
July 17th, 2007, 04:09 AM
Though it [Python] is less orginized and I don't know if it can accsess or create classes, can it?

Python less organized? You must be kidding. Library is smaller (number of classes), but it is *good thing* - because you can do same thing with less code and less byzantine API (and develop code faster). I have experience with both Python and Java - and I fell much more productive in Python than in Java. 5-10 times more.

Python can create exactly as tricky classes as Java - even more, with multiple inheritance.

One big difference between Java and Python is, Java does not trust developer - puts all sorts of restraints and controls. In Python, we say developer is consenting adult: you are said not to do some things, but you can if you want or need to - but then you better know what you are doing. Some kind of magic (self-introspection etc) allows for creating smart adaptive code.

I dont think how we can get more good info from this thread - that horse was beaten to death couple times. See links mentioned in the other post above.

LaRoza
July 17th, 2007, 02:46 PM
I didn't vote, although I am partial to Python, I can not vote it "better" than any language (except .NET).

If you are just starting out, I recommend Python, but otherwise you should learn both.

mike102282
July 17th, 2007, 02:48 PM
Python, Java takes to long to load IMHO

kknd
July 17th, 2007, 06:56 PM
They have different purposes.

Java fits better for large projects, and have a better performance too.
Python is much better for quick things (not saying that is less powerful).

I voted for Java, but you just cant compare.

neorou
July 17th, 2007, 07:35 PM
Okay don't say python beause you programm in pythn,and don't say java because you program in java. I really want to know the truth. Whats the advantages an disadvantages?

You know, I should point out that the language(s) are dynamic. languages that may be used for web programming as in glue language may be used for something comprehensive 4 or 5 years later. Look at PHP. Rasmus Lehrdorf created PHP strictly as powerful web glue language. Now you have things like PHP-GTK out there that is quickly gaining momentum and expanding beyond the confines of the web.

Similarly, Python and Java are that way. Hardware limitations are becoming less of a problem as faster processors and bigger bandwidth are becoming more available to the masses. In that regard, you could look at which one is a higher level language, i.e., which one is closer to human spoken language vs. the usage of 0's and 1's. Maybe knowing this would better answer your question.

There is also the issue of a compiled vs. a translated language. Python still requires an environment for it to run. You can 'freeze' python applications now, and if you do it correctly (and this is dependent also on what OS/hardware platform you are running), apps written in Python can run fast. Likewise, if you put together a jar file or any other java app incorrectly, it may run slow.

You could always learn both if you have the time, and decide for yourself. This is really the only course of action to answer the question that you asked.

Best of luck...

H264
July 17th, 2007, 10:22 PM
Whatever language you choose, make sure you stick with it at least until you feel somewhat creative with it. Once you can do things in it, and the language make you feel lacking with what you want to do, then grab another language that suits what you want to do better. There will always be over lapping in any language you choose with other languages (like python and Ruby for server side web dev)...

Also most of what you learn will carry over to a different languages... most of them out there are based on C and/or smalltalk (which is probably based on the C syntax, lol) anyway, like C++, Objective-C, Ruby, Python, Java, D, ect.

Let us know what you decide.

Jeremywilms
July 31st, 2007, 08:57 PM
Well I have been with VB6.0 fo a while. But I also know a quite a bit of java, Still though I agree with you. The reason I whent from VB to java was because VB was not what I was looking for. It did'nt have all of the network, and basicly strangths I wanted. But i still have one question, Why is it said java is good for big projects, and else python. Because as far as I am reading they basicly have the same stats, exept the syntax.

Note360
August 1st, 2007, 01:45 AM
Its up to you. Personally I never liked Java for whatever reason though im going to try to relearn it.

H264
August 1st, 2007, 02:57 AM
But i still have one question, Why is it said java is good for big projects, and else python. Because as far as I am reading they basicly have the same stats, exept the syntax.

As far as I know (I could be off a little) but Java tends to be faster than other interpreted languages. Also perhaps because it is much more structured and strongly typed than other scripting languages?* If so then it would be easier to read and have other people pick up where you left off.

*disclaimer: I have never touched Python, Perl, Ruby or other scripting languages, so don't blame me for not knowing from experience ;)

pmasiar
August 1st, 2007, 04:11 AM
1) "strongly typed" is a strawman. Application should be strongly tested. test for type is the easiest to start with. Leading Java expert, Bruce Eckel (http://mindview.net/WebLog/ArticleIndex), started on "strong typing" side but now promotes latent typing (http://mindview.net/WebLog/log-0052) and strong testing (http://mindview.net/WebLog/log-0025) and explains why.

Bruce, famous author of "Thinking in Java", now in 4th edition and considered an authoritative guide (and good book) is now strongly in Python's camp (http://mindview.net/WebLog/log-0053) (and explains why).

2) Speed is strawman too. Most apps now are web frontend for a database, and if you do that, 90% of response time is spent in http and database access. If you compile remaining 10% to run in zero time, you still shaved only 10% of runtime.

3) "more structured" is another strawman: more verbose code, boilerplate getters/setters etc means *harder* to maintain. If you cannot trust your programmers to not mess with internal implementation if you told them not to, fire them and hire responsible coders. I heard interesting description: "open kimono development" - assume that programmers are responsible consenting adults.

Hilarious rant about structure of Java code: Execution in the Kingdom of Nouns (http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html)

bread eyes
August 1st, 2007, 05:49 AM
Java, it's faster and through groovy it has a python like 'feel'.

gl0wst1ckn1nja
August 1st, 2007, 05:50 AM
java is a little slower because of the JVM (java virtual machine, its like a virtual computer) and python, for the most part is compiled and "interpreted" by the computer.

so it would depend on the program.

java works very well online via applets

[h2o]
August 1st, 2007, 08:32 AM
java is a little slower because of the JVM (java virtual machine, its like a virtual computer) and python, for the most part is compiled and "interpreted" by the computer.
Uhm, both are usually compiled to bytecode, so I think this is not true. There seem to be quite an Urban Legend regarding the speed of Java.

Personally I (currently) prefer Python, since I ususally write smaller programs, and Python has a very straightforward and clean syntax. Java is probably one of the "chattier" languages I have used.

I still have nothing against Java though.

gnomeuser
August 1st, 2007, 08:41 AM
All the programming I do, I do in C#, now if I had to eliminate one of python or java it would have to be python just based on the fact that the syntax really doesn't become me. That being said the current implementations of Java on Linux have some what a feel of being under developed. The tool have only just been freed and we haven't gotten around to embracing it to the extend we have a .NET, C, C++ or python.

I think Java given it's recent release might have a big future on the free platforms, it already outships OS X, Windows and Linux combined as a platform so it might be worth our while to produce good Java bindings and a few killer applications.

laxmanb
August 1st, 2007, 08:54 AM
all topics like this do is start flame wars. Java for me tho

quokka
August 1st, 2007, 10:39 AM
1) "strongly typed" is a strawman. Application should be strongly tested. test for type is the easiest to start with. Leading Java expert, Bruce Eckel (http://mindview.net/WebLog/ArticleIndex), started on "strong typing" side but now promotes latent typing (http://mindview.net/WebLog/log-0052) and strong testing (http://mindview.net/WebLog/log-0025) and explains why.

Bruce, famous author of "Thinking in Java", now in 4th edition and considered an authoritative guide (and good book) is now strongly in Python's camp (http://mindview.net/WebLog/log-0053) (and explains why).

2) Speed is strawman too. Most apps now are web frontend for a database, and if you do that, 90% of response time is spent in http and database access. If you compile remaining 10% to run in zero time, you still shaved only 10% of runtime.

3) "more structured" is another strawman: more verbose code, boilerplate getters/setters etc means *harder* to maintain. If you cannot trust your programmers to not mess with internal implementation if you told them not to, fire them and hire responsible coders. I heard interesting description: "open kimono development" - assume that programmers are responsible consenting adults.

Hilarious rant about structure of Java code: Execution in the Kingdom of Nouns (http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html)

This is the kind of overly simplified stuff that I have read repeatedly in the Python/Java "debate". There are quite plainly very good uses for Java and very good uses for Python.

First speed does sometimes matter, and matter quite a lot. The world of computing is not confined to building web sites and not all applications are limited by data base performance. In fact some apps have nothing to do with database or HTTP.

Last time I looked, Python had very limited threading capabilities with some sort of global interpreter lock. The JVM on the other hand has very fine grained locking and there is one to one mapping between Java threads and native operating system threads. If you want to make decent use of multi core CPUs in a single process this is really important. If Python has moved on in the threading department then great. If it hasn't, for some apps, this is a real liability.

Second, the question of the utility of strong type checking at compile time remains a matter of opinion. I prefer it. Some don't. The assertion that testing substitutes for compile time type checking remains just that - an assertion. I very much doubt that it can be proved that sufficient testing will pick up all errors that would have be picked up by strong type checking at compile time. It is certainly an interesting issue.

There are real issues in choosing an appropriate development environment. They are not "straw men" and it does require some underatanding to make a good choice. Non technical issues are also a major factor. What is best for a given job may well be what you or the team know best.

pmasiar
August 1st, 2007, 06:47 PM
All the programming I do, I do in C#, now if I had to eliminate one of python or java it would have to be python just based on the fact that the syntax really doesn't become me.

You are Exhibit A to a syndrom mentioned by Bruce in articles linked above: a programmer, who bothered in his career to learn single language only (and with static typing to boot), is confused on difference between syntax and semantic of the language, but still has strong opinion why the (only) way he knows how to program is preferable to all others. And cannot be even bothered to read opinion of *leading Java expert* why this thinking limits his understanding of what programming really is, and his ability to learn more.

Did you ever tried to read "Thinking in Java" or "Thinking in C++"? Oh obviously you did not - you are waiting for "Thinking in C#" :-) You would be better programmer, with deeper understanding, if you learned other languages, and read any of those books.

Fortunately it's not up to people with experience limited to single language like you to decide and "eliminate" any other different language. Sadly, many PHB bosses listen to people like you. Didn't you get sometimes curious why Google or Mark Shuttleworth or Tim Berners-Lee like Python? That would assume you know who two mentioned gentlemen are - try Google :-)

pmasiar
August 1st, 2007, 07:04 PM
This is the kind of overly simplified stuff that I have read repeatedly in the Python/Java "debate". There are quite plainly very good uses for Java and very good uses for Python.

Agree. But most cases where Java is used, is is horrible. Why do web apps in Java, with it's clunky text facilities? And web apps is big use of Java. My point is, Java is very often used where it does NOT make sense, because of hype and inertia.

> First speed does sometimes matter, and matter quite a lot. The world of computing is not confined to building web sites and not all applications are limited by data base performance. In fact some apps have nothing to do with database or HTTP.

Agree. As I mentioned, my comment applies to web apps, so don't tell me it does not apply outside.

BTW many of this non-web apps are one-off little programs, just parse bunch of text files and convert them a little, where speed of development is more important than speed of execution, and Python shines over java again.

> Last time I looked, Python had very limited threading capabilities with some sort of global interpreter lock.

Agree. How many developers need (and are able to) write multi-threaded apps? And then debug all race conditions?

> Second, the question of the utility of strong type checking at compile time remains a matter of opinion. I prefer it. Some don't. The assertion that testing substitutes for compile time type checking remains just that - an assertion. I very much doubt that it can be proved that sufficient testing will pick up all errors that would have be picked up by strong type checking at compile time. It is certainly an interesting issue.

Linked was article from leading Java and C++ expert about how his thinking about this issue changed. Did you read it? Did you thinked about his arguments?

Excuse me, but I will trust his opinion over any anonymous forum poster.

> There are real issues in choosing an appropriate development environment. They are not "straw men" and it does require some underatanding to make a good choice. Non technical issues are also a major factor. What is best for a given job may well be what you or the team know best.

Agree 100%. But if smart hacker like Bruce explains how his thinking changed, aren't you intrigued to try it next time? Not a bit?

I mostly agree with you, there are many special cases where Python is NOT the best choice. But we Python charmers have zen wisdom about that: Special cases aren't special enough to break the rules. Accommodating special cases is not the way to define the rules.