Which do you prefer to use?
Java
 33%  [ 6 ]
Python
 44%  [ 8 ]
I don't know / Neither / Both
 22%  [ 4 ]
Total Votes : 18

There has been some debate between Java and Python recently here at Cemetech, and it's also been briefly debated in the past as well. I just wanted to make an organized thread for this.

This isn't just a pointless boring argument - as I said before, this topic has been brought up before, so it's apparently at least interesting. Also, this topic could be useful for people who are not sure which language to start programming, or who currently program with one language but could have their eyes opened to another.

I don't really know much about either language, but I have tried both (I've programmed in Java more than Python though).

I think Java is...OK. It can take an annoyingly long time to compile simple Java programs (which still end up having to be interpreted anyway), and it seems like I have to create a certain slightly time-consuming organization for my code (like how the program itself is a class), but in a large scale, this might be helpful. I also find it annoying to have be importing classes and stuff all of the time (I think I have to import stuff in Python too at times, but it seems like I have to import more things in Java). I think Java applets are kind of cool, though.

Also, probably part of the reason why so many people like and stick to Java is because that's what's taught in schools (which would probably mean it's the first language many people are exposed to). People don't want to feel like what they were learning was in any way a waste of time (not to say that it IS in fact a complete waste of time), and they can justify that by saying, "well, why do they teach it in schools."

Python seems pretty cool, but then again, I haven't programmed with it much. It particularly seems more flexible and clean, resulting in less code (this might also lead to sloppier code and poor organization over time, but I still like the flexibility).

In terms of speed, I'd think that Java would generally be faster, especially large and complex applications, because it's compiled, but I'm not sure how true this is.

Again, I don't know much about either of these languages, but that's just what I think of them so far.

What do you all think of them and which do you prefer?
This is such a well-written post, I was fairly tempted to click the "Promote to front Page" link right above it. Very Happy I voted python, for the reason that it's the slick, streamlined language to Java's bloat.
I have actually gotten Python code to run faster than Java code using just built in features (as in without Psycho or similar), which is pretty pathetic for Java.

Java's GUI, Swing, is terrible, as are most of the libraries. Things that should be simple (say, sprintf, stringstream <<, "%d" % 1, etc...) are stupidly complex in Java, often resulting in invoking several factories and crap.

Java is much too verbose, there NEEDS to be syntactic sugar, and there NEEDS to be operator overloading (why oh why did they omit this?!?!?!?). This is most definitely NOT a good thing and it does NOT lead to better code.

Oh, and C# and Java's obsession with "Everything in a class!" is moronic - some things just aren't OOP in nature, and forcing them to be is just annoying.
I voted Java, since it's one of my two primary languages. I did learn it in school, and love how logical and object-oriented it all seems, with nice, math-style syntax.

However, I have never programmed Python, so since I'm hearing so much about it on this forum, I might learn it over the summer break. I think the college I'm going to next fall (Binghamton) teaches Python, but only as an intro course for people who have never programmed, so I will get to skip it. After that, they probably go to something like Java or C++. (I could be wrong, I don't remember exactly what the guide told me at my visit...)
magicdanw wrote:
I voted Java, since it's one of my two primary languages. I did learn it in school, and love how logical and object-oriented it all seems, with nice, math-style syntax.


What other language do you know? Visual Basic? Thats pretty much the only language I could see where Java might win out.... Especially since Java is definitely NOT logical - they definitely didn't think out most of the crap included...

Quote:
However, I have never programmed Python, so since I'm hearing so much about it on this forum, I might learn it over the summer break. I think the college I'm going to next fall (Binghamton) teaches Python, but only as an intro course for people who have never programmed, so I will get to skip it. After that, they probably go to something like Java or C++. (I could be wrong, I don't remember exactly what the guide told me at my visit...)


http://docs.python.org/tut/tut.html - takes like an hour or two to get the basics down Wink
My primary languages are Java for desktop and z80 asm for calculator. Other languages I happen to know, but use less often, are Visual Basic, QuickBasic, TI-BASIC, HTML, JavaScript, ActionScript, PHP, and (I think) that's it.
magicdanw wrote:
My primary languages are Java for desktop and z80 asm for calculator. Other languages I happen to know, but use less often, are Visual Basic, QuickBasic, TI-BASIC, HTML, JavaScript, ActionScript, PHP, and (I think) that's it.


Well there's your problem. Learn a real language like C++, Python, or C# Wink
What makes those languages more valid than Java? I still have yet to see evidence that Python is better than Java - only that it is different.
magicdanw wrote:
What makes those languages more valid than Java? I still have yet to see evidence that Python is better than Java - only that it is different.



Razz

(The real reason is because Java is terrible. You can't know this since you only use Java, but I promise you, Java is downright bad)
Lol. Still, by xkcd logic, you should be using a magnetized needle and a steady hand, or butterlies Razz
Kllrnohj wrote:
Java is much too verbose, there NEEDS to be syntactic sugar, and there NEEDS to be operator overloading (why oh why did they omit this?!?!?!?). This is most definitely NOT a good thing and it does NOT lead to better code.

Oh, and C# and Java's obsession with "Everything in a class!" is moronic - some things just aren't OOP in nature, and forcing them to be is just annoying.


Yeah, I agree. I like Python's flexibility (and not to get too off-topic, but C++'s too) and don't like being restricted to a certain way of coding (like object-oriented), even if it is often a good way.
I've only really ever played around with Python. The only big projects I've done have been with Java, C++, or freeBASIC(a quickBasic clone). Of those, probably 70% java, 25% freeBASIC, 5% C++. I was intimidated at first by Python's white-spacing deal with methods and stuff. Before coding with it, I prematurely dubbed it 'STUPID.' An error on my part... After trying it out, I found that it wasn't difficult or confusing at all to keep everything together. I use whitespace lines in other languages to keep things sorted, but it really isn't necessary. Actually, the fact that you don't have to use {}'s makes typing it a little faster (and less annoying Wink ). I've never personally made a program to test speed, but I've been told Java was significantly faster. As I said, though, I haven't tested it so I'm not going to try to defend it.

That fact that you can just type a Python program in notepad, name it something.py, and just double click on the file is AMAZING. Error checking is annoying, but I would assume there are decent IDE's for writing in it (There are, aren't there? If so, what's good?).

Though there is some really great stuff for Python going on, I still prefer Java. I know defining data types can get annoying, but truthfully, I just feel safer doing it. I know that sounds stupid (and yes, I'm fully prepared to bashed for saying it), but I like having the control. If I created a variable for an integer and get confused and pass it a string, I want to told immediately. Smile Also, another bogus reason, but Java is strikingly similar to C++. I know bandwagonism isn't a legitimate reason, but once I'm out of school and looking for a job, I'm fairly sure I'll either be using Java or C++. I don't feel like putting time into efficiently using Python will pay off in the end.
foamy3 wrote:
I've never personally made a program to test speed, but I've been told Java was significantly faster. As I said, though, I haven't tested it so I'm not going to try to defend it.


Standard, straightforward code is measureably better in Java, but you'd be hard pressed to notice it real world. Python "feels" faster, though (in terms of GUI responsiveness, etc...), and can be tweaked to run faster in certain scenarios. Python, surprisingly, also starts up faster (Python is ~6x faster at startup, and uses roughly 3x less RAM)

Quote:
That fact that you can just type a Python program in notepad, name it something.py, and just double click on the file is AMAZING. Error checking is annoying, but I would assume there are decent IDE's for writing in it (There are, aren't there? If so, what's good?).


Honestly with Python I don't find that I really care what IDE I use. Notepad++ is OK, IDLE (comes with Python) is pretty good, but Wing-IDE (not free unless you are doing open source) is AMAZING.

That said I usually just open up IDLE in Windows, or GEdit in Linux Smile

Quote:
Also, another bogus reason, but Java is strikingly similar to C++. I know bandwagonism isn't a legitimate reason, but once I'm out of school and looking for a job, I'm fairly sure I'll either be using Java or C++. I don't feel like putting time into efficiently using Python will pay off in the end.


I assure you it is not (Java compared to C++). The two are very very different, despite having a somewhat similar syntax (which is really common among all C-derived languages). Whatever you do, do NOT code in C++ like you do in Java, it is very likely to be the wrong way to do it. Indeed, things common in Java are often the Wrong Way in almost every other language Very Happy
Kllrnohj wrote:
I assure you it is not (Java compared to C++). The two are very very different, despite having a somewhat similar syntax (which is really common among all C-derived languages). Whatever you do, do NOT code in C++ like you do in Java, it is very likely to be the wrong way to do it. Indeed, things common in Java are often the Wrong Way in almost every other language Very Happy


Fair enough. I never did anything really high level with C++. Only had about 1 semester of it in high school. Switching from that to Java seemed like cake, though. Besides the whole 'public static' thing and your whole program being a class, it seemed to flow the same way.
I've actually looked at learning both of these languages but I haven't had the time to get very far in the tuts but with how far I have gotten python is so much easier to use and learn and as a first language would be very helpfull to programers. It may not be the fastest language but in most cases it doesn't matter if its alittle slower if it gets the job done right and if you can make the program faster you get that time back.
This topic inspired me to play around with Python again. I just wrote an entire 2 player text based tic tac toe game. Most of the stuff just made sense. I barely had to look at the docs at all. I honestly guessed at how to make a 2 dimensional array and it worked great. I think with a little more tinkering, this could definitely become my goto language for 'just for fun' programs.

I've been heavily avoiding for loops, though.. I doubt it 's hard, but the fact that it's different is just hard to get used to.
foamy3 wrote:
This topic inspired me to play around with Python again. I just wrote an entire 2 player text based tic tac toe game. Most of the stuff just made sense. I barely had to look at the docs at all. I honestly guessed at how to make a 2 dimensional array and it worked great. I think with a little more tinkering, this could definitely become my goto language for 'just for fun' programs.

I've been heavily avoiding for loops, though.. I doubt it 's hard, but the fact that it's different is just hard to get used to.


While loops are the same, for loops are just foreach loops. Just use xrange if you want to iterate over numbers. Smile

So for (int i = 0; i < 10; i++) becomes for i in xrange(10) or for (String s : strings) becomes for s in strings
I <3 python, but I still use Java occasionally, for simple programs where I need rapid gui development.


magicdanw: that's because a) you haven't tried python b) you don't seem to have read my reply to your last post about this....
Kllrnohj wrote:
Just use xrange if you want to iterate over numbers. Smile

So for (int i = 0; i < 10; i++) becomes for i in xrange(10) or for (String s : strings) becomes for s in strings


Cool! I didn't know the xrange() trick. That could definitely help out. Thanks. Smile
foamy3 wrote:
Cool! I didn't know the xrange() trick. That could definitely help out. Thanks. Smile


You will likely see range() instead of xrange() in tutorials and the like. Both have the same result, they just do it differently. xrange returns an iterator (sort of), whereas range actually generates a list of all the numbers. So xrange is faster and uses less ram, but otherwise the two are interchangeable (in the context of a for loop) Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement