Live data from Hacker News

Why isn't Java used for modern web application development?

programmers.stackexchange.com

31–40 of 188 posts

Re: Why isn't Java used for modern web application development?

#31
post #16

Part of the answer is Java itself. It's verbose, static typed, and requires a lot of boilerplate code to do properly. The fact that classes are a compile-time concern, rather than a runtime concern, is just such a drag. You end up with interfaces you don't really need, only so that you can inject them into constructors so that your app is properly decoupled and testable. Part of it is a framework issue. Struts is hor…

So basically, it's due to lazy programmers who moan if they have to type or think too hard.

Also very very much fashion lead by hipsters who must be using the newest coolest untested thing on the planet.

Re: Why isn't Java used for modern web application development?

#32
imho, Java is a great tool when it is deployed for its original goal: Platform independent GUI clients. Unfortunate its now mainly used on the server side, where it fits badly.

The main reason I'm not using Java on server side is memory footprint. A typical Lighttpd, fastcgi, Rails, MySQL stack runs well within 256mb of memory on a Xen instance. A typical Apache, Tomcat, JBoss, Hybernate, Spring, Oracle stack requires 4GB or more on a root server.

I think most startup coders shy Java, because they know it mainly by maintaining enterprise dead horses and bloatware.

See: Tate, Bitter Java, ISBN: 193011043X

Re: Why isn't Java used for modern web application development?

#33
I've been hacking Rails since 2004, and I've made the switch to Java (dropwizard+mustache) for basic web development this year (sometimes with a meteor-like micro-framework I rolled myself).

Benefits:

- Higher quality code. Java is easier to refactor than Ruby, which makes up for the lower language power.

- Performance!

- Actual concurrency!

- Faster server spinup and incremental changes. Rails with 20 gems in development mode is super sluggish.

- Better library ecosystem!

- Better dependency management system (maven > rubygems)

- Better debuggers

- Better profilers

- Easier deployment and ops environment(java -jar myjar, vs bundle install, ruby/passenger/unicorns)

- Reasonable in-process metrics

Re: Why isn't Java used for modern web application development?

#34
post #16

Part of the answer is Java itself. It's verbose, static typed, and requires a lot of boilerplate code to do properly. The fact that classes are a compile-time concern, rather than a runtime concern, is just such a drag. You end up with interfaces you don't really need, only so that you can inject them into constructors so that your app is properly decoupled and testable. Part of it is a framework issue. Struts is hor…

So basically, it's due to lazy programmers who moan if they have to type or think too hard. Also very very much fashion lead by hipsters who must be using the newest coolest untested thing on the planet.

I think there is a more fundamental reason. Java, being a compiled language that has traditionally aimed at compile once, run anywhere, offers a significant overhead, but with a development speed of a compiled language. It may or may not be faster to write code in Java vs C++, but it's certainly way faster to write code in Perl, Python, or Ruby.

I have always felt that Java was ill-suited to web applications generally, and that the main advantage of using it for web apps was being able to make use of third party libraries written in it. In this regard it's kind of like "why would you write your web app using DCOM on Windows?" Well, maybe because you are recycling VB logic from desktop apps?

Re: Why isn't Java used for modern web application development?

#35
Java is a language that is in a weird space.

It doesn't compile to binary like C/C++ and it isn't high-level and interpreted like a Ruby or Python.

It's a weird middle-times language. It originally appeared in 1995 and is somewhat pioneering in the web space. But it isn't as clean as C# since C# appeared in 2001 and was able to learn from the mistakes of Java. It's definitely not as clean as Go which appeared in about 2009 and was able to learn from the mistakes of C, C++, Java, and C#.

The framework choice is probably more important than the language choice.

There is a fragmentation of frameworks. Starting a greenfield project with Spring, Struts, Stripe, WebObjects, etc would probably be a bad choice. Play is probably a reasonable choice.

But this is not an issue with Ruby or Python. You're probably going to pick Rails or Sinatra as your choice if you go with Ruby. You're probably going to go with Django if you go with Python.

Tyranny of choice is a problem with Java frameworks.

Re: Why isn't Java used for modern web application development?

#37
post #16

Part of the answer is Java itself. It's verbose, static typed, and requires a lot of boilerplate code to do properly. The fact that classes are a compile-time concern, rather than a runtime concern, is just such a drag. You end up with interfaces you don't really need, only so that you can inject them into constructors so that your app is properly decoupled and testable. Part of it is a framework issue. Struts is hor…

why does a language designed around an OOP perspective need a lambda (which comes from a functional programming perspective)?

Re: Why isn't Java used for modern web application development?

#38
post #27

Earlier quoted context omitted.

I think you need to reconsider your views regarding play. Version 2.0 has been a major improvement regarding a lot of issues. Asynchronous Requests are inbuilt as well as Websockets. (And Json serialization is as easy as Json.toJson()) I agree that static controllers are not always ideal considering that Java does not support inheritance of static methods, but the arguments of why static controllers are chosen can be…

I did look at 2.0 when it came out, and I'm under the impression that you still need to write a custom binder. Just now I tried to look it up, but the documentation points to: http://www.playframework.org/documentation/2.0/JavaJson which is a 404. I also don't see a nice way to respond with the appropriate format based on the accept-header...not that you can't write that yourself.

How did you get that link? Here is what I get when I browse documentation.

http://www.playframework.org/documentation/2.0.1/JavaJsonReq...

Re: Why isn't Java used for modern web application development?

#39
post #16

Part of the answer is Java itself. It's verbose, static typed, and requires a lot of boilerplate code to do properly. The fact that classes are a compile-time concern, rather than a runtime concern, is just such a drag. You end up with interfaces you don't really need, only so that you can inject them into constructors so that your app is properly decoupled and testable. Part of it is a framework issue. Struts is hor…

So basically, it's due to lazy programmers who moan if they have to type or think too hard. Also very very much fashion lead by hipsters who must be using the newest coolest untested thing on the planet.

    Laziness, Impatience and Hubris
There's no advantage to the need to over-architect. It's purely a bi-product of Java (or static languages in general). Because you can figure out how to properly write a Java program doesn't make you clever, sorry.

C/C++ programmers moaned about Java and garbage collectors the same way Java programmers are moaning about dynamic language.

Re: Why isn't Java used for modern web application development?

#40
post #35

Java is a language that is in a weird space. It doesn't compile to binary like C/C++ and it isn't high-level and interpreted like a Ruby or Python. It's a weird middle-times language. It originally appeared in 1995 and is somewhat pioneering in the web space. But it isn't as clean as C# since C# appeared in 2001 and was able to learn from the mistakes of Java. It's definitely not as clean as Go which appeared in abou…

Can you explain why you favor Play instead of any other Java framework?
Post reply on HN