390

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?

Chiron
  • 4,543
  • 3
  • 28
  • 37
Cliff
  • 590
  • 3
  • 6
  • 12
  • 142
    I think you're incorrect: it is still used, it's just lost cool factor. –  Aug 18 '11 at 14:43
  • 41
    @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
  • 20
    Maybe, because it's not [modern](http://programmers.stackexchange.com/questions/101649/a-modern-review-of-java)? :P And Java *never* was cool, simply because it threw the hacking part out of programming. – back2dos Aug 18 '11 at 15:25
  • @Falcon, bac2dos, Java is a great language for what it does well (object-oriented application programming), but the web components of Java seemed a bit... hacked together without thought to how they were actually going to be used. – Brian Aug 18 '11 at 15:37
  • 28
    @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
  • 1
    Have a search for "Java web development" on this stackexchange site, there are plenty of similar questions, also with good answers. – Martijn Verburg Aug 18 '11 at 16:10
  • 3
    @Falcon, you happen to be a .NET developer? –  Aug 18 '11 at 16:59
  • @Cliff, "hate" might be too strong a word. –  Aug 18 '11 at 17:02
  • 1
    @Thorbjørn Ravn Andersen: Yes, at the moment I primarily develop in C# for .NET. But I've coded my share in Java (especially Java EE) and I cannot say I miss it. – Falcon Aug 18 '11 at 17:06
  • 11
    @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. –  Aug 18 '11 at 17:10
  • 5
    @Thorbjørn Ravn Andersen: My last Java project used JSF 2.0, Richfaces, JBoss SEAM and Facelets and still, it was a rather annoying experience. Writing custom controls with JSF is still way too cumbersome (and we needed a lot) and clientside javascript integration still boils down to writing javascript generators which generate the javascript you need. Anything you can't have from a 3rd party vendor becomes a pain. I prefer simplicity and the whole platform is quite the opposite. For simple applications it's ok, but complicated tasks become a pain. – Falcon Aug 18 '11 at 17:16
  • I have a ton of experience coding Java, but I run my own website using PHP. Did it in part to "keep up", but also because it is easier to setup and get it going. Just less hassle. But there is a huge, huge downside to PHP (or at least my crude attempts at it): Messy code, little to no reuse, mix of HTML and code, nested includes, etc. Back when I first started with Java I was writing JSP pages the same way, messy, but quick and simple. For some stuff that works great. But it can get pretty ugly if you are not careful. I've seen lots of PHP frameworks that never cleaned themselves up. – Fraggle Aug 19 '11 at 04:04
  • 1
    I would use PHP for small-sized projects and Java for larger projects. I once started a project in PHP and then had to throw it away in favour of Java. – Giorgio Aug 19 '11 at 11:25
  • 4
    @back2dos: Are you serious? A language is not cool because you cannot hack with it? Do you have any idea how many hours of tedious debugging you can save by not being allowed to hack? Especially when working on a large project. – Giorgio Aug 19 '11 at 13:55
  • 3
    Java is indeed less popular on the webdev zone than ruby or PHP. Yet, the fact it is the main technology behind Google+ and LinkedIn, and plays great role in twitter, shows it is still used for "cool and massive" applications. – Tzury Bar Yochay Jun 10 '12 at 08:23
  • Some useful comments about this question over at Hacker News: http://news.ycombinator.com/item?id=4090298 – andybak Jun 10 '12 at 08:46
  • @TzuryBarYochay I don’t think Java is used anywhere in Twitter, do you have a source for that? You may be thinking of Scala. – Konrad Rudolph Jun 10 '12 at 13:01
  • 3
    If you `haven't seen anything critical "missing" from Java`, you've probably fallen victim to [The Blub Paradox](http://www.paulgraham.com/avg.html). – fredoverflow Jun 10 '12 at 15:27
  • 1
    @Falcon Agreed; JSF2 is a wasteland of bugs and pain and horror. Best thing I ever did was give up on it. I love much of JavaEE6 (JAX-RS, CDI, etc) now that it's had TWO YEARS to cook the worst of the bugs out, but JSF2 remains awful. I was getting short snatches of productive code writing done between reporting bugs when using JSF2. – Craig Ringer Jun 11 '12 at 01:11
  • @ThorbjørnRavnAndersen You *like* working with JSF2, RichFaces, and Seam 3? What about the bajillion bugs everywhere in the framework, the awful documentation, and the uninformative exception backtraces from hell? – Craig Ringer Jun 11 '12 at 01:13
  • 2
    I had a full 8 years with Java, and it was precisely the web stack that drove me away from the Java land; As a coder with 12 years of experience I realize Ruby on Rails has shortcomings (some of them nasty), but at least I can get the job done with it. And the Java web stack? I felt like I was walking through a mine field. With 10+ middle-to-big Java Web projects under my belt, I finally gave up and figured "there has to be a faster/easier way to do this!" And, there is -- and it's not only Rails. SIDE NOTE: Java by itself is a very nice language, but I had enough of its verbosity, for good. – dimitarvp Jun 11 '12 at 01:45
  • @CraigRinger I believe there are some steps in-between "love" and "hate". Apparently you don't. –  Jun 11 '12 at 08:53
  • @KonradRudolph Scala indeed, which is a middle layer above the JVM -- Java Virtual Machine. This is Java by all means. – Tzury Bar Yochay Jun 11 '12 at 11:29
  • 2
    @TzuryBarYochay No. Details matter. The question was about Java, not the JVM. Not Clojure, not Scala. The reasons why Java falls out of fashion for (web) development are completely different (indeed, complementary to some degree) than for other languages targeting the JVM. – Konrad Rudolph Jun 11 '12 at 11:33
  • @ThorbjørnRavnAndersen Ouch - but fair. Call it "increasingly intense dislike". You're right that all frameworks have trade-offs and issues, and that it's a very complex job. I've suffered through a long jsf2 bug daisy chain as I foolishly adopted it when it was released and "ready", so I suspect I'm more bitter than is really healthy. It's not like Vaadin, play, or anything are exactly shiny perfectness either, just IMO a bit less broken and a bit better documented at the moment. – Craig Ringer Jun 11 '12 at 12:47
  • 1
    Relevant: Study of 49 programmers: static type system had no effect on development time... http://www.cs.washington.edu/education/courses/cse590n/10au/hanenberg-oopsla2010.pdf – Bozho Jun 12 '12 at 13:22
  • 1
    @KonradRudolph "I don't think Java is used anywhere in Twitter" -- Twitter uses Java For their search engine, see http://engineering.twitter.com/2011/04/twitter-search-is-now-3x-faster_1656.html -- though this isn't a web app. – Stuart Marks Aug 20 '12 at 00:32
  • 2
    @Bozho They used an artificial language called Purity for that study. Allow me to doubt their results :) – Andres F. Oct 20 '12 at 14:23
  • Why people say Java/J2EE frameworks web app is more secured than other? Only because of Java uses sandbox security? or any other factors compare to other server-side technologies? – LOG_TAG Aug 23 '13 at 10:55
  • No first class functions. – Skylar Saveland Jul 16 '14 at 23:03
  • 1
    Sounds like everyone has a problem with spring framework and JSF. Use standard java + embedded tomcat (import a few jars as opposed to installation) -> problem solved. If your application takes too long to develop or is too complicated then the solution is simple: Learn Java and stop wasting your time on money-driven frameworks. There are ways to increase development time i.e. patterns, oo principles, increased programmer control & knowledge, etc. As for plumbing work, use online tools and regex replacers. – ThreaT Jul 17 '14 at 19:05
  • I think the issue here is that Java has been somewhat outgunned by other technologies when it comes down to creating strictly the UI part of the web-app. Doing it in JS, with some of the new frameworks (like Angular) is a lot simpler (and more natural) than doing it with Java EE's Web UI technologies (JSP, JSF, etc). On the server-side of a web app, Java still holds strong. – Shivan Dragon Aug 03 '14 at 09:34
  • `String foo = "Hello"; String bar = "Hello"; System.out.println(foo == bar);`. *That* is why startups hate Java. – Wayne Werner Jan 23 '17 at 19:32

35 Answers35

174

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.

Neeme Praks
  • 101
  • 3
Chiron
  • 4,543
  • 3
  • 28
  • 37
  • 81
    [Play Framework](http://www.playframework.org/) is also like Ruby on Rails, but for Java. Code -> update your browser. – Jonas Aug 18 '11 at 16:15
  • 34
    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
  • 22
    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
  • 2
    Grails _is_ Java – Kyle Hayes Aug 23 '11 at 18:46
  • 4
    I did not know Twitter migrated to Java from Rails, that's interesting to know. – jhocking Aug 23 '11 at 19:21
  • 1
    @jhocking Twitter didn't migrate to Java entirely. They are adopting the JVM. http://www.infoq.com/articles/twitter-java-use – Chiron Aug 23 '11 at 22:20
  • 2
    @Kibbee: the problem is not necessarily the language, it's often the framework (particularly the ORM) that reduces performance. And, depending on the web server, it can be the way that you connect the module or interface to the web server's request pipeline as well (mod_python vs. uwsgi, for example). The inefficiencies are generally coming around the database and database interaction code for most companies, certainly not the web tier. However, at Facebook and Twitter's size, even slight web tier inefficiencies are worth thousands of dollars. Not so much for a startup. – Jordan Aug 25 '11 at 07:22
  • 28
    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
  • 1
    afair, Twitter is using Scala. It's JVM, but not Java, so the point is only halfway valid... – scrwtp Mar 25 '12 at 12:38
  • 3
    A big factor that many people who already know Java and Java EE neglect is the learning curve. It's monsterous. Some technologies like JAX-RS are easy to use once you "get" the stack, but there's a hell of a lot of stack to "get". Others, like JSF2, are killer learning brick walls from hell all by themselves, and badly documented too. See http://blog.ringerc.id.au/2010/08/im-not-smart-enough-to-use-java-ee.html and http://blog.ringerc.id.au/2010/08/java-ee-6-doesnt-just-work-in-even.html – Craig Ringer Jun 11 '12 at 01:16
  • @Jonas Not only is Java EE not the only option, but you can use just the good bits of Java EE 6 and avoid JSF2 and other problem areas. I'm loving Vaadin on JBoss AS 7 (an EE 6 server) with CDI, JAX-RS, and other JavaEE6 goodies. I sure hope you can use Play on an EE6 server the same way, 'cos I'm not going back to working without CDI. – Craig Ringer Jun 11 '12 at 01:18
  • 2
    @Jordan: `However, at Facebook and Twitter's size, even slight web tier inefficiencies are worth thousands of dollars` at the scale of Facebook and Twitter, thousands of dollars are worth a penny. – Lie Ryan Jun 11 '12 at 01:33
  • 2
    its pretty easy to get hot-deploy with Java and eclipse without using jrebel or similar http://stackoverflow.com/questions/998737/integrating-tomcat-and-eclipse-as-a-hot-deploy-environment – NimChimpsky Jun 12 '12 at 10:03
  • The development cycle is just like with a scripting language, you just have to turn one or two things on: http://techblog.bozho.net/?p=714 – Bozho Jun 12 '12 at 13:18
  • 5
    Java and any other static language, have two huge benefits, almost worry free refactoring, and API discovery without documentation. – Eran Medan Sep 05 '12 at 23:27
  • 3
    Those aren't benefits. Those are things you feel you need because you're working with a clumsy, verbose, inflexible behemoth of a language whose only real selling points are all the problems it solves that it created in the first place. Only good architecture leads to worry free refactoring and in my experience, Java can be but almost 99% ain't where that's at. Also static is not a prereq for auto-complete. I don't know why people keep insisting on that. – Erik Reppen Dec 07 '12 at 00:57
  • Hot deploy works with ide as long as you are not using something like maven. – Kemoda Oct 14 '13 at 08:37
  • 1
    >>Twitter for example was built using Rails/Ruby but once >>it became unscalable, they migrated to the JVM. What has scalability to do with language? It is the architecture that makes a platform / app scalable not the language. I am quite sure they would have switched to JVM for some other reasons. – DivKis01 Jul 22 '14 at 05:30
  • Actually the way ruby (matz) threads or rather doesn't is a language thing. Memory management in Python make it harder to scale, and PHP also suffers memory issues. These are baked into the language, yes there are ways to work around them, but then are you really using the language any more, or just the syntax. – baash05 Feb 21 '15 at 12:26
135

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.

FrustratedWithFormsDesigner
  • 46,105
  • 7
  • 126
  • 176
  • 5
    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
  • 7
    @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
  • I did not look at it from this perspective, this may be a good reason. – Jalayn Aug 18 '11 at 15:09
  • 3
    This is true for Java EE, but now there is [Play Framework](http://www.playframework.org/) that will make your Java web apps as lightweight and productive as Ruby on Rails. – Jonas Aug 18 '11 at 15:38
  • @Jonas: I didn't know about that one, thanks for the link! – FrustratedWithFormsDesigner Aug 18 '11 at 15:41
  • 9
    The new Java 6 EE - especially the web profile - allows for some pretty simple webapps. –  Aug 18 '11 at 17:00
  • Also C++ is usually faster if you really need the performance. Example would be Facebook: https://github.com/facebook/hiphop-php/wiki/ – Mike Soule Aug 18 '11 at 20:55
  • 4
    @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 01:19
  • @CraigRinger the basic reason that web frameworks are hard, is because HTML is so simple. Hence you need a lot of stuff on top of it for it to provide the desired abstractions like "conversation scope" or "AJAX callback" and that is hard in _any_ framework. –  Jun 11 '12 at 10:49
  • 2
    @ThorbjørnRavnAndersen Easy to lose sight of that, but yes, the stateless simplicity of HTTP+HTML+JavaScript makes building apps on top quite difficult. I'm sure not claiming I can do a better job! Truly the issue isn't the complexity of the frameworks, it's that in some frameworks most of that complexity is exposed to the user, and the documentation isn't good enough to let them get away with that. After all, OSes are complex, but the layering works well so a JavaScript dev doesn't need to understand kernel-level mutexes. It's all about *good* docs and *leaktight* abstraction. – Craig Ringer Jun 11 '12 at 13:05
134

I programmed java web apps for 10 years before I switched to python, 4+ years ago. I feel that I'm much more productive using python and can get much more done in a shorter period of time, and to be honest, I'm much happier when I develop in python. Here are some of the reasons why I think python is better then Java based on my personal experience, your milage may very.

Web Frameworks:

When I first start programming web apps in Java, Struts just came out, and it wasn't great, but it was the best thing available. I created a bunch of struts apps, and a few in other frameworks along the way. Whenever a new framework came out (Tapestry, Wicket, GWT, stripe, grails, AppFuse, Play, RichFaces, Spring, etc), I would try it out and see if it was any better, and most times it was only a little better, and sometimes not better at all. I do have to say the play framework is a step in the right direction.

Batteries not included:

One of the most annoying parts of Java was the fact that most of the libraries that you use were not included in java itself, you had to include a ton of 3rd party libs from places like apache commons. If you use something like hibernate with any other large library, you end up in Jar dependency hell, where hibernate needs one version of a jar, and something else needs another version. If you load the jar files in the wrong order, you are out of luck. You need to depend on tools like maven, and ivy to manage your dependencies, and this just brings in more dependencies into your project which results in projects being huge. I had some war files 100MB+ war files for the simplest web apps.

Too many options:

For some reason there seems to be way too many different ways to do the same thing in Java. There are over 38 different web frameworks for java according to wikipedia ( http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#Java ) and 23 different ORM's ( http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#Java ) just to name a couple of examples. If you look at other languages they have a more reasonable number. Some people think that having lots of options is a good thing, but it isn't it leads to a lot of wasted effort in the developer community, everyone is reinventing the same wheel, and if you are a new person to the language you have too many option to pick from.

App servers:

Java web applications are really heavy, and require a lot of resources to run. They are especially memory hungry. Like any piece of software they can be tuned to reduce their resource footprint, but compared to other languages their out of the box setup is horrible. In my past I have used weblogic, websphere, Jboss, tomcat, and jetty. I only used the first three when I was forced to use EJB's, but even if you aren't using EJB's they were large app servers and sometimes hard to configure and get running correctly. Tomcat and Jetty are much better and easier to setup, but are still resource hogs.

App Hosting:

If you aren't running your own server it is real hard to find shared hosting for your java apps at a reasonable price. The main reason is because java apps require much more memory compared to other languages, so it doesn't make sense for a shared hosting provider to spend their valuable RAM running a java site, when they could run 5 php sites in the same place. That means there are less providers offering java hosting, which in turn means higher costs to run your website.

Development Time:

When I developing in java, I found myself much slower then what I can do in python. I would need to make a change, compile, redeploy and then test, and this slows down the iterative process. I know there are ways to make this faster, but even at it's best, I felt much slower then what I can do in python.

There is also a lot less boilerplate code to do the same thing in python, so I spend less time developing the code as well.

Java just feels over engineered in a lot of parts, A lot of the API's and interfaces are just way to complicated for what you want to do. And everyone and their brother thinks they are a java architect and this results in big complicated systems that are hard to use and develop with.

IDE:

When I was developing in Java, I felt stuck to the IDE, I was lost without it. IntelliJ is the best IDE's on the market, and it was hard switching to python because there wasn't anything like it for python. So instead of an IDE, I just used textmate, which is just a normal text editor. It was hard at first, but because it was just a text editor, it was a really fast and responsive application. I could open my whole project in a few seconds, whereas when I want to open a project in an IDE it could take a minute or more, with a machine with a ton of RAM. The makers of IntelliJ came out with a python editor called pycharm, I bought it when it first came out, and it is great. But what I realized is that I don't need an IDE for python, I'm fine with a text editor. When I go back to working on Java web apps which I have to do from time to time, I try to use the text editor, but I haven't quite mastered that yet. I personally need the IDE for Java more because If I mess up something it takes longer to recompile and redeploy, which slows me down.

ORM:

When I first started using Hibernate as an ORM, I thought it was great, it had it's problems, and it wasn't perfect, but it was better then what I was doing before. I was happy with it, until I did an application with Django's ORM on a python project, and that opened up my eyes, that is how an ORM is supposed to work. After that project I went back to hibernate, and I just felt disappointed, and longed for going back to Django's ORM. Another great python ORM is sqlalchemy, which is similar to Django's ORM, but a little different. I have limited experience with ROR's ORM, but from what I remember, it was pretty good as well.

Templates:

The web templating systems in Java aren't that good, and I think I have tried them all (tiles, freemarker, velocity, etc). Most of them offer only basic functionality and are a pain to work with. On the Python side, my two favorites are Django templates and Jinja2, they have everything that I could need in a templating engine, and are really easy to use.

Ken Cochrane
  • 751
  • 3
  • 9
  • 12
  • 10
    I'm with you on many points, but take issue with some. *Compile/test loop*: Use Eclipse's dynamic web module, and/or JRebel, and it's gone; great. *Heavyness*: JBoss AS 7 is pretty light and fast. and if you don't want EE you can use Tomcat or Jetty which are barely even there. *Testing*: Arquillian is the best test tool I've used in ANY language, though it's only just become mature enough to be usable. *Dependency hell*: Just use Maven; it should be standard and mandated part of JAva. – Craig Ringer Jun 11 '12 at 01:29
  • Note that all of above adds to "batteries not included" problem, which is a huge one. Feels like Java EE is a sub-framework on which you're supposed to build your own framework to then build your app. Very inefficient. Every tool is also horribly buggy, and JSF2 is simply an instrument of developer productivity destruction. – Craig Ringer Jun 11 '12 at 01:30
  • 2
    I also think you missed a critical point: The [learning curve](http://blog.ringerc.id.au/2010/08/im-not-smart-enough-to-use-java-ee.html) and [bugs](http://blog.ringerc.id.au/2010/08/java-ee-6-doesnt-just-work-in-even.html#more) really slow things down. – Craig Ringer Jun 11 '12 at 01:31
  • @CraigRinger I haven't used eclipse's dynamic web module or JRebel, so you you are right, it might be gone. – Ken Cochrane Jun 11 '12 at 05:01
  • @CraigRinger As far as heavyness, it is heavy if you are comparing to nginx and guincorn, I agree it is better then it used to be, but compared to other languages it is heavy. I also never really liked maven, not sure why, it just felt over engineered compared to tools like ant. The fact that you need a tool like that to manage your dependencies is a red flag to me. Maybe it has gotten better since I last used it. But it is nice, that it is a viable workaround to the problem. – Ken Cochrane Jun 11 '12 at 05:08
  • @KenCochrane True, sure heavy compared to ngnix with a c fastcgi, but more capable too. I agree Maven shouldn't ideally be necessary - but I've never worked with any other language/env where I wouldn't have killed for an equivalent. When hacking on CMake or Automake/autoconf projects, Maven starts to seem really nice in comparison. In reality, in any big popular system that's powerful and capable, you're going to need something like it - maven, yum/apt, etc. It's imperfect, but the alternatives are worse. – Craig Ringer Jun 11 '12 at 13:13
  • @KenCochrane As for DWM and JRebel, they have their own issues, but are better than compile/redeploy cycles. I'll still take the "edit, reload" of a Python/perl/php/etc app ideally, but in the end the libs and features available for Java won me over. It's all trade-offs. – Craig Ringer Jun 11 '12 at 13:15
  • I would hate IDEs less if the code they tend to produce depended on them less to be navigable. It's like people lose all sense of coding instincts when the IDE covers for their own failure to consider basic principles. – Erik Reppen Mar 06 '13 at 17:49
  • the last point should be the first one; templating in java will be always worst than in any interpreted language. – gpilotino Jun 01 '13 at 22:41
  • @CraigRinger I tried recently. Can't get it to work with everything in this giant pile of convoluted interdependent mess that is Eclipse, Maven, Ant, Multiple versions of spring (yet they couldn't ever be bothered to update for Java itself as new versions were added) and legacy code from developers who I'm fairly certain must have been completely insane. This sort of thing has been my experience at every workplace where Java was in the mix. Four so far. I'm primarily a JS dev but I don't hate the language. It's what people do with it that makes me crazy. – Erik Reppen Jun 05 '13 at 17:35
  • @gpilotino not so many people use templating at all nowadays. – OZ_ Feb 22 '15 at 00:23
  • 2
    If you liked IntelliJ, try PyCharm – it's based on the same core. – Tamlyn Jul 08 '15 at 06:18
  • App Hosting was my main concern, which forced me to never learn J2EE. In-fact, I am glad, I didn't. – Rajat Saxena May 25 '16 at 06:55
94

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?

Adrian J. Moreno
  • 1,098
  • 6
  • 12
  • 23
    "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 08:58
  • 12
    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
  • 48
    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 07: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
  • 9
    **very-high-quality Java devs which are not easy to find** - Indeed. – luis.espinal Aug 03 '13 at 15:57
73

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.

sebastiangeiger
  • 1,907
  • 13
  • 15
  • I think this has changed, though, now you can host Java web apps on GAE at no cost. – Mahmoud Hossam Aug 18 '11 at 15:41
  • +1 for the hosting of Java. Although ASP.Net isn't hard to find and it is cheap. I pay $8 a month for my shared ASP.Net hosting. On the other hand, I've wanted to try to get a site up in Java and couldn't find a shared host that runs Java and having to use a VPS doesn't interest me for a learning project. – Jetti Aug 18 '11 at 15:42
  • 9
    +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
  • You are right @Mark, fixed. – sebastiangeiger Aug 18 '11 at 17:21
  • @Jetti: There's also another cost to ASP.NET though, and that is licensing of the tools. If you want a pro version of VS2010, you need to shell out some decent cash. Of course students, and anyone employed in the .NET sector likely have copies of VS2010 handed to them, and there's always the Express edition. – Robbie Aug 18 '11 at 17:27
  • @Robbie - Ya the MS licensing fees can be brutal. However, it is very easy to get a site up and going with free tools and, like I said, there is still cheap ASP.Net hosting available (not as cheap as linux, but still < $10 isn't bad at all). – Jetti Aug 18 '11 at 17:37
  • @Jetti, show me a windows host with the same features and limitations as your average LAMP host for anywhere near $10. Usually there are severe limits on the database usage size such as small storage limits or no database at all without extra money. – Kibbee Aug 19 '11 at 13:28
  • 1
    @Kibbee - [Arvixe](http://www.arvixe.com/) That is who I use. I have the [personalASP Pro plan.](http://www.arvixe.com/asp_net_web_hosting) – Jetti Aug 19 '11 at 13:45
  • @jetti, Thats pretty good pricing. All the recommended one's I've seen cost a lot more. I haven't hear of these guys. What's their reliability like? – Kibbee Aug 20 '11 at 00:00
  • @Kibbee - I know! I've had them for almost a year and haven't had a single issue with them. The were super helpful when I've had questions and have been overall wonderful. Given all that, I don't have a very high traffic site (~300 page views a month) so it isn't like I'm a drain on their resources. If you want to know more, feel free to email me (my email is on my profile) and we can talk. – Jetti Aug 20 '11 at 01:29
  • no longer true with openshift.com and other sites giving you free for small apps hosting on Java (three gears : 1 mirco instance of db, java and jenkens is how i use it!) – tgkprog Nov 18 '14 at 08:09
70

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 and Play), 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".

nafg
  • 109
  • 4
mikera
  • 20,617
  • 5
  • 75
  • 80
  • Vaadin is a great tool for creating intranet and big enterprise applications. It's not that well suited for a startup I guess. That is unless you embrace how it looks, because it's too hard to change it. – naugtur Jun 10 '12 at 09:13
  • 7
    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 01:22
  • 1
    You could add Tapestry5 (http://tapestry.apache.org/) to your list of modern Java web frameworks. – Neeme Praks Jun 12 '12 at 10:09
  • @CraigRinger JSF is easy. Your comment reads like the question itself: a religious rant – jwenting Jun 24 '15 at 11:09
  • @jwenting Well, it's been *three years*, so it's improved a little in terms of documentation and external tools since then. On the EE 6 stack when I was working with it it was frickin' horrible, moreso if supporting Glassfish 3 *and* AS 7. – Craig Ringer Jun 24 '15 at 11:10
41

Does Google, Amazon, or LinkedIn count as modern?

Java is used for modern web applications. If you look across the enterprise it is the most heavily used language for web applications (internal).

That said, Java went through a period were it's web development standards tried to be everything to everyone (arguably still do). "Don't repeat yourself" was a response to the xml hell and long build cycles of Java web development. As a result, Java (EJB, Struts, JSF, etc) became seen as the thing all of the new paradigms were trying to overcome.

Java, the language is verbose. That is a pro and a con (great for maintenance, sucks for dev). There are a number of modern language features that have not yet made it into Java that can cut coding time down substantially (properties, events, closures, generators, list comprehension, etc). So, it can be frustrating when coming from a more modern language. That said, they are difficult to add in to a mature language without becoming the rats nest that C# is becoming.

Many languages used in modern web development are dynamically typed. This enables tooling that can dynamically reload code as it is written (this is harder to accomplish in a static language - jrebel). Since web development lends itself to fast iterations, dynamic reloading is a huge win. It significantly reduces the development cycle on greenfield projects and makes it easier to get the UI and the UX right (trial and error by nature).

Static languages have their place, too. For backend logic that is complex, must run for years, must scale without issue, must be very fast, and must be completely error free, statically typed languages (like Java or even C) are preferred.

Additionally, as developer count/turnover grows and products mature the likelihood of well intentioned folks introducing bugs skyrockets. The rigor and discipline that a well designed Java project (interfaces, patterns, and holy water for those php vampires :)) enforces helps to reduce long term risk. While, this can also be achieved via unit testing, the safety net derived from static checking (and static analyzers like findbugs and clang) delivers a built in level of code coverage that is hard to replicate with handwritten tests. Don't get me wrong, there should be unit tests and functional tests, but real organizations never achieve 100% coverage. For what they check, static analyzers do.

So, in large projects (as defined more by team size than code size), where there is complex interoperation between independently developed chunks of code, languages like Java are still preferred. Examples include large/complex web applications like those at financial brokers (ameritrade), financial exchanges (nasdaq, nyse, maybe london after the .net failure), online banking (almost all of them), email (google), auction (ebay), etc.

From a performance and scale perspective, nothing tops the Java platform for it's combination of scalability and performance for web applications (depending on how you count facebook's application partitioning). Twitter, for example, had to rewrite large portions of it's Ruby infrastructure in Scala on the Java VM in order to put the fail whale back out to sea. I've heard of other large examples, but they elude me right now.

It’s also worth considering security. While Java browser plugins have suffered their fair share of security vulnerabilities, the java platform itself is one of the more secure platforms created. Java web applications have a reputation of being very secure. It’s coding practices, libraries, and architecture have long discouraged mistakes that make attacks like sql injection or buffer overflows possible. While other web platforms(rails) have a good security reputation, none surpass Java.

Bottom line, most web applications are simple technically. For simple, Java is often overkill (just like in the old days when we wrote them in C :)). If, though, the webapp is complex (backend or otherwise) or is expected to have 100+ developers, Java is hard to beat.

--

On a personal note, I use Grails a lot because it gives me the best of both worlds (the same can be said of JRuby which I hear is becoming more and more popular in the Ruby world).

BTW - I find the rise of PHP to be truly baffling. PHP as a language is the rough equivalent to perl in readability and VB in the quality of the results. It encourages horrible practices, is next to impossible to maintain, 3rd party libraries rarely work as expected, and it has a syntax that would drive Larry Wall up...well...a wall. The only explanation I can conjure is that it lends itself to incremental learning (like VB). In other words, you can accomplish something useful knowing very little about programming/administration and you can extend your knowledge a small chunk at a time. There is a lot to be said for that from an adoption perspective. However, for anyone that has every had to support or replace one of the billions of VB apps that were written by "programmers" in the corporate/mfg world, you are probably shaking your head and planning your retirement. :)

user56365
  • 1
  • 2
  • 2
  • 3
    Care to elaborate on the "the rats nest that C# is becoming" point? – XåpplI'-I0llwlg'I - Jun 02 '13 at 04:35
  • 1
    I'm not quite sure why you say '"Don't repeat yourself" was a response to the xml hell and long build cycles of Java web development.' DRY emerged as a concept in the Agile community, most of whom were using languages other than Java at the time. – Jules Feb 20 '14 at 00:29
38

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.

Robbie
  • 199
  • 2
  • 7
  • 24
    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](http://www.playframework.org/) 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 02 '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. – asthasr Mar 25 '12 at 12:45
  • If you're into Rails but need Java, look at Seam Forge. Beware, it uses JSF2, which is horriying to work with, but Forge its self is pretty good. – Craig Ringer Jun 11 '12 at 01:21
  • you can build CRUD apps in Java using Roo in minutes, same thing with Grails (not exactly Java, but still JVM) Play 1.0 had generators / scaffolding, I wonder where it went though... – Eran Medan Sep 05 '12 at 23:32
  • Java does nothing to protect you from crap architecture any more than a dynamic language is more likely to lead to tight coupling. That's absurd. – Erik Reppen Dec 07 '12 at 01:03
24

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.

Daniel Iankov
  • 742
  • 4
  • 9
  • 12
    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
  • 4
    @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 02:19
  • @alex - how about a 1-line property declaration, anonymous functions/lambdas, etc, etc? They're all achievable (Runnable interface anyone?) but they require an awful lot of typing to solve what should be a non-problem. Why would I want to waste my precious time writing various helper and util classes when other languages come with them _built in_! Not to mention that absolute hack that is generics support which results in some real funkiness with reflection – Basic Mar 06 '13 at 17:19
  • @Basic : I mentioned explicitly lambdas/functions as the main missing thing, yea. Properties are really not a big deal. In many, many years using generics, I've never had a single problem (bar excessive verbose initialization syntax), and really if you're not writing a framework or generic library, you rarely use generics in most stuff... – alex Mar 07 '13 at 22:25
  • @LieRyan : builtin first-class maps/lists is another thing I really miss (although I can live with that). DSLs are a fad and not that useful. And if you really need a DSL, embed JRuby, Jython, whatever... – alex Mar 07 '13 at 22:27
  • 4
    @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` with an `IQueryable Where(Expression 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 07 '13 at 22:31
  • I'd still like to see more common things like a decent HttpClient, JSON Serializer, etc... as part of the framework. Then there's some guarantee it will function as desired and that edge cases have at least been considered. I've come across so many promising libraries in Java only to find out that they're broken in some way, or that the only documentation available is for 3 years old and written before the major rewrite. – Basic Mar 07 '13 at 22:34
  • @alex: I believe you're a textbook example of the [Blub Paradox](http://www.paulgraham.com/avg.html). – Lie Ryan Mar 08 '13 at 08:56
  • @LieRyan whoa. Another Paul Graham fan. I can't even enumerate the fallacies on that post. Foremost, Lisp is no silver bullet, because there are no silver bullets- Viaweb success had probably more to do with having extraordinary programmers- a group of accomplished Lisp hackers can do wonders even programming in assembler. OTOH, I've written my fair share of Lisp, and I write quite a bit of Haskell for fun (Project Euler, mostly)- I've done Python, Java, SQL professionally and my favourite languages are sh, Prolog and ML/Haskells. But Java is pretty much the best option for large apps... – alex Mar 09 '13 at 13:28
  • 3
    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
  • @Brandon upgrade to the latest release. They've recently killed a very nasty race condition bug that led to the data for what files need deploying becoming corrupted frequently on machines with certain performance profiles, which explains why it has always worked flawlessly for some people but the rest of us have struggled. It now works reliably for me with no maintenance hassle, despite the fact that a year ago I was doing exactly what you describe. – Jules Feb 20 '14 at 00:14
  • "It got the revolutionary ability to use string in a switch statement just yesterday." - indeed! Still waiting for properties as in C#... – Andrei Rînea Aug 12 '16 at 20:55
  • @Basic Unfortunately, compared to languages like C# or C++, generics in Java have a rather deep-seated flaw that can't be fixed without what would most likely be a major breaking change. Specifically... Java generics are syntactic sugar for typecasting, and type erasure makes it impossible to determine the actual parameterised type. At runtime, both `ArrayList` and `ArrayList` are actually `ArrayList`. It looks like things are planned to change in Java 10, though. – Justin Time - Reinstate Monica Jan 08 '17 at 04:11
  • 1
    @JustinTime Unfortunately, the lack of reified generics in Java has been one of my gripes for over a decade. It's one of many reasons I'll use a different language if it's an option. – Basic Jan 08 '17 at 13:03
18

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.

DaNmarner
  • 101
  • 4
arunmur
  • 411
  • 2
  • 8
  • (2) is addressed wonderfully by JBoss Arquillian (http://arquillian.org/). Lots of the rest is more a JSF2 issue than a Java issue. Biggest issues IMO are learning curve and immense bugginess of the frameworks, but if you avoid JSF2 you can do well. – Craig Ringer Jun 11 '12 at 01:23
  • 5
    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 07 '12 at 01:13
  • 2
    *"People don't think Google when they think Java."*... I do certainly think about Android and their Dalvik VM (which is a Java VM) when I think about Google. I also think about cool stuff like GWT (automated generation of JavaScript from Java). If there's one company that is "high" on Java, it's Google. Much more than Apple or Microsoft. Granted, Oracle and IBM are even more associated to Java than Google but still: billions of Android devices running Java apps on a Java VM is something kinda hard to think of without establishing a very strong Google / Java link. – Cedric Martin Mar 15 '13 at 23:28
  • A lot of hatred towards JSF2 form @CraigRinger in these comments. :-) What is it about it that irks you? I found it complex to start with, but once I got going, I *love* it. Of course, I was using Spring before that, so anything else is going to look like an improvement... :-) – Brian Knoblauch May 20 '13 at 13:37
  • @ErikReppen At this moment I cannot appreciate this belief enough. When you dont do OOP you tend to do object-aware code which just ends up being another mess. But this is probably not appreciated much yet. – arunmur Jun 05 '13 at 12:00
  • I must preface this by saying I really don't know much about OOP methods, but it's infectious now. Frontend JS frameworks love that ideal. –  Oct 27 '15 at 21:14
  • 1
    I am an OOP Developer in Java and I can't overstate the benefits of OOP for developers. Yes, it does take a little bit more time while developing, but the lower bug rate, readable & easier to maintain code is well worth it. Not to mention that unit testing becomes way easier with properly done OOP. – IntelliData Aug 31 '16 at 16:59
14

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.

Jessica Brown
  • 424
  • 3
  • 9
  • +1 for framework overkill. Its getting insane, spring j2ee maven ant hibernate, you spend all your time writing xml config. – Richard Aug 18 '11 at 22:27
  • 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 04:19
  • It's not just the frameworks. It's the obscene levels of conformity to things that make no sense. Exposing a lot of properties means you're doing it wrong. Slapping a vanilla getter and setter on that just adds a pointless method call and changes nothing, yet no Java dev will over just dangle properties off an object like that, because the community reinforces that that's somehow more wrong than what they're already doing. But seriously, the XML instead of code thing... how did that last longer than 5 minutes? – Erik Reppen Jun 12 '13 at 19:56
14

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.

Michael Brown
  • 21,684
  • 3
  • 46
  • 83
  • I think this is a really good point +1 – sfrj Sep 24 '11 at 17:00
  • 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 02 '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. – Michael Brown Feb 02 '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](http://developers.slashdot.org/story/04/08/12/1721239/the-python-paradox-by-paul-graham) – user16764 Jun 10 '12 at 13:00
14

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.

Cyrus
  • 1
  • 2
  • 3
    I'll take more choices and a little more complexity over PHP's over 9000 built-in methods. – Kaleb Brasee Aug 19 '11 at 02:54
  • 1
    PHP is just so easy to setup. – Barfieldmv Aug 19 '11 at 11:22
  • 9
    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
  • Unless they both stink but one is much more of a PITA to set up than the other. – Erik Reppen Dec 07 '12 at 01:33
12

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.

Daniel Pryden
  • 3,268
  • 1
  • 21
  • 21
  • 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 04: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 05:49
  • There are no performance problems with Java itself "not quite as fast as C but faster than anything else". However J2EE, plus frameworks, plus ORM, plus dependency injection, plus overkill design is almost guaranteed not to perform; there is so just too much potential for hidden bottlenecks and unforeseen interactions – James Anderson Aug 19 '11 at 06:36
  • Since I'm studying Java right now I'd really like to see some studies or developer blogs that show hard numbers for these guaranteed poor performances from Java installations. – Patrick Hughes Aug 19 '11 at 07:57
  • @James: it sounds like what you are saying is: overengineered and/or poorly designed applications have performance problems. That's not specific to Java! Certainly, there are badly-written Java apps out there, but there are also well-written Java apps as well. The same can be said of any language. – Daniel Pryden Aug 19 '11 at 15:48
  • @Daniel. Yes! But over complex, over engineered solutions seem to be the norm in J2EE environments. Indeed when you listen to the Java crowds complaints about php coding most of the whining is really about php being too "simple", they are so used to complexity that they think its a good thing. – James Anderson Aug 22 '11 at 01:38
  • @James: I've never heard a Java programmer complain that PHP is "too simple". I've heard lots of other complaints about PHP, but simplicity isn't one of them. And to make this point perfectly clear (since this seems to be a misunderstanding a lot of people here have): **Java web apps != J2EE**. Even in Java circles, "J2EE" is dead, replaced with "JEE" -- Java 6 EE is **very** different from Java 2 EE. And many excellent Java web apps eschew Java EE entirely, instead using Java SE and a simple servlet container or other web server. – Daniel Pryden Aug 22 '11 at 18:17
  • What sort of web applications are you writing where the database transactions are not by 1 or 2 orders of magnitude less performant than the web tier? Web apps generally don't do hardly any real work other than displaying data. At best you might be doing a little computing by delivering some graphs or connecting to an API. In short, the front-end language is almost irrelevant to performance. Sometimes the implementation and integration with the web server performs slowly, such as in the case of mod_php (or really mod_*), but that's another problem entirely. – Jordan Aug 25 '11 at 07:34
  • @Jordan: Well, **some** web apps don't do any work other than displaying data -- and for those apps PHP or another lightweight front-end technology is a fine choice. I mostly work on scientific applications with low transaction counts but very algorithm-heavy processing and display. When you're doing things like spatial data rendering, multidimensional data, on-demand simulations, coordinate system transforms, etc., then some of that has to be loaded in the web tier. The real heavy lifting is in the application tier -- the database tier, by contrast, doesn't have that much of a load. – Daniel Pryden Aug 25 '11 at 17:44
  • @Daniel: certainly an unusual case for your workplace. I wouldn't classify what you do as a common case. I've worked with hundreds of companies, and except for I think 4, all were doing relatively tame stuff with the web and app tiers, mostly along the lines of forms, charts, easymode business logic, and sometimes some text parsing and lexers. Any jobs available at your place for writing those algorithms? :) – Jordan Aug 26 '11 at 05:09
  • @DanielPryden `Even in Java circles, "J2EE" is dead, replaced with "JEE" -- Java 6 EE is very different from Java 2 EE`... That's kinda the point. Should you really need to wade through all these broken, deprecated frameworks to find out what's usable now? What an absolute mess - and then you spend a month writing something only to find out there's a bug which means nobody uses _that_ anymore - use this non-compatible one instead. It fixes the bug but it's got different issues. As to saying bad code = bad performance. Very true, but do you want to rewrite hibernate every new project? – Basic Mar 06 '13 at 17:27
  • 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 06 '13 at 22:00
  • @DanielPryden I was explaining why some (myself included) find Java to be a serious step backwards. – Basic Mar 06 '13 at 22:06
  • 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 06 '13 at 22:11
12
  1. Java is more complex to learn than PHP/Python/Ruby
  2. Java ecosystem is very complex, very large and quite confusing to beginners
  3. There are many historically bad frameworks with negative reputations associated with java, you have to know which frameworks to avoid wasting time on
  4. Java build tools are way to complex (maven & ant)
  5. Java does not have a module systems that is easy to use (OSGI is way too complex)
  6. Java IDE such as Eclipse while very powerful with amazing features are difficult to configure for effective web development without lots of experience.
  7. If you are using anything other than Tomcat or Jetty as a server then you will be frustrated by long startup times of WebSphere/WebLogic/JBOSS
  8. Java EE solves problems that many people don't have such as distributed transactions

A new developer getting into professional development will find Java an Order of Magnitude harder than rails, python, or php to get going with so they go with what is easy to learn.

Having said all the above, I made the decision to use Java for my Startup because a properly configured Java Development environment is very productive to work in. By properly configured I mean.

  1. Less than 10 seconds start-up time
  2. Properly configured eclipse workspace, with a all frameworks wrangled up and configured
  3. Good selection of libraries (Spring, Spring MVC, Spring Social, Spring Security, JPA, Hibernate, Velocity, .... etc)
  4. Fast developer machines with SSDs
  5. Orielly Safari subscription
ams
  • 161
  • 1
  • 6
  • 8
    Let's be clear though. The language Java, is not hard to learn. It's all the layers of crap built around working with Java to make up for its shortcomings (verbosity, protecting you from yourself and your teammates by being inflexible as all getout, the absurd quantity of libraries relied upon, etc...) that's a PITA to learn. – Erik Reppen Dec 07 '12 at 01:24
  • 2
    @ErikReppen Very true. I am having to work on a Java project but have a background in .Net. The language and syntax is easy as anything I've come across to understand. It's the verbosity that's really driving me nuts. What I used to in 1 line now takes 5-10 and (often) an XML config file edit. Not to mention that without spending hours upon hours reading, picking the "right" framework for a job is a nightmare - and that's before you find out that your scenario is considered an edge case, isn't supported and if you don't like it, rewrite it. I want to spend my time solving the _big_ problems – Basic Mar 06 '13 at 17:41
  • "Java is more complex" - can anyone ever remember the parameter orders for PHP's `strpos` or `in_array`? And PHP's XML DOM interface is ridiculous (cast attributes to strings to retrieve them?). OSGi is absolutely brilliant and language-independent. – jevon May 12 '13 at 04:23
  • @jevon: The PHP docs are very good and my IDE is eager to remind me anyway. Also, SimpleXML. – DanMan Dec 12 '13 at 00:02
12

About 5 yrs back, me and a colleague were given a programming task for some internal project. A simple enough task which required command parsing.

I came up with the entire thing in about 80 lines of java code and my colleague took a week, about 20 java classes and much more lines of java code to do the same. Needless to say, his code was picked.

This made me wonder. Everywhere, complexity was appreciated. ( I was working in one of the biggest software products company. ) Java was the tool of choice and design patterns were THE way to code.

Now, is it the mindset or just arrogance that rejects simplicity. Well, I always thought common sense should prevail. Whether it is an enterprise or a simple web application, the basic use cases are the same. It should be correct and verifiable.

I don't use java anymore for several reasons. But one of the factors - complexity, is the prevailing mindset in a ton of java devs when it comes to developing software.

As for scaling dynamic languages, JVM is the result of decades of research. There is a lot of the same happening for Ruby etc.

Scala is one language which I find is extremely clever and practical. Play! with Scala is just as excellent for web/enterprise application development as any out there.

As for Ruby and Rails being the shiny new thing for start-ups, it is extremely difficult to hire a solid Rails developer. It is actually an impediment to any start-up whereas the plethora of java devs should make more business sense.

Ar Wen
  • 1
  • 1
  • 2
  • I'm not a java fan but that "complexity" you refer to may well have been abstraction. Abstraction is very useful both for testing and maintainability (when used in moderation). Hard to say for sure without being able to compare the code – Basic Jan 08 '17 at 13:22
11

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.

C R
  • 101
  • 4
Greg Guida
  • 737
  • 1
  • 6
  • 11
  • 4
    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 07 '12 at 01:17
  • Quoting a person may only provide his views and his choices but does not validate that whatever he/she chose is/was the right decision. – DivKis01 Jul 22 '14 at 05:46
9

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.

LocoTx
  • 21
  • 1
  • 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. –  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
  • 5
    @Kibbee ... or it gives Javascript a bad name :) – Matthew Schinckel Jun 10 '12 at 12:36
9

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.

cromwellian
  • 1
  • 1
  • 1
  • 1
    Where's your source stating that startups don't use Java? Please backup up your assumption with some facts. – Walter Oct 20 '12 at 16:20
7

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.

Brian
  • 251
  • 1
  • 11
  • 3
    You should have a look on [Play Framework](http://www.playframework.org/) 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. –  Aug 18 '11 at 17:01
  • @Jonas what Thorbjorn said! I'd give it a thorough read. :) – Brian Aug 18 '11 at 17:16
  • @Thorbjørn: I don't have a blog. In short: With Play Framework you just save your Java source code, and then update the web-browser. The code is automatically compiled server-side using the Eclipse compiler. JPA is used for database access. Here is an article about it [Play! Framework Usability](http://java.dzone.com/articles/play-framework-usability) – Jonas Aug 18 '11 at 17:36
  • @Thorbjørn: Here is another blog post by the creator of Play: [Why there is no servlets in Play](http://iam.guillaume.bort.fr/post/558830013/why-there-is-no-servlets-in-play) – Jonas Aug 18 '11 at 17:41
  • @Jonas, you can get a blog at http://www.blogger.com/ - do not advocate in comments. –  Aug 18 '11 at 17:54
  • 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 06:52
  • If you want to access the db using SQL, check out Spring's JDBC support, it reduces boilerplate to a minimum. – alex Dec 14 '11 at 22:54
  • @Jonas IMO the Scala tooling and integration is still WAY too immature for solid productivity. When I tried Play! I hit bugs and limitations more quickly than in anything except JSF2. Vaadin is a good alternative. – Craig Ringer Jun 11 '12 at 01:24
  • So I can install a framework in like 5-minutes running with a language that's concise and actually much easier to write maintainable code in because you don't have to step back 10,000 feet to actually see everything that's going on and it's you and the other guy and not two dozen teammates or I can add yet another layer to Java, it's IDEs and legion of libraries to make it more like my first choice? Do I still get to do tons of XML-config? – Erik Reppen Dec 07 '12 at 01:28
7

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.

6

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.

cdkMoose
  • 1,775
  • 9
  • 12
6

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.

Paul
  • 113
  • 6
5

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.

David Semeria
  • 101
  • 1
  • 1
5

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.

Khelben
  • 1,339
  • 1
  • 8
  • 8
5

This is true, but not because of Java and its ecosystem. It's because of people that, when using Java tend to create big messes and heavy abominations.

There are enough frameworks (spring-mvc, grails, play, etc.) that allow you to build things fast. The fact that people overengineer their systems is a problem that comes with the increased knowledge people get when they work with the Java ecosystem - you know many more thing, and you have them available (there are tools for everything), and "everything looks like a nail".

If you are "hacky", you can do pretty much the same with Java as with other languages, and here's a study indicating that:

Study of 49 programmers: static type system had no effect on development time... http://www.cs.washington.edu/education/courses/cse590n/10au/hanenberg-oopsla2010.pdf

Bozho
  • 2,665
  • 3
  • 17
  • 12
3

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.

Matt Ryan
  • 411
  • 3
  • 5
  • The learning curve is absolutely vertical. You'll spend the first few WEEKS just figuring out what the acronyms are, how the standards relate to their implementations, how everything is layered, etc. Then the next few weeks figuring out which stew of libraries and frameworks to use. Then the next few weeks reporting bugs in them... – Craig Ringer Jun 11 '12 at 01:33
3

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.

Martin Spa
  • 101
  • 2
3

Many might associate Java and web application development with the horrors of J2EE which, bundled with monstrous J2EE application servers from big blue and red corporations, equaled weeks of work before the basic "Hello World" was online.

True, recent JEE specifications and implementations are lighter weight, but I'd still think thrice before suggesting anything like this for a short cycle rapid development project.

This is still the standards-based way of doing web application development in Java. The alternatives, many of which are mentioned in other answers, convey a more mixed and confusing picture with too many choices to make.

Other languages portray a single turnkey solution instead of this multitude. This makes this choice seem more fit-for-purpose when you have more important fish to fry.

  • Java EE 6 might be "light weight" (except for JSF2) but it's still an incredibly huge learning curve, a giant stack of complicated specifications, and an immensely complicated layered system. Lightweight maybe, but sure not simple. – Craig Ringer Jun 11 '12 at 01:35
2

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

Wyatt Barnett
  • 20,685
  • 50
  • 69
2

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.

Martijn Pieters
  • 14,499
  • 10
  • 57
  • 58
  • `Developers of back end must have the knowledge of application architecture from ORM to Application framework to presentation layer` basically means that the framework has failed to do its primary objective. – Lie Ryan Jun 11 '12 at 02:23
1

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.

1

If by "modern" you mean popular (as-in getting most press coverage) then the reason Java is not used is very simple -- because all the "cool kids" are using Ruby (or Python, or Clojure, or Scala, or whatever is "cool" these days).

There is a deeper meaning to this, these same people who use Ruby or Python to write their "modern" web applications are usually really great innovators. People who love solving annoying problems in simple and effective ways while saving time and brain power doing it. Some might say these are qualities of good programmers.

These people usually also create the most press around their projects, which large companies rarely do. Be it by doing lots of open-source, or writing blogs, or whatever.

So the gravitational pull of these people into the world of dynamic languages, where they are offered simpler/smaller/faster/leaner ways to solve problems is easy to understand. Sadly it means that the same people who were great Java developers, mature and abandon the Java bandwagon because it is annoying and hard (for them) to use and solve these same problems.

If creating a simple web application with MVC framework X, requires to write/edit just 100 lines of code in Rails/Django, and contrary to that it requires 10,000 lines of code in Java to do the same thing - it is very apparent why that might seem annoying.

Regarding your statement "I haven't seen anything critical "missing" from Java, preventing me from building the same application." The question is -- if you had the same amount of experience in Rails/Django/Whatever... how would these two applications Java and non-Java compare to each other, measuring time and effort and any other metrics you can come up with.

Evgeny
  • 124
  • 3
1

I'm using a lot of Java, for creating web applications. So, when it comes to the *language itsel*f, I find only one (but big) issue - lack of multiline support. This makes printing/templating in pure Java code very unreadable.

But the real problem is the lack of good web frameworks. I've worked with a lot of solutions, and none of them I could name good or even satisfying.

Most of them are in fact XML programming. In JSF you produce tons of XML, and if you want to change some general feature, like rearange labels to the top of the text fields, you'll end up in doing the same change in multiple places. Yes, you have includes, but compare them with the includes from PHP...

Additionally, new JSF includes "extra" features which were known to the JavaScript frameworks years before...

ZK is a bit better because it allows creating the web elements in the Java code, which makes the modifications easier (if you use OOP properly - inheritation etc.). However, this Java code is executed on the server side, which is a great performance issue - every click will cause a package to be sent to the server.

Well, GWT is the best web framework I've worked with. It allows object programming in the web design. Every element on the screen is represented by the Java object, which gives you full flexibility but... The compilation time is very long, and the generated Javascript is far from optimal, simply because GWT isn't utilizing fully the JavaScript possibilities (no support for the reflection, at least in the version I was using, and fatal implementation of HashMap).

You can use templates, such as Velocity, but as above, they are a poor-man's version of the templating possibilities given by such languages as PHP.

So, it's not a hate towards Java, but the lack of support for writing web apps that one will get when using PHP, Python etc...

0

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.

johanvdw
  • 139
  • 4