What do you think of the Java programming language?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What do you think of the Java programming language?
What are your views regarding the Java programming language? Things like:-
Performance
Oracle Takeover
Features
Comparisons to Other Porgramming Languages
Job Market
Cross-Platform Viability
Usage for Desktop Applications
Usage on Mobile Platforms (i.e. Android)
Usage on Websites (vs. alternatives)
Other General Thoughts
I've started a book on Java, and I have pretty much chosen it to be the first language I learn (though I have fumbled around in BASH quite a bit and a tiny bit of C++), so I would like to know what other programmers think, especially programmers using Linux.
Discuss.
Last edited by lupusarcanus; 03-02-2011 at 12:04 PM.
Performance: HORRIBLE. Worst performance of any language I've ever supported, and I've supported a lot.
Comparisons to Other Programming Languages: Compare on what basis?
Job Market: Excellent, because...
Cross-Platform Viability: Pretty much its only reason for continued existence, it is now the integration language of choice, and integrating disparate systems is big business right now.
Usage for Desktop Applications: Oh, dear gods, no. If you're going to run on a desktop, compile and run native on the physical machine, not in a JVM.
Performance:
I don't know -- it depends on the VM. If you need high performance, however, you shouldn't be using Java. Real-time systems also shouldn't use it.
Also, it uses a lot of memory and takes a long time to start up.
Otherwise it's decent (until you do trig on x86...)
Oracle Takeover:
No opinion.
Features:
I like how it has enough libraries to do almost anything (that isn't low-level hardware... which shouldn't be dealt with in Java anyway), and has them standardized (unlike C/C++ (I'm not referring to libc here, but all the other libraries as well)).
Cross-Platform Viability:
Many end-user applications would benefit greatly for this. This is by far Java's strongest point.
Usage for Desktop Applications:
Very useful, except for memory usage and startup time. However, due to the startup time, I prefer to use native applications.
Usage on Websites (vs. alternatives):
What alternatives are there that are widely used (i.e. might be found on someone's computer)?
Other General Thoughts:
I find Java is obsessively object-oriented, to the point that it hinders code development. It is also really easy to end up with spaghetti-and-meatballs code, unless you are very careful to plan your code out well.
On the other hand, my C/C++ and other code improved after using Java due to the time I have to spend designing the various roles of my classes.
It is useful for something that should be cross-platform. In particular, I've used it as a graphical frontend to an embedded (or server, if you wish) application with success.
Performance:
I don't know -- it depends on the VM. If you need high performance, however, you shouldn't be using Java. Real-time systems also shouldn't use it.
Also, it uses a lot of memory and takes a long time to start up.
Otherwise it's decent (until you do trig on x86...)
How widely do the virtual machines differ? Don't most Windows and Linux users use the standard VM from the Java website?
Quote:
Originally Posted by crosstalk
Features:
I like how it has enough libraries to do almost anything (that isn't low-level hardware... which shouldn't be dealt with in Java anyway), and has them standardized (unlike C/C++ (I'm not referring to libc here, but all the other libraries as well)).
Why? To what extent are you talking about when you use the term 'low-level'?
It seems Java has done well taking advantage of the extra features on the Android platform, for instance the accelerometer, GPS, touch screen, mic/speakers et cetera.
Quote:
Originally Posted by crosstalk
Features:
I like how it has enough libraries to do almost anything (that isn't low-level hardware... which shouldn't be dealt with in Java anyway), and has them standardized (unlike C/C++ (I'm not referring to libc here, but all the other libraries as well)).
This is a significant deterrent for me. (with regard to C/C++)
Quote:
Originally Posted by crosstalk
Usage for Desktop Applications:
Very useful, except for memory usage and startup time. However, due to the startup time, I prefer to use native applications.
Do you think it is fast enough to run demanding applications speedily? Frequently? Efficiently? On a wide range of hardware?
Quote:
Originally Posted by crosstalk
Usage on Websites (vs. alternatives):
What alternatives are there that are widely used (i.e. might be found on someone's computer)?
Flash, potentially Silverlight.
Quote:
Originally Posted by crosstalk
Other General Thoughts:
I find Java is obsessively object-oriented, to the point that it hinders code development. It is also really easy to end up with spaghetti-and-meatballs code, unless you are very careful to plan your code out well.
Could you expand on this? I'm not sure what you mean.
Quote:
Originally Posted by crosstalk
Good luck learning to program.
Thanks.
I haven't gotten too far into yet; but I do know arrays, loops, variables, conditional tests, and most of the basic syntax.
Last edited by lupusarcanus; 03-02-2011 at 02:31 PM.
No, not really. I see a lot of comparisons between Java and C, but it's helpful to understand that I've never supported C, and Java still comes up short against it in some of those benchmarks, so that's hardly convincing. I also noted no mention of a JVM's voracious appetite for memory consumption, which can have a significant effect on overall system performance. And your source completely ignores one important and unavoidable fact... a JVM represents an abstraction layer between program calls and machine code, and anytime you add a middle man, you increase CPU overhead. Furthermore, the overall idea of the article is that Java is approaching or perhaps surpassing C performance, but that was in 2003. Let's see the follow-up numbers.
It'd probably help to understand that I'm coming at it from a systems angle instead of a programmer or user angle, so I'm the guy who is suffering during all that JIT compilation. Once the system has been up and running, some users have exercised it, it's been through a couple of garbage collection cycles, and the cache and the modules have been tuned by the JVM, it might perform well, but it's fairly painful getting up to that point.
Quote:
Originally Posted by lupusarcanus
What language would you recommend for cross-platform desktop applications?
Um... anything else.
The benefits of Java code are more likely to be realized in a high-traffic server environment, and the main penalties (long startup/shutdown, high memory overhead) are unlikely to be acceptable to a desktop user when compared to a pre-compiled equivalent in pretty much any other language.
I've completed a few small projects in Java, including a game I wrote for college credits. I'm far from being an expert though, so I don't know how much I can add to what's already been said. Here goes anyway.
Performance: Not bad for what it is, but could always wish for faster.
Oracle Takeover: No opinion.
Features: It had everything I needed for high level programming, and I barely scratched the surface of what exists. I liked how well documented the language and classes are, with everything I could possibly want available on the web site and downloadable reference.
Comparisons to Other Porgramming Languages: Java will never replace C, assembly, Python, or even C++. All those languages have their place. Lately all my projects are in Bash, but if I were working on something large and ambitious I'd certainly consider Java or C.
Job Market: I'm not really the one to ask, but certainly the more languages you can learn the better your prospects.
Cross-Platform Viability: Java is a great choice. For example my own Java programs ran on both Kubuntu and Windows with little or no changes.
Usage for Desktop Applications: Java is certainly capable of producing useful and worthwhile desktop applications. I've used a few, and would not shy away from writing my own. To be honest though one really should consider native programming, especially when performance is a priority.
Usage on Mobile Platforms (i.e. Android): No opinion.
Usage on Websites (vs. alternatives): I've seen a lot more growth on the web in Flash and Javascript than anything else. Sometimes I think it would be better if Java saw more use in web based applications. It is certainly as capable as Flash in that regard.
Other General Thoughts: Java is probably the best language for learning OO programming. It is the only OO language I've ever successfully completed a meaningful project in. I'd recommend it over C++ for that reason alone. (Not bashing C++, but I've never completed anything I started with it.)
Last edited by Telengard; 03-02-2011 at 05:11 PM.
Reason: remove useless quote
How widely do the virtual machines differ? Don't most Windows and Linux users use the standard VM from the Java website?
That is probably true -- and that virtual machine has great performance (it is about the best you can get out of something that isn't natively compiled). Others, like embedded virtual machines, don't do JIT compilation or optimization -- they just run it, at a much slower speed (if you only care about desktop, then Java is pretty fast).
Quote:
Why? To what extent are you talking about when you use the term 'low-level'?
It seems Java has done well taking advantage of the extra features on the Android platform, for instance the accelerometer, GPS, touch screen, mic/speakers et cetera.
But I don't suspect that those devices were interfaced with directly in Java -- a native library had to have been built (even if the support is in the kernel, exposed as a device file) before the Java interface could be created.
Quote:
Do you think it is fast enough to run demanding applications speedily? Frequently? Efficiently? On a wide range of hardware?
Java is not designed for high performance computing. Its performance is lower than that of C++. This improves if the process is run for a long time (such as on a server), with a JIT virtual machine (and can eventually exceed that of a poorly-).
The startup, as has been mentioned before, is extremely slow, however.
Quote:
Flash, potentially Silverlight.
I have never used the Flash development environment, but, as a client-side user of Flash, I find that it is of very poor quality. I can't comment on Silverlight. Java is the best I know of for this type of interactive web software development.
Quote:
Could you expand on this? I'm not sure what you mean.
I'm used to being able to start on a project, and after a little bit of thinking, write the code and have it turn out well. However, Java forces you to separate out objects for many things, which, if they are all closely linked, I would otherwise not have split up. For my first Java project, I had:
Main.java
plot.java
RecvThread.java--depended on RoboImg, plot (both supplied by Main after initialization)
robogui.java--depended on SendThread, RecvThread (both supplied by Main after initialization)
RoboImg.java
SendThread.java
UDPRecv.java--relied on an indicator on robogui, which it got by going through Main.
It just ended up being a mess (in code).
Also, the high level of object orientation causes otherwise single-line code to involve the creation of a dedicated object, such as a BufferedReader or BufferedWriter.
* Performance - bad
* Oracle Takeover - bad
* Features - it has many features as you probably already know
* Comparisons to Other Programming Languages - bad http://shootout.alioth.debian.org/u3...xint&lang2=gcc
* Job Market - hard to say, because I don't know of many professional apps written in java, and employers often look for C/C++ or others.
* Cross-Platform Viability - like crosstalk says, one of java's few strong points, except for the fact that just a little while ago it didn't run properly on 64-bit.
* Usage for Desktop Applications - rare, and quality is not on par with other programs. The only good desktop app written in java is probably Vuze/Azureus, and maybe minecraft.
* Usage on Mobile Platforms (i.e. Android) - I dunno.
* Usage on Websites (vs. alternatives) - It's actually quite rare, even tho you can do a lot with it. Like Telengard mentions, flash and JS have overtaken java since long.
* Other General Thoughts - There is no real reason for java to exist, and there is no reason for it to be like C. If you want to use it as a first language, go ahead, but I don't see any reason for it. It's not as easy as it should be, nor as useful as it could be ... it's mostly useless.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.