Live data from Hacker News

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

programmers.stackexchange.com

131–140 of 188 posts

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

#131
I think that Java still has a strong role for writing REST web services and heavy lifting back end stuff because of the robustness of the JVM and lots of great tools and frameworks.

That said, most of the web services I have written this year are in Ruby (with some Python in the last few weeks).

For web app front ends I really prefer lighter weight tools like Rails.

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

#132

Earlier quoted context omitted.

You're criticizing Java for being slow, and then presenting Ruby as an alternative. You do realise that Java is up to 100 times faster than Ruby: http://shootout.alioth.debian.org/u32/benchmark.php?test=all... . And on multicore systems Java up to 300x faster than Ruby: http://shootout.alioth.debian.org/u64q/benchmark.php?test=al... ...alternatively combine the performance of Java with a highly expressive language e.…

yes, but if you noticed I'm comparing Java to C in terms of program language speed. I'm comparing Java to Ruby in development speed NOT language speed, I thought this was obvious... sorry, If I wasn't clear enough above.

You were clear, but if you're going to compare languages you can't cherry pick which features to compare. You compared Java to C performance and then Java to Ruby in terms of expressiveness. Since Ruby does not have the performance of C and C does not have the expressiveness of Ruby it's not really a fair comparison to Java.

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

#133
post #66

Earlier quoted context omitted.

"Saner templates: You have ${emails.unread ?: 'no'} ${emails.unread?.pluralize('email')} !" At the cost of throwing internationalisation out of the window. At least the example you led with is more conducive to localisation.

> At the cost of throwing internationalisation out of the window. At least the example you led with is more conducive to localisation. Right. i18n is the reason you have to import two taglibs and the template doesn't support basic conditionals. /s JSP is horrendous. There is not a single reason for its existence, and it should be quarantined. As far as i18n/l10n goes, the example I quoted was from play framework. Thi…

The choice is less clear obvious when you've started to ask why use server-side templating at all? I've spent quite a bit of time on both Rails and Java webapps. The conclusion I've come to is I'd really rather the server just returned JSON and rendering happened client-side. I'm not working on Twitter-scale stuff, though.

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

#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…

I think all of this was true 4 years ago. But Java EE 6 has changed a lot of this. My main experience has been on the Microsoft stack, but I have learned and worked with a lot of tech, including Rails and Django. Last year I worked on a project for which we chose Java EE 6. There's a lot of good stuff there; for instance simple, bloat-free architecture, JPA (the new persistence architecture), CDI (context and depende…

For what it is worth, I have used Java 7, JPA (with hibernate), tomcat 7 and glassfish, and I didn't notice much difference. Jersey (JAX-RS) is pretty nice, one of the better libraries to come out of Java in a while.

I do agree that Java is moving in the right direction, but it is a very slow progression. I think the major cause of the slowness is because of the fact that SUN was bought by Oracle, and it took a little while for that to settle down, and now things are slowly moving forward again.

One of the things that Java did right was their WAR files. It is the envy of most other programming languages. You compile your WAR file, and deploy anywhere assuming it is a compliant servlet container. I wish Python had something like this.

You are right the popularity of PaaS's like dotCloud make it much easier to deploy and run your application. On dotCloud you just need to push up your WAR file, and you are running, by far the easiest of all the languages to deploy.

I really like Java as a language, I just think it has a long way to go on the web application front, before it can catch up to the features and speed of development of the other languages.

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

#135
post #15

Just remember when you talk about "cool" and popular that, Google+, GMail, LinkedIn, and many parts of Twitter are Java.

For twitter: JVM != Java Also remember that Google uses C++ as well for their infrastructure LinkedIn, yep

Google is heavily reliant on Java. LinkedIn and Twitter both use Scala and Java. I'm not really sure that pointing out that Google has some C++ code really disproves that Java is used heavily at google. Java is still very widely used, more so than more fashionable languages like python and ruby, but the syntax is a bit long on the tooth, hence the popularity of Scala, Clojure and Groovy.

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

#136
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…

...and that is why the latest generation of JVM languages such as Scala, Clojure and Groovy are so popular. Java the platform is extremely stable, highly optimized and heavily instrumented. Java is much less verbose than C++ (the main alternative when it was released), but the times have moved on. With Scala statically typed and verbose are not synonymous. Statically typed = high performance. Type inference and compa…

Dont forget - there is also jruby

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

#137
post #52

Earlier quoted context omitted.

I'm not sure if you are being sarcastic, but you do realize that's a lot of code for something so simple, right? get '/hello/:name' do content_type :json {:content => "Hello, #{params[:name]}"}.to_json end

I'm not sure if you are being sarcastic, but you do realize that your version is entirely static while the other one is ready for future evolutions? By changing a single line, the java version can also produce XML or text response. By changing two lines, it can also respond to POST requests. And that's just the top of the iceberg. Oh, and in the ends, it's way faster than Node, Ruby, Python and most of the dynamic la…

> By changing two lines, it can also respond to POST requests.

That's twice as many lines you need to replace as in Sinatra:

    get '/hello/:name' do
to

    route :get, :post '/hello/:name' do

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

#138
post #136

Earlier quoted context omitted.

...and that is why the latest generation of JVM languages such as Scala, Clojure and Groovy are so popular. Java the platform is extremely stable, highly optimized and heavily instrumented. Java is much less verbose than C++ (the main alternative when it was released), but the times have moved on. With Scala statically typed and verbose are not synonymous. Statically typed = high performance. Type inference and compa…

Dont forget - there is also jruby

JRuby is pretty nifty, still can't compare performance-wise to statically typed languages e.g. Scala: http://shootout.alioth.debian.org/u64q/benchmark.php?test=al...

Probably more comparable to Groovy in syntax and performance.

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

#139
post #67

Earlier quoted context omitted.

> So basically, it's due to lazy programmers who moan if they have to type or think too hard. Typing is a problem. Thinking too hard? Where does the OP imply he is averse to thinking? Being turned off that "fucking XML files are controllers" is being averse to thinking? > Also very very much fashion lead by hipsters who must be using the newest coolest untested thing on the planet. And those untested things would be?…

> "fucking XML files are controllers" XML has absolutely nothing whatsoever to do with Java the language. Some frameworks might use XML. There might be some built in functions/objects that deal with XML. But that doesn't mean you have to use XML. I certainly haven't in the 12 years I've been using Java.

XML may have nothing to do with Java, but some Java frameworks (e.g. Spring) are obsessed with it. Many (most?) Java devs don't even like Spring. Who in their right mind would want to write code to call constructors in XML? no type checking, no refactoring support etc.

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

#140
post #90
post #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 develo…

> Higher quality code. Java is easier to refactor than Ruby, which makes up for the lower language power. Let me rephrase: "It's easier in Java to rename identifiers than ruby, because my IDE does it for me." Now that's fine, but I don't see how do you conclude: Easier to rename identifiers => Higher quality code. How on earth? Easier to rename identifiers => Makes up for lower language power. What language deficienc…

You do realise there is more than "renaming variables" to refactoring don't you?!?
Post reply on HN