Ask HN: What's Java used for?

17 points by oldmanstan ↗ HN
I just start learning it in school. We're making a game.

What can it be used for on the web, though? What big companies use it primarily?

20 comments

[ 3.1 ms ] story [ 60.2 ms ] thread
It can be used for just about anything except maybe low-level operating system stuff.

"What should it be used for?" is a different question and depends at least somewhat on your preferences.

I go to Java when I want a desktop application that should be portable, doesn't need to be lightning fast, doesn't depend on any low level operating system stuff and that I don't mind losing pointers and memory management for. In other words, most of the time I'm writing a non-web application, I go to Java.

I personally don't like using it for web stuff except where small applets are concerned. I've had issues with it (it including Java, JSP, etc) and generally find it to be too heavy and not practical for web development. But that's just my opinion.

A buddy of mine is a programmer at AT&T, and they (mostly he) have developed a pretty incredible push notification and messaging system using Java on the back-end. He claims that they're getting some pretty astounding message processing rates. I keep having trouble thinking of Java as "fast", but that might just be due to really crappy desktop app experiences.

But anyway: one of the biggest companies in the U.S. uses Java to do some really cool stuff.

I keep having trouble thinking of Java as "fast"

When it first came out it was an absolute dog. Then Sun kept promising "faster than C" performance because of VM optimisation. The reality was that desktop apps were barely usable and the HotJava web browser was scrapped.

However, after over 15 years of VM optimisation and heavy use, Java is nice and fast. Its not quite up to C++ levels of performance but it is very respectable.

In the social web area, LinkedIn uses a lot of Java. Hi5, too -- at least before the recent games focus, and maybe since.

Lucene and SOLR for search are behind lots of websites -- public and intranet.

Hadoop and related tools -- MapReduce, HDFS, HBase, etc. -- are big in large-data, big-calculation systems, even when front ends are implemented in other dynamic languages.

Looking over all the open source Java projects at the Apache foundation may give a sense of range of uses on the net. And with the growth in alternate JVM languages -- like Groovy, Clojure, and Scala -- a bit of Java, or some Java libraries, may be part of projects in those languages as well.

Almost all the big online gambling platforms (sportsbooks and casinos) are written in java.
Google got Java libraries for most of their APIs, and for developing over App Engine.

Blackberry and Android got mini Java sdk for developing movile apps.

Or if you want to develop over Cloud Computer systems you might want to give it a try to Hadoop, that is also written in Java.

So, yes, there are tons of real implementations in Java, even though is not a language I could say I love...

In corporate-land, enterprise web applications are generally .net or Java.

Enterprise Java is referred to as Java 2 Enterprise Edition (J2EE). In this case, the web output a user sees in a browser is generated on an application server using a mix of Java code and templated HTML/CSS/Javascript/etc.

Yes, but the interesting question is why? Many large corporations indeed use Java, and the often-touted reason is safety and/or speed. Is that still a valid answer in today's web dev world? What would you recommend that AT&T for example uses if they could start all over again today?
IMO, Java is appreciated for the following reasons:

  - there are plenty of reliable open source libraries (see Apache)
  - it is easy to learn and to maintain
  - the IDEs are good (IntelliJ IDEA !)
So, yes, this is still a valid answer, IMO.
also, the performances are quite good, and you are able to buy support from ibm/sun/oracle.

Neither it's true for python/ruby/perl etc.

(comment deleted)
there are more java and .net programmers out there than python/ruby programmers. hence a java programmer is easy to find, cheaper to hire and less disruptive to fire. This is probably one of the most important reasons why corporations prefer java/.net over ruby on rails/python. that said, when a programming language is around for more than a dozen years, it gains the tag of being reliable ( rightfully so).
Remember that the runtime, the JVM, is separate to Java the language. Lots of interesting languages run on the JVM, like JRuby, Clojure, Jython, and they get access to a scalable optimised runtime and lots of useful libraries.
What big companies use it primarily?

Banks - their back-end processing is often in Java.

building java app servers such as with websphere and weblogic
Palantir software is almost completely Java.
More on banking software: works from backoffice intranets / middleware (J2EE) to low latency trading (core J2SE).

The plus I see, is not having to worry too much about errors (wrt C++). Makes working with large codebases / multiple collaborators easier. Great IDEs too.

Still, coding in Java is quite boring (overdeclaration, lack of pointers/unchecked sections, ...).

Minecraft and Tribal Trouble are two rather good games written in Java