As a professional Java programmer, I've been trying to understand - why the hate toward Java for modern web applications?

I've noticed a trend that out of modern day web startups, a relatively small percentage of them appears to be using Java (compared to Java's overall popularity). When I've asked a few about this, I've typically received a response like, "I hate Java with a passion." But no one really seems to be able to give a definitive answer.

I've also heard this same web startup community refer negatively to Java developers - more or less implying that they are slow, not creative, old.

As a result, I've spent time working to pick up Ruby/Rails, basically to find out what I'm missing. But I can't help thinking to myself, "I could do this much faster if I were using Java," primarily due to my relative experience levels.

But also because I haven't seen anything critical "missing" from Java, preventing me from building the same application.

Which brings me to my question(s):

Why is Java not being used in modern web applications?

  • Is it a weakness of the language?

  • Is it an unfair stereotype of Java because it's been around so long (it's been unfairly associated with its older technologies, and doesn't receive recognition for its "modern" capabilities)?

  • Is the negative stereotype of Java developers too strong? (Java is just no longer "cool")

  • Are applications written in other languages really faster to build, easier to maintain, and do they perform better?

  • Is Java only used by big companies who are too slow to adapt to a new language?

link|improve this question
44  
I think you're incorrect: it is still used, it's just lost cool factor. – Graham Lee Aug 18 '11 at 14:43
19  
@Graham Lee: Java has ever been cool? I must've missed something. Well, I guess it's cold coffee, but cool? I think the main reason is that java, especially the enterprise java frameworks have been and still are heavily overengineered. You can't consider them lightweight, you just use them because you need the distribution/balancing/scalability features of the platform and want to use a framework for the frontend that is done with java, too, for the sake of homogeneity. – Falcon Aug 18 '11 at 14:57
12  
Maybe, because it's not modern? :P And Java never was cool, simply because it threw the hacking part out of programming. – back2dos Aug 18 '11 at 15:25
12  
@Falcon Java was cool back when it was first introduced, Sun did a great job hyping Java, whether the hype was justified or not has nothing to do with it being cool or not, a lot of cool things are hyped for no reason. – Mahmoud Hossam Aug 18 '11 at 15:40
5  
@Falcon, you should have a look at creating web applications with JSF 2.0 in Java EE 6 and compare it to your experiences. You may be pleasantly surprised. – Thorbjørn Ravn Andersen Aug 18 '11 at 17:10
show 9 more comments
feedback

23 Answers

up vote 45 down vote accepted

Modern day startups need to hit the market as soon as possible. They don't need to spend about six months in order to release their Java web application.

Twitter for example was built using Rails/Ruby but once it became unscalable, they migrated to the JVM.

Not to mention that the development process isn't productive: code -> compile -> deploy while it is in frameworks like (Rails/Django/Grails): run testing server -> code -> change things and see what happens.

The good news that JRebel lets you see code changes instantly.

link|improve this answer
14  
Play Framework is also like Ruby on Rails, but for Java. Code -> update your browser. – Jonas Aug 18 '11 at 16:15
4  
@Jonas Man you are commenting on every question about Play! framework :) – Chiron Aug 18 '11 at 16:16
4  
Just try to get rid of some misconceptions. Java EE is not the only thing on the Java server side as many seem to think. – Jonas Aug 18 '11 at 16:19
5  
Facebook also does something similar. Their code base is in PHP, but because of speed and scalability problems, they had to write a compiler (HipHop) that compiled the PHP to C++, which is then compiled using g++. It's funny how everybody talks about how great ruby and PHP are and that all the sites are built around them, but then when you look at how inefficient they are, most large organizations have to switch to something else. If I recall correctly, Craigs List hasa lot of backend code written in C/C++ for this very reason. – Kibbee Aug 19 '11 at 13:24
show 6 more comments
feedback

In my experience, Java for web applications is overkill for small applications. A simple blog with one database table hold blog entries, for example, could be done in something much simpler.

I have usually seen Java do much better in much larger web applications (think banks and insurance companies) that communicate with a number of other systems (such as mainframe back-ends and databases and peer web-services background batch-processing systems... all in the same application).

From what I've seen, the architecture of a JavaEE web application is just usually more than is needed for small/simple web applications.

link|improve this answer
3  
For "small" applications, this is even more true if you have to (because this is the "standard" and the company uses it) work with monster application servers such as Websphere, whereas more often than not Tomcat for example is good enough... Why oh why do I have to work with that messed up administration console ? Sigh... – Jalayn Aug 18 '11 at 14:53
3  
@Jalayn: In my experience it's because they only want to maintain one application server program for everything, rather than admin WebSphere for Team A, Tomcat for Team B, Glassfish (or something else) for Team C... and I can understand that feeling too, but yes, it's frustrating to me as well. – FrustratedWithFormsDesigner Aug 18 '11 at 15:00
1  
This is true for Java EE, but now there is Play Framework that will make your Java web apps as lightweight and productive as Ruby on Rails. – Jonas Aug 18 '11 at 15:38
5  
The new Java 6 EE - especially the web profile - allows for some pretty simple webapps. – Thorbjørn Ravn Andersen Aug 18 '11 at 17:00
show 3 more comments
feedback

An addition to the FrustratedWithFormsDesigner's answer: Since I guess that your question more targets towards smaller sites, there is an important aspect that you need to consider for a lot of people: Hosting is ubiquitous for PHP but its harder for Java or ASP sites. This however is not a defect of those languages.

link|improve this answer
1  
+1 for this. It's far easier to host many sites on a server for PHP than it is for Java and added to that it is far easier to find cheap web hosting solutions for PHP than for Java. – Jonas Aug 18 '11 at 15:43
1  
@Kibbee - Arvixe That is who I use. I have the personalASP Pro plan. – Jetti Aug 19 '11 at 13:45
show 8 more comments
feedback

Start Ups want the shiny. Whatever the shiny is: RoR, Groovy, Grails, OOP w/ PHP, Foobar, Wibble, Narf, etc.

Enterprise wants stable, reliable and scalable: Java and .NET fit that bill (when done correctly).

Current gig: Financial Services. Platform: ColdFusion (essentially a Java Tag Library) and Java.

Previous gigs:

  1. Education Testing Services - ColdFusion
  2. High Risk Insurance - ColdFusion and Java
  3. 401k - ColdFusion and Java
  4. Travel - Java w/ internal ColdFusion apps
  5. Securities - ColdFusion (pre-Java version)

These are all high-volume, high-security sites. No one at any of these companies ever considered PHP, some looked at RoR and saw too many issues. The 401k company had a sister company running a .NET application with competent developers, the app just kept crashing every week. They finally converted it to Java and gained stability.

The only people that look down on Java are those who have no or little actual experience with it or have been involved with poor implementations and are now gun shy. They see the shiny and figure if all the cool kids are using it, why not me?

link|improve this answer
6  
It seems disingenuous to me that you've written that sentence stated as cause and effect. Convert to Java = stability gain? We all know that's not why. Also, sorry about all that ColdFusion experience ;) – Jordan Aug 25 '11 at 7:28
show 3 more comments
feedback

Well, I recently met with a Java guy that was really excited by the new Spring Data project, because of how little code it takes to get basic CRUD access to your DB going.

I can build a CRUD app using Rails (not just db access, but views and controllers) with a few commands.

(Off the top of my head: new project, 1 scaffold command per entity, 1 command to migrate the database, 1 command to start the server.)

It has nothing to do with the language, it's all about the tools. And it seems that dynamic languages tend to have the tools and frameworks that remove a lot of boilerplate code. (To make up for our lack of powerful IDEs that generate boilerplate for us.)

Also I feel that dynamic languages tend to make writing such tools and frameworks a lot easier. I can grok the code for say, Padrino or Rails (ruby web frameworks) a lot more easily than I can grok the code for say Spring Roo. This could be due to the fact that I know Ruby a lot better than I know Java, though.

link|improve this answer
4  
Personally I don't like dynamic languages. Static languages make me more productive when I can see all type errors fast in my IDE and use refactoring tools. You should have a look on Play Framework it's a Java web framework inspired by Ruby on Rails and makes you productive with Java. – Jonas Aug 18 '11 at 15:46
2  
An powerful framework, like rails also means that if something is bad implemented then most people can't replace it by something else, because that component is too tight with the framework. While for java, if I don't like Hibernate, I can use something else like cayenne or JPA for example. – Coyote21 Feb 2 at 13:14
show 1 more comment
feedback

Java absolutely is used for modern web application development. Particularly once you get to the slighly larger / more complex / scalable end of the web application spectrum.

If you are interested in modern, productive tools and frameworks take a look at:

But I think most truly modern web development on the JVM platform is likely to be done in one of the new JVM languages rather than using Java directly, with Java simply providing the backbone in terms of underlying libraries and back-end infrastructure. There is a lot of web development happening in Groovy (Grails), Scala (Lift), JRuby (JRuby on Rails) and Clojure (Noir, Ring/Enlive+lots of custom frameworks) to name but a few.

With all the innovation happening the new JVM language space, I personally suspect that Java will ultimately become the "assembler of server-side programming".

link|improve this answer
feedback

Java has been positioned in the recent years to be "enterprise". Which is on the other side of the spectrum of what a startup needs. In web application development you need 4 things - painless database access, great string manipulation, syntax sugar and rapid iterative process to make the numerous little changes your app requires.

Performance,scalability and stability are a bit lower on the priority list.

Also Java is very unfun language to code in. It got the revolutionary ability to use string in a switch statement just yesterday. And javascript is very hackerish language so after developing your frontend you feel very constraint when you return to java.

So I suppose these are the reasons webstartups avoid java.

link|improve this answer
show 1 more comment
feedback

It comes down to costs and trends. The Web 2.0 Startup is created by an under 30 visionary who has more talent than money (I'm generalizing of course but this is what you'll see "on average"). He is going to use a language he is familiar with because he's doing the programming (along with maybe a few friends). He's most likely a self-taught programmer.

Java has been targeted as an enterprise environment (by Java, I mean the language, the framework, and the standards). There are a bunch of expensive tools that the IBM's, Oracles, and BEA's of the world want to sell enterprises.

The steps to become proficient with Java are complex and/or expensive. I know the landscape is changing there but is it too little too late?

After the startup gains traction comes the growth. Recruiting talented developers is difficult. Most "become a programmer in six weeks" programs teach Java (or .NET) and the market is saturated with "six week programmers" (oddly enough I've seen developers with resumes saying 7 years experience that still show the knowledge of a six week programmer). Using a non-mainstream non-"enterprisey" environment can be a natural filter for six week programmers. It takes dedication and personal investment to learn a Ruby or Scala outside of a job requirement. This is the biggest indicator to me of potential for a candidate.

Knowledge comes with experience but a dedicated / passionate programmer will gain knowledge more rapidly (on average) than someone without that dedication / passion. Just like a kid who loves playing guitar will become better more quickly than a kid taking lessons because his dad made him.

link|improve this answer
show 3 more comments
feedback

Since you mentioned web development and Java, many people tend to forget that at the beginning using Java Applets in a web browser did not preform well, not only that, but the "sandbox" for the applets were not fully developed and there were security issues with Java Applets being able to run in the browser and access local machine data (aka client side security issue). Sure Java was solid in the backend and stand-alone applications but I think associating Java the language with Java applets (run on the browser) together kinda screwed up some perceptions about Java as a web development component. I don't think they ever recovered from that.

link|improve this answer
5  
Absolutely not! Actually Java is a dominant language in the server side world. Applets extinguished maybe decade ago. – Chiron Aug 18 '11 at 16:06
4  
Flash did what Applets tried to be. Quick start up, fast download, low memory footprint. – Thorbjørn Ravn Andersen Aug 18 '11 at 17:56
3  
I know a lot of people that can't even distinguish between Java and Javascript. Even though they are completely unrelated. This is another thing that gives Java a bad name. – Kibbee Aug 19 '11 at 13:37
feedback

Java is too complicated. I do a ton of PHP work and it's just easier and faster for most situations. The ability to just SSH into a server open a php file make changes save and be done is great. The few Java apps I've worked on have always required a restart for the simplest change. (not saying it's always the case just what I've delt with). Additionally PHP hosting is cheap and readily available.

I also think what you have at least with PHP is a lot of developers who like me started off 14/15 years ago with static HTML. As things progressed we started adding PHP to our sites because it was easy, simple, and affordable. Over the years the language has grown and has expanded it's abilities way beyond it's humble beginnings and now tries hard to be what I think is a lot of things it's really not.

On the flip side most PHP devs I know see Java as this giant overly complex 800lb gorilla, almost like getting out the 18 wheeler semi truck to drive down to the grocery store and get a loaf of bread.

I've tried to learn Java, my first impressions where that it was very long winded and carpal tunnel inducing. Additionally starting off it left me with a lot of questions that probably seem easy to a Java veteran. OpenJDK, or Sun? Tomcat, or Glassfish, or? Plus it seems every intro to Java book starts you out writing code for the command line. I think most people these days find that a snooze fest.

link|improve this answer
2  
but it's just makes it so hard to write good code... easier to setup, easier to start, less boring shouldn't be the criteria you use to choose a language. Good programming requires discipline, patience and effort... it's a bad sign if you don't have those while choosing... – alex Dec 14 '11 at 22:52
show 2 more comments
feedback

Traditional web applications on Java, though well structured, are very far from "rapidly developed". Though I've only ever written one full web application (Java/Tomcat/Struts), it was extremely picky, took longer than expected to debug, and was generally painful when implementing the business logic layer. In Java's potential defense, it was the only web application I had written in Java (though I'm used to programming systems-level applications in Java), and I believe I could write another web application slightly faster the second time around.

Having said that, I've also written applications in PHP and C#, and they just work better, and are far more forgiving than Java. More than that, Ruby on Rails was written specifically for rapid application development, which, like Robbie said, allow easy CRUD access to databases. The problem is that most web sites you will be developing on your own do not need the level of customization that Java offers (and requires you to perform). Additionally, every DB connection object must be written by hand and isn't that easy to templateize. There may be a better framework around, especially one that takes advantages of Java 7's new dynamic language support features, but I haven't done the research yet.

link|improve this answer
2  
You should have a look on Play Framework it's a Java web framework that make you productive with Java and is inspired by Ruby on Rails. – Jonas Aug 18 '11 at 15:41
2  
@Jonas, consider writing some good blog postings explaining all this concisely. – Thorbjørn Ravn Andersen Aug 18 '11 at 17:01
1  
@Thorbjørn & Brian: See the video on the front page of the play framework website, it explains it very nicely I would say. – bjarkef Aug 19 '11 at 6:52
show 5 more comments
feedback

In a recent interview with, Joseph Snarr, a technical lead for google plus explained how the application uses Java Servlets for the back end and JavaScript on the front end.

So to answer your question Java is still used for very modern web development. Just not for the start-ups that have been getting so much press recently.

I think the reason that a lot of the start-ups are using other technologies is because theyre sexier and have a more publicized an open source push behind them.

link|improve this answer
feedback

The frameworks for doing Java web development have quite a bit of learning curve, they're often overkill for what you need, and much of the indirection required to make things work is just...painful...to work with.

I used to work for a company that did Spring/Java development, and I found the framework cumbersome at best. I don't have a lot of pleasant things to say about Spring's framework, except I had a friend who used to do Struts development and he thought Struts was even worse. The web-framework is nothing like doing desktop applications or mobile (eg: android) applications, and has a lot of very abstract ideas that take some time to really grasp (though, certainly, that gives you a lot of power and capability if you're a pro and doing something really complex like an enterprise grade app). I love programming java for mobile or desktop devices, but java for web-apps? Not so much.

I haven't done any programming personally in Ruby/Rails, but my friend who used to do Struts is now doing Ruby web programming and testifies that things that are difficult to do in Java web programming require a lot less code and complexity to achieve in Ruby. There's certainly a learning curve to the different syntax and language rules, but for prototyping apps, it has an advantages in terms of how much code is required to achieve a desired result. As others have mentioned, scalability is an issue to consider as well, and one of the reasons more mature apps are not seen as frequently in more hip languages.

link|improve this answer
1  
+1 for framework. Not only were the original frameworks attempts P**s Poor (JSP, STRUTS), we now have about thirty to choose from not one of which works as well as RoR. – James Anderson Aug 19 '11 at 4:19
show 1 more comment
feedback

I currently work in a company which has quite a few "I hate Java" Developers. It used to stun me too. I certainly hate all the hoards of technologies that are available with Java. This makes taking decisions too difficult. Its like When you have too much choice you have no choice. You have to spend time with 100's of frameworks to really come up with the framework that works for you. The standard Servelt architecture is waayy to complicated for most applications. This is not the case with Ruby, Jango and stuff. They are are more of a single framework rather than language.

The biggest complaints I hear from developers

  1. The Syntax is too long. Just to print something we have to write System.out.print. You cant really use a simple VI like editor and write out a working piece of code in a few hours.
  2. Weak test frameworks. Even though the testing frameworks are very similar in Java and Ruby, Ruby takes a step forward by making thing easily available for testing. This is especially true if you are using DB extensively in your application. Even many of the Web frameworks dont think about testing.
  3. Templates are a pain. Makes the relatively simple language into a Noodle Soup.
  4. Not Cool. Most Java applications are written in huge companies, which is associated with Bureaucracy that does not go so well with developers. People don't think Google when they think Java. Google == Python. It has also to do a lot with no books coming out indicating do X in Y days.
  5. Dont like to compile. To most developers compilation is a decade old phenomenon. It made sense in 80's with C but mordern computers can do a lot more. They dont write code in compiled languages. Java is one of the very few languages that is compiled and used to write web applications.
  6. Too many Oops Concepts. Even though developers have quietly adopted the Oops domain. They dont like it in full. They dont like when you write an application with 10 classes with each class doing just one thing. Makes you open 100's of files and imagine interaction across 100's of classes, sometimes with frameworks. Makes the whole programming activity a chore. This could be true with most languages but I have seen that Java Developers pay a lot of attention to what a class does. Its the Java Developers who often come up with a code with 100's of classes. This is good from many perspectives but non java developers hate it.

So all in all Java imposes a steep curve at the beginning of the project, which means too much money to be committed. Add to this a huge community attached to java, each thinking in different ways and no one to really spear head the whole community. They also dont see talks and conferences conducted by the community showing off all the cool new things. No new cool books. Java it looks like will go down because it was used to solve too many different problems a few years back.

link|improve this answer
feedback

Depends how you define "modern web application development". If you are talking startup, fast turnaround websites, you will need to consider languages and frameworks designed for that purpose. If you are looking for stable, scalable, enterprise level web development, you look for languages and frameworks that support those ideals. In my book, those are two very different goals. RoR, Groovy, etc., are good for the first and Java is more appropriate, in general, for the latter.

link|improve this answer
feedback

My team and I are currently developing a greenfield web application in Java 6 + Stripes. Within the last year I also worked on another greenfield web application using Java 6 + Stapler (a somewhat unknown web framework developed by Kohsuke Kawaguchi of Hudson/Jenkins fame).

Java is absolutely used for modern web development. Certainly it doesn't have the "sexy" appeal of Ruby or other dynamic languages, but I'm far from convinced that dynamic languages are a good thing once a project starts to scale.

Modern Java app servers are very competitive with ASP.NET in terms of performance, and both are orders of magnitude faster than any dynamic language VM I know of.

Don't get me wrong... I'm not saying Java is always the best choice (not remotely!) -- but neither is it always a wrong or "outdated" choice.

link|improve this answer
1  
I tend to disagree with the "faster". In theory they should be but there are some massive php sites out there and nearly all the anecdotes about performance problems relate to MySQql or other underlying databases. On the other hand almost every J2EE app I have come on contact with needed extensive tuning before performance was even acceptable. – James Anderson Aug 19 '11 at 4:23
show 10 more comments
feedback

To add just a bit to what's already been said, I think a lot of it has to do with how fast you can go from nothing (literally) to a functional web application.

If all you have today is an idea, going from where you are now to writing your web application is almost as easy as falling down, whether you choose a hosting provider or your own infrastructure (like an EC2 image). Choosing Java, in my experience, is usually more work, and often costs more too.

Additionally, if you go with Linux and PHP/Python/Ruby, the tools and the platform are complimentary and designed to support each other. With Java, sometimes it seems the two worlds (OS and Java) sometimes don't seem to be working in harmony with each other.

link|improve this answer
feedback

Google App Engine supports Java, so that you can write your entire web app in Java, using Eclipse as the IDE and deployment interface, with a reasonably documented Google API -- so I wouldn't say it isn't used or isn't usable.

link|improve this answer
feedback

I think it is used alot more than you'd think -- the use is just below the waterline. There are many, many ruby on rails wrappers around thick, fancy java services. Especially when you start dealing with anything approaching big data . . .

link|improve this answer
feedback

An interesting answer is given by Dries Buytaert, who founded drupal. Although his PhD was about java, he chose php for drupal, and he didn't regret doing so. You can read it (and some of his comments) here: http://buytaert.net/why-php-and-not-java

It would have been very difficult to get critical mass if Drupal was written in Java.

link|improve this answer
feedback

In my company we use php and not java because the final server is more expensive. For a great project it's not important, or less, but for the other projects it's a reason. the final customer want to pay as little as possible maintenance and a php server is easy to find everywhere but java hosting no.

link|improve this answer
feedback

Simple answer: learning curve to base productivity.

Framework based systems like RoR tend to put the "magic" in the language/syntax. It is very easy to ramp up on your basic RoR syntax and get an app up and going.

Java was a language first, and tools and frameworks showed up later. So you have to learn Java first, and then you have to learn Spring, or Grails, or your super IDE, or whatever. Favorite example of Ruby, it doesn't require setters and getters. Fact is, Java IDEs got rid of the manual coding too...but it is still in your source. The benefit of this approach, is that below the framework, there is a language that consistent that all Java developers can work with.

This benefit is dubious to small startups where time is of the essence. Usually, they are doing very little that they couldn't do with an out of the box framework. So they can grab their RAD system of choice and have an app live the next day.

But if you look at Facebook and Twitter, as they expanded, they found things that couldn't be handled by out of box frameworks and so they had to use lower level technologies.

This holy war that framework developers have that they can do anything faster is bogus, they can do a lot of what they need simpler and with less of a learning curve. And for a lot of things, that is "good enough." Use what is right for the problem.

link|improve this answer
feedback

Java is tedious and verbose, but is still very useful when you need a cross-platform, GUI app that runs on hardware that is ill-defined.

For example, Amadeus (the largest airline/reservations system in the world) uses Java for its front end very successfully. The benefit is its simple deployability across multiple platforms (usually PC's, but of a horrendous array of specs ranging from 80386's in Peru to Core i7's in Europe). Sure it's a bit ugly, but does the trick, currently running on 10s of thousands of machines.

link|improve this answer
2  
But... we're not talking about cross-platform GUI apps: this question is about web application development. And your arguments are mismatched: "Java is tedious and verbose" is a criticism of the Java language, while all the cross-platform benefits are features of the Java platform. It is possible to write apps for the Java platform in languages other than Java: see Jython, JRuby, Groovy, Scala, Clojure, etc. – Daniel Pryden Aug 22 '11 at 18:20
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.