tags:

views:

760

answers:

11

Hi! As a Java newbie I'm wondering: of all the languages in the world, why is Java frequently used for enterprise applications? What makes it that way compared to the other languages? Will it continue to be this way in the upcoming years?

I'd appreciate your insights. Thanks in advance :)

A: 

It's cheap, RAD, cross-platform, and developers abound.

Ehtyar
+1  A: 

Developing in C++ is too slow and expensive and .NET has not been around for long enough. Business inertia is huge, remember.

Businesses want languages that are backed by a professional provider (ie. a company like Sun) and often stay away from Open Source languages for the simple reason that it was not written by a company.

Lenni
I don't think it's fair to say ".NET has not been around long enough" - .NET has plenty of adoption in the corporate world.
matt b
C++ is too slow? I'd beg to differ (both in terms of writing C++ and its execution speed).
Shane
C++ runs extremely fast, but your average developer will be able to develop robust applications more quickly in Java. It's a simple matter of what the language is designed and optimized for.
Quinn Taylor
Yes, .NET is very prevalent in medium business and some big ones but many companies have bought a large part of their IT structure in the 90s when their only choice was Java.
Lenni
There are also pleanty of CTOs (I've met some) who still would rather stay away from .NET at the enterprise level (the kind who would never want to go into production on Windows, for example).
Yishai
+6  A: 

Sun targeted Java to speak to the needs of enterprises early on. It pushes standards that promote vendor independance at every level. Platform independant, database independant, application server independant, etc.

In addition they promoted enterprise level tools for it, in terms of messaging, transaction management and other things that the enterpise worries about.

Before Java, enterprise level stuff tended to be done in C++ (there were plenty of exceptions (does anyone remember PowerBuilder?) but that was the rule) and Java fits well as a successor to C++ for business applications, where that kind of memory management isn't something worth paying for.

In addition to all of that the language itself speaks to enterprises in terms of avoiding hard-to-get-right constructs that can really mess up a code base, such as operator overloading. Enterprise level applications tend to get handled by many different hands, not all of which are the top of the line programmers, and having safty nets to prevent shooting themselves in the foot is a desirable thing.

It also came along at the right time. A new paradigm (this was well before .NET existed) that promissed to combine multiple vendors into an ability to compete with Microsoft, which got the likes of IBM and Oracle on board, that happened to fill a new hole, which was the emerging requirement to develop web applications, where C++ was no longer an obvious choice.

Yishai
+1  A: 

Also for client-server applications, you have an abundance of choices for production-quality app servers that have the same J2EE interface (IBM WebSphere, BEA Weblogic, JBoss). Alternatively, you could use the Spring Framework on any server like Apache Tomcat the complies to the Servlet API if you're convinced you don't need EJBs. In contrast to .NET, it's hard to find choices with respect to app servers.

There are an abundance of choices with regards to frameworks for a given task be it an ORM tool, logging, collections, caching, web UIs, etc. There is no hardly any need to reinvent the wheel.

Finally, while it's fashionable these days to lament the very real shortcomings of Java the language, it's a language where folks know how to get things done and how to avoid certain anti-patterns.

Alan
This is due to the strength of the Sun specifications.
Thorbjørn Ravn Andersen
+4  A: 

Business is about time, money and opportunity.

Using Java means that your number of errors in the code goes down, simply because pointers are hard. You use a GC and you instantly remove an entire class of errors from your code.

Secondly, Java was one of the first languages to ship with a pre written library of functions, which really did cover a lot of the development phase. This restricted the way things were done but it meant that people could learn faster, had more tools at their disposal and had a great set of libraries to do things like network, GUI, web, encryption etc. Java on its own as a language really wasn't that special, but Java plus the Java API was.

So if you've got a language that has less errors and more infrastructure for free, then you end up with more code in less time. Sure the code doesn't cure cancer, it's not as fast as C++ code to achieve the same task, but it will achieve the business' goal of getting an application.

If you make more code, for less money, you can pursue more opportunities. You then bring inertia to the table in terms of code that's already been implemented in Java and you start seeing why the business doesn't want to move away from their comfort zone.

Spence
+17  A: 

One word: libraries. Java has an vast array of excellent libraries for solving most of the common problems one needs to solve when developing enterprise applications. In many cases, there is more than one good choice for addressing a particular need, and oftentimes those libraries are free and open source under a business-friendly license.

Some have argued that there are, in fact, too many choices in the Java ecosystem, and that developing enterprise software in Java requires developers to make a large number of decisions that can have far-reaching impact on the end product for better or worse. This has probably helped propel the popularity of alternatives like .NET, which has a reputation of offering fewer choices, but with the benefits of a more well-integrated application stack and tools set. What direction you choose depends, I guess, on whether you place more value on "freedom of choice" or "freedom from choice".

Rob H
I think "freedom of choice" is not really understood. i for example know many web frameworks and i have not chosen any of them. your boss makes the decision and every company is using different set of frameworks.
01
+1 for "freedom of choice" or "freedom from choice"
Kenji Kina
+13  A: 

There are lots of reasons a large company (the type to go for enterprise solutions) would pick Java. Note I'm not saying all these reasons are correct or valid. But the relevant point is that they appear valid to a CTO at MegaCorp.

Learning Curve

Java is a simple language without much of the flexibility of other members of the C family, this cuts both ways, but it is seen as a straightforward language for use by an army of programmers. Enterprise projects tend to involve large numbers of developers (rightly or wrongly) and it is much easier to get a developer to a minimum level of competence in Java than C++. You also have a whole generation of graduates who have probably been largely schooled in Java.

Choice

Java has a vast array of libraries, frameworks, tools and IDEs, and server providers. To an enterprise its good to have choice, even if that's just for use as a bargaining chip when negotiating price. The language lends itself to code quality tools that allow enforcement of corporate standards (and as mentioned there are a lot of those tools).

Platform Independence

Java is write once, run (well, debug) everywhere. Sun has actively encouraged open standards that allow multiple vendors to implement their solutions. These standards give the customer the comfort that they can migrate from one vendor to another if a given vendor goes under or starts charging more. Of course the reality is that each vendor does their best to provide some "added value" features that tie the customer to them quite nicely.

Maturity

Its been around a long time, running a lot of servers. If your web application needs to be "6 sigma" or similar and you are the MegaCorp CTO, you are not going to look that kindly on Joe the developer wanting to do it in RoR.

Timing/Marketing

Java came out when programming was moving towards the web. It was positioned cleverly and got a strong position early in web development. Because of the open standards, there are some very big companies producing these platforms and they market Java pretty hard to sell those platforms.

Inertia

Large corporations move forward at a glacial pace (a lot are still using Java 1.4 five years after 5 was released), so once they've picked Java, it takes a massive investment to move to another platform. With each day that goes by they're cranking out more Java that would need to be migrated. Most of these companies are not primarily coding shops, so it is a very hard sell to convince the business to spend a few tens of millions rewriting their entire code base for no immediate business benefit.

Rich Seller
+4  A: 

Another reason might be the care Sun has taken to keep Java backwards compatible. The vast majority of Java code can be run on the latest version of the JVM without a problem. That is quite an achievement, given the age of Java. On the other hand you might argue Java has not changed all that much in all these years.

Enterprises like stability in a platform.

Jeroen van Bergen
+1  A: 

The other answers are all good. Two things need to be added, corporate standards and the bandwagon effect. If you want to build an enterprise system you need to have pretty strong case for not using your company's entrenched standards and this is mostly JavaEE. And if you need to resource a project it is a lot easier to recruit a Java programmer than it is, say, Erlang.

Paul McKenzie
+1  A: 

Personally I believe one major reason is the cross-platform issue.

Java programs written "correctly" (without assumptions of the underlying operating system) can run on any JVM. This means that you are not tied to a particular platform, unlike .NET which marries you to Windows.

I have seen Java code run on mainframes, Linux routers, inside Oracle database, and naturally on PC's.

Thorbjørn Ravn Andersen
+2  A: 

I shouldn't be saying this, but...

The real reason is because it's named after coffee!

R. Bemrose