Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

closed as not constructive by Jarrod Roberson, Walter, ChrisF Jun 12 '12 at 13:38

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

112  
I think you're incorrect: it is still used, it's just lost cool factor. –  user4051 Aug 18 '11 at 14:43
36  
@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
19  
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
25  
@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
10  
@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. –  user1249 Aug 18 '11 at 17:10

39 Answers 39

up vote 116 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 is that JRebel lets you see code changes instantly.

share|improve this answer
66  
Play Framework is also like Ruby on Rails, but for Java. Code -> update your browser. –  Jonas Aug 18 '11 at 16:15
12  
@Jonas Man you are commenting on every question about Play! framework :) –  Chiron Aug 18 '11 at 16:16
26  
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
14  
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
18  
1) Using Eclipse, compilation happens as you type and you will rarely notice. Also, running Tomcat within Eclipse I can restart an app in under a second. I'm rarely hindered by restarting my apps 2) There's no silver bullet, guys. Ruby or any language doesn't make you 10x faster. The problem with Java dev is often ramp up time, but if you know what you are doing, you can get working in a project in <10 min. –  alex Dec 14 '11 at 22:41

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.

share|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
2  
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
8  
The new Java 6 EE - especially the web profile - allows for some pretty simple webapps. –  user1249 Aug 18 '11 at 17:00
2  
@ThorbjørnRavnAndersen The app might be simple, but understanding the framework isn't, and neither is understanding the main tools like Ant or Maven. A newbie's learning curve is huge and full of nested layers of acronym soup, confusion between specs (eg JAX-RS) and impls (eg Jackson) and more. It's IMMENSELY complicated to do something simple if you want to actually understand what you are doing. –  Craig Ringer Jun 11 '12 at 1:19

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.

share|improve this answer
7  
+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

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.

share|improve this answer
17  
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
4  
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 '12 at 13:14
2  
As someone fighting Django, allow me to just say: Coyote21 is absolutely right. You can get basic CRUD up and going in five minutes, but the second you start adding business logic (when this record is updated, a record must be inserted in this table, and...) to the CRUD, you've got issues. –  syrion Mar 25 '12 at 12:45

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.

share|improve this answer
3  
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. –  user1249 Aug 18 '11 at 17:01
2  
@Thorbjørn & Brian: See the video on the front page of the play framework website, it explains it very nicely I would say. –  Bjarke Freund-Hansen Aug 19 '11 at 6:52

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.

share|improve this answer
9  
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
5  
Flash did what Applets tried to be. Quick start up, fast download, low memory footprint. –  user1249 Aug 18 '11 at 17:56
4  
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
3  
@Kibbee ... or it gives Javascript a bad name :) –  Matthew Schinckel Jun 10 '12 at 12:36

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?

share|improve this answer
11  
"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." Lol :), have heard of the opposite case. –  Den Aug 24 '11 at 8:58
8  
Well of course you have. There's more to web applications than writing code, you have to know how to tune your servers, write optimal SQL and so on. That company had 2 .NET devs and no real server admins. The company that bought the company I was with also got that app in the deal. They were a massive Java shop and therefore had more resources available to guarantee stability. –  Adrian J. Moreno Aug 24 '11 at 18:45
33  
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
3  
Too be fair, investors tend to want to see the flavor of the year. But I still personally can't think of a worse choice for rapid prototype development barring very-high-quality Java devs which are not easy to find. –  Erik Reppen Jun 12 '13 at 21:28
5  
very-high-quality Java devs which are not easy to find - Indeed. –  luis.espinal Aug 3 '13 at 15:57

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.

share|improve this answer
9  
painless db access? Spring JDBC or Hibernate work great. Great string manipulation? Don't think string manipulation is much more than 5% in any project. Syntax sugar? What do you even mean by that. Rapid iterative process? Java has it (Tomcat inside Eclipse is painless). Java unfun? Only thing missing is concise anonymous classes/lambdas/etc. The "fun" features in other languages tend to obfuscate and make things less clear. Strings in switch... yeah, I gotta admit that sucks (however, most of the time, you should be using enums). –  alex Dec 14 '11 at 22:46
3  
@alex: Syntax sugar Java practically cannot be used for DSL, for example, Play's config and routes file aren't Java file, it's in a foreign syntax which does less than say django's settings.py and urls.py; no list comprehensions; crucial datatypes (e.g. maps, lists) are not imported by default; idiotic one-class-per-file really gets in the way; and Java APIs tend to be unnecessarily verbose. Also, you can't use enums when you're switching between strings you received from GET/POST parameter. –  Lie Ryan Jun 11 '12 at 2:19
1  
@alex Interesting. I tend to use generics everywhere in C# - although looking at it from the outside, that's probably due to the increased functionality of lamdas - So I can have an IRepository<T> with an IQueryable<T> Where(Expression<Func<T, Boolean> Expression). I wonder if they'll become more popular in Java when it gets lambdas? It's probably a comfort zone thing but Java just feels verbose - and very much like I've been handed enough bits to build 50 different types of car with no guarantee any 2 parts will fit together. –  Basic Mar 7 '13 at 22:31
1  
I can't believe that two people have argued that Tomat inside Eclipse is painless and makes Java development efficient. I find that it makes each development cycle much quicker, but requires daily maintenance, including repeatedly refreshing, rebuilding, cleaning tomcat, redeploying, restarting and sometimes restart Eclipse and repeating the earlier steps. If my car needed that much maintenance, I'd never get to work. –  Brandon Mar 20 '13 at 12:40
1  
@Brandon I will second that. I have never, not once struggled with a config issue in Node or Python/Django. I lose patience with RoR. Our Ant/Mvn/Spring/Hibernate/eclipse dependency-ridden Java codebase is a waking nightmare before you even get to the code. –  Erik Reppen Jun 12 '13 at 19:37

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.

share|improve this answer

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.

share|improve this answer

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 . . .

share|improve this answer

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.

share|improve this answer
1  
Start-ups use other technologies because they want to get it done now. Not later. And they went it to get done now by like 3 people, not 30. –  Erik Reppen Dec 7 '12 at 1:17

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.

share|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
1  
@James: do you have anything besides vague anecdotes to back that up? All the top-10 websites out there are either running on managed platforms (Amazon on Java, Twitter on Scala IIRC, Google on a custom backend of Java and C++) or else they have a highly customized infrastructure (Facebook and Wikipedia use PHP, but they both have huge amounts of custom native code for speed). Java regularly outperforms dynamic languages in benchmarks. I'm no Java zealot, but performance is not Java's problem. –  Daniel Pryden Aug 19 '11 at 5:49
1  
@Basic: What is your point? There are lots of broken libraries and frameworks for any language. Yes, there is lots of crufty and out of date documentation -- but that's hardly unusual either. Conversely, there are some fantastic libraries, frameworks, and tools for Java. Are you seriously trying to suggest that there should be one end-to-end framework for every application ever? –  Daniel Pryden Mar 6 '13 at 22:00
1  
@Basic: Backwards from what? In the year and a half since I first wrote this answer, I've moved on and am currently working at Google, and I can assure you that Java is used very heavily for web application development at Google. Of course, Google's needs are very different from the needs of many other companies, but Java is a different beast entirely when you use the right libraries and frameworks -- just check out some of the things Google has open-sourced (Guava, Guice, GWT, Protocol Buffers, etc.). –  Daniel Pryden Mar 6 '13 at 22:11

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.

share|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

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.

share|improve this answer
1  
I don't agree with the paragraph that says: He's most likely a self-taught programmer. This is untrue these days, nowdays most people from 30's that program are competent programmers and have at least a degree. –  Coyote21 Feb 2 '12 at 13:17
1  
??? I'm painting the prototypical web startup. I didn't say anything about them being competent. You can be self-taught and competent at the same time. I'm not sure what you're disagreeing with. –  Mike Brown Feb 2 '12 at 13:25
1  
This was to be my answer. Java is pretty much the only current web technology that isn't designed so that any competent developer can just pick it up and use it. The second part of your answer is pretty much what Paul Graham wrote in The Python Pardox –  user16764 Jun 10 '12 at 13:00

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.

share|improve this answer
2  
I'll take more choices and a little more complexity over PHP's over 9000 built-in methods. –  Kaleb Brasee Aug 19 '11 at 2:54
1  
PHP is just so easy to setup. –  Barfieldmv Aug 19 '11 at 11:22
8  
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

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.

share|improve this answer

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.

share|improve this answer

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".

share|improve this answer
6  
Agreed; Java EE 6 is great as soon as you drop JSF2 and use something sane and productive. The learning curve is still immense though. –  Craig Ringer Jun 11 '12 at 1:22
1  
You could add Tapestry5 (tapestry.apache.org) to your list of modern Java web frameworks. –  Neeme Praks Jun 12 '12 at 10:09

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.

share|improve this answer

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.

share|improve this answer
8  
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

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.

share|improve this answer

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, Django 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.

share|improve this answer
2  
I love OOP. I also know OOP which is why I would disagree that the vast majority of Java devs are doing too much of it. You can write a class but if your code is still a tangled spaghetti mess, all your really did was find a way (beans) to write crap procedural code with pointless structures wrapped around what might as well be simple functions or structs at best. –  Erik Reppen Dec 7 '12 at 1:13

In the startup I work for we chose to use both Java and JRuby to implement our API because they complement each other.

For infrastructure, process distribution and communications we leverage Java's robustness, whereas for the actual implementation of the API endpoints we chose JRuby since all the calls involve JSON and it makes a lot more sense to manipulate a loosely-typed representation (JSON) using a loosely-typed language (Ruby).

If we see one of our JRuby classes is becoming a bottleneck, we just re-implement it directly in Java (basically a line-by-line translation). This can happen quite often with classes which must do a lot of computation, and in this context JRuby behaves much like a prototyping language.

We implemented our own dynamic class loader which means we can change Java classes on the fly without restarting the server, and we've been very happy with the choice. So the "you need to compile and restart each time" argument does not hold much weight.

The key is to avoid all the Java EE stuff - it's huge and cumbersome and anti-agile.

share|improve this answer

The question should be "Why isn't Java used by startups or for small projects?". Java certainly used for "modern Web apps". At Google, Java is used on the backend for many services, and closure compiled JS or GWT is used for the frontend. The issue is one of speed vs scale. Startups need to get to minimum viable product. They are usually small teams of 1-3 engineers, and value iteration speed over performance or maintainability. Running up against scalability issues or team code code maintenance issues is a problem "you'd like to have", that is, by the time you reach that stage, it's a sign your initial implementation helped you over the initial hump of getting customers or investment. You can afford to rewrite the app at that point.

A company like Google can afford the luxury of building things for scale up front, even though they may be wasting their time implementing scaling for something that might get no users, because they can absorb the loss.

At least, that's my opinion, that many many "cool", "hip", "modern" companies build small apps with small teams where iteration speed and simplicity are the greatest requirements.

share|improve this answer

Java was cool, Java is cool and Java will be cool in future. I'm developing a web App. Using Java.

The main problem with Java is it needs a medium size team 7-10 people to see the results of implementation. Developers of the back end must have the knowledge of application architecture from ORM to Application framework to presentation layer. Too many options for developers on the table, and this raises the questions, is it a good idea to use a ORM or not? Which ORM framework to use? Which application framework to use? How to implement the front end? All this makes the developers struggle and makes the combinations endless from the end user to pick this technology with that framework that developers are not familiar with. The same is with IDE plugins; too many options, a lot of time is spent on installing, configurating, and testing if this version of a plugin works with this version of the IDE and so on. The last thing is hosting; many developed Java Apps don't go out to public because there is no proper web hosting for Java web apps, getting one VPS for $80/month is not an option for too many developers, and most applications needs more than one VPS.

share|improve this answer

Compiled langauges like Java enforce too much discipline for start-ups to follow. PHP on the other hand is moldable to the extent of being incomprehensible. Discipline and flexibility are generally opposed to each other.

share|improve this answer
1  
Startups != "undisciplined" –  canadiancreed Jun 10 '12 at 13:57

I still have the feeling that Java is being used in a lot of web development. But it's usually on the more business-oriented-no-mainly-tech-big-company kind of developments, which typically are less open then new startups that have to get some traction and promote their own work, as well as more interested in technology. So, even if it is used in a lot corporate web sites, you'll probably never know, as they won't really care to tell publicly about their technology stack.

That said, commenting all the original questions...

Is it a weakness of the language? Compared with other languages like Python or Ruby, Java is verbose and tends to need more code to do similar stuff. But it's not just the capabilities of the language, also the community surrounding it and the kind of developers that uses those tools. So, most of the modules and tools on Python, Ruby, PHP, etc are open source and are easier to find than in Java world, just because this one is more focused on giving (and charging) services. For example, the Ruby community is really really oriented to web development, so every developer that is able to use Ruby will know about the problems and available tools for a web project. That is not necessarily true for Java developers, that could have been working on other kind of systems, like reporting systems. Of course, any good developer will catch up, but the perception is that the average Java developer is less worried about learning new technologies and new languages.

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)? Java is not really that old, and, being fair, it has greatly improved. It was the cool, relevant platform about 10 years ago. But since then, there have been new platforms with newer problems in mind, like Ruby on Rails. The core sector of Java has been mainly the corporate world, with different problems, so the people searching for new projects outside that has been looking for different tools. Also, the main advantage of Java design, being multiplatform, is not as relevant today as it was before.

Is the negative stereotype of Java developers too strong? (Java is just no longer "cool") That has also some truth in it. Java still is the language to learn "to get a job". So, if you don't care, but just want to learn something to earn money, you'll end learning a little Java and not caring ever again to improve. Again, is a lot about perception and visibility. There are tons of great Java developers that are coding without sharing their knowledge, while there are lots of PHP developers, maybe not as good, that are writing blogs and collaborating into open source. That leads to think that the PHP developers are better than Java ones, as you have certain feedback about them.

Are applications written in other languages really faster to build, easier to maintain, and do they perform better? I'd say that they are faster to build. The principles of languages like PHP, Python or Ruby makes them quite good for generate software that can change constantly. E.g. Dynamic typing makes easier to change an interface. In Java having a well defined interface is important, which leads to more stable (and difficult to change) interfaces. This is very important in a new startup, which main problem is to get a product before you run out of money. About performance, it is very very easy to misunderstood the needs and try to use magic tricks to achieve the required performance, like "Java is faster than Ruby. Period" or "MongoDB is web scale". Reality is more difficult than than.

Is Java only used by big companies who are too slow to adapt to a new language? Definitively, having already an existing team of Java developers in the company, makes easier to keep using the same language for new projects. This is perceived as "the safe bet", specially if the core of the company is not technology. But, anyway, Java is not ONLY used on big companies, there are still a lot of startups that uses Java for cool stuff (For example, FightMyMonster or Swrve uses Java extensively), but I'd say that the general tendency in the startup scene is to use other languages. That is also a way of getting people, as most people will be more exciting to work with Ruby, Python or PHP, perceived as more "friendly" and "fun" languages than to work with Java.

share|improve this answer

Who says it isn't?

Spring MVC + Spring Data JPA or Mongo + Thymeleaf for templating + coffee-maven-plugin for Coffee to JS transpiling and you're good to go.

share|improve this answer

The problem with Java is that this language is learnt in school, so it's the language the most known by new programmers. So if you want to differentiate yourself from the mass, you have to learn a new language, Java is the language of the everybody.

The second reason is that at school or in big companies when you want to build a web application, teachers or people already in place give you tons of java frameworks to help you to build this application faster. But in fact, in this way you build your web application without really understand web (HTTP, HTML, CSS, Javascript, etc...). This trend is less visible with other languages like RoR or Python, developpers using these languages have a better understanding of the web.

So the statups who want to build modern web applications prefer to use RoR, PHP or Python to attract good web developpers, those who understand the web and not only a programming language.

share|improve this answer

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