Live data from Hacker News

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

programmers.stackexchange.com

151–160 of 188 posts

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

#151
post #111

Earlier quoted context omitted.

''Am curious. Where in basic web development does concurrency help? As far as servers go, evented servers(thin, mongrel) will perform as good as, if not better, than a threaded server. And evented servers can handle much more concurrent requests than threaded servers.'' I don't know what is 'basic web development', but the argument 'why do we need concurrency if I rarely use it' doesn't work. I mean if you are a fron…

> I don't know what is 'basic web development', The type of web development where your controller renders a page. BTW I was quoting OP, where he mentioned he uses Java for basic web development. > I mean if you are a front-end developer/designer and mess with CSS/JS/HTML all day (without format CS education), you are probably wondering why concurrency even exists, but in real-world programming you can't go far withou…

""Yay. No true scottsman. All programming is real world programming, and you can go far without concurrency. Are templating engines real-world programming per your certification institute?""

Oh yes, part of the real-world where concurrency (via threads) is the core of the system, not some niche sub-technology like 'slow templating PHP engine'.

Now we are not talking about events vs threads, I still can't understand why someone should be stopping from starting a thread in any point of code, front-end or back-end.

""As far as concurrency at language level goes, very rarely have I needed to spawn a thread(I go for gevent) in the controller. Controller's job is to dispatch ASAP - everything else goes in the queue where you use EventMachine or gevent or whatever if you need concurrent processing.""

If your language of choice is bad at threads (and threads are hard to implement, hard to use, hard to debug, we know that) then you are lucky you can use something else to hack your way out. But to push it as a normal standard way of doing things... what for? Java is great at concurrency. It also has 'event' frameworks for those who really need it for some very specific use-cases like networking (netty, grizzly,something from apache, etc ). For the majority of us? Threads do just fine...

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

#152
post #90

Earlier quoted context omitted.

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

I've used both Java and Ruby and Java is by far the more advanced runtime with better support. Ruby may have much cleaner syntax than Java, but better tooling is NOT one of Ruby's strengths. Reading your post I suspect you've had very little exposure outside of Ruby.

> Reading your post I suspect you've had very little exposure outside of Ruby.

Reading your post, I see that you just throw claims around.

> I've used both Java and Ruby

Congratulations. You aren't the first or the only one.

> Java is by far the more advanced runtime with better support.

There are a lot of good things about JVM. I never contended that.

> but better tooling is NOT one of Ruby's strengths.

I don't remember saying it. I said "easier to refactor => high quality code" or "mvn is better at dependency management than bundler/gem"...is bullshit.

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

#153

Earlier quoted context omitted.

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.

" I'm not really sure that pointing out that Google has some C++ code really disproves that Java is used heavily at google. "

Of course not

"Java is still very widely used, more so than more fashionable languages like python and ruby""

Yes, but "widely used" is a tricky term, I'm sure cases both for and against can be found.

But to talk about Google, last I heard it's only possible to develop application there in the following languages: JS, Java, C++, Python (there are exceptions of course, for specific libraries or things like ObjC for iOS)

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

#154
post #111

Earlier quoted context omitted.

> I don't know what is 'basic web development', The type of web development where your controller renders a page. BTW I was quoting OP, where he mentioned he uses Java for basic web development. > I mean if you are a front-end developer/designer and mess with CSS/JS/HTML all day (without format CS education), you are probably wondering why concurrency even exists, but in real-world programming you can't go far withou…

""Yay. No true scottsman. All programming is real world programming, and you can go far without concurrency. Are templating engines real-world programming per your certification institute?"" Oh yes, part of the real-world where concurrency (via threads) is the core of the system, not some niche sub-technology like 'slow templating PHP engine'. Now we are not talking about events vs threads, I still can't understand w…

> Oh yes, part of the real-world where concurrency (via threads) is the core of the system, not some niche sub-technology like 'slow templating PHP engine'.

Your claim was "you can't go far without threads in real world programming" which is now "real world programming where concurrency is the core of the system". Does it need to be said that you won't go far without concurrency in a system which needs concurrency? Isn't that a tautology?

And I wasn't referring to PHP. I was referring to Jinja2. Jinja2 is neither slow nor simple, but that's tangential. What if it's slow? Adding threads will do shit as far as rendering templates is concerned.

> Now we are not talking about events vs threads,

I don't care about events vs threads. I care about throughput(parallelism - make 5 dns requests in shortest span of time) or co-ordinating processes(spell checker thread while I type). Processes, threads, events are all implementation details.

> I still can't understand why someone should be stopping from starting a thread in any point of code, front-end or back-end.

So you are twitter. I post a tweet. I have 1500 followers. Your cute little java process spawns 1500 threads to update the timeline for my 1500 followers, and I am waiting at my browser watching the loading git. How about 15000 followers? 150000?

A controllers job is to return ASAP. Spawn threads all you want. Nobody is stopping you. I was talking about why you don't want that.

> If your language of choice is bad at threads (and threads are hard to implement, hard to use, hard to debug, we know that) then you are lucky you can use something else to hack your way out.

For the second time, I don't care about threads. Processes, threads, events, agents, transactions with STM - whatever it is doesn't matter as long as I can get the job done.

> But to push it as a normal standard way of doing things... what for?

I am not pushing it as normal standard of doing things. For the tasks I generally write, threads won't cut it(Java or no java). Take 1000 threads on a 4 core machine - we will have (memory per thread) * 1000 ram usage, 1000 threads contending for execution on 4 cores. Threads work fine for small values of n, and even for small values for n, threads itself come with a lot of baggage and extra care has to be taken to ensure correctness.

> It also has 'event' frameworks for those who really need it for some very specific use-cases like networking (netty, grizzly,something from apache, etc ).

You are responding to claims I didn't make. I didn't say Java is bad at concurrency or Java doesn't have evented frameworks.

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

#155
post #136

Earlier quoted context omitted.

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.

I wish people would try to write better and contribute Ruby programs for the benchmarks game :(

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

#156
post #4

It's mainly the coolness factor. Oracle's ridiculous Java lawsuits also contributes to that.

Came here to post that. Oracle are known for being major assholes, over and over. I wouldn't want to work with anything they spawned. I'm not sure why you got downvoted. Believing in the tools that you work with is as important as what those tools can do.

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

#157
post #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 require…

I seriously recommend that you re-look your stack. Java is simply the most performant (RAM and CPU) stack vs Rails in a pure apples-to-apples comparison. The two stacks you have compared are apples to watermelons - here are a couple of questions: 1. Why both Tomcat and Jboss ? Choose one or the other. In fact for the best performance you can run your application on Jetty. 2. Mysql vs Oracle ? you need to compare equa…

all true - but my unfair comparison was between the typical java enterprise dead horse, and a typical startup stack.

I did not compare Java best practice for one reason: The enterprise bloat is how Java is perceived. Its not about why Java is not suited for startups, but why Java is not choosen by startups.

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

#158
post #99

Earlier quoted context omitted.

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…

And when those changes are made, I can change my version to: response = {:content => "Hello, #{params[:name]}"} respond_to do |wants| wants.json { response.to_json } wants.xml { response.to_xml } end

I've been trying to ignore this particular flame-war, but your example is doing fundamentally less, because it's not binding objects to json (which was what you originally asked for).

I actually cannot write your example easily in Sinatra/Ruby/etc, without making my object either a Hash or an ORM subclass, customizing serialization, or pulling in uncommon libraries.

Here's your complete example, in reasonable Ruby. It's longer than the Java.

    class Greeting  content}.to_xml
      end

      def to_json
        {:content => content}.to_json
      end
    end

    get '/hello' do

      response = { :content => Greeting.new(params[:name]) }

      respond_to do |wants|
        wants.json { response.to_json } 
        wants.xml { response.to_xml }
      end
    end
If I create an imaginary library that does exactly what we'd want here, it'd look like the following. It's marginally shorter than the java, but hard to argue anything about it being fundamentally better.

    class Greeting 
      include JsonObject
      field :content
      def content
        "Hello, #{@content}"
      end
    end

    get '/hello' do

      response = { :content => Greeting.new(params[:name]) }

      respond_to do |wants|
        wants.json { response.to_json } 
        wants.xml { response.to_xml }
      end
    end

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

#159
I do a lot of work in Python now, which is great. But the one thing that I really really really miss from Java is better dependency management and packaging.

I wish I could just create a .war file for my Python project and copy it to a deploy directory on a server to get it going.

Using a virtualenv and pip or easy_install works ok but a simple maven config to define my project and it's dependencies is still lightyears ahead of the mess we have in Python now.

It is really difficult to beat: 'mvn package && scp target/my-app-1.0.war server:~/deploy/'

I hope Python will get there.

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

#160
Java frameworks are insanely overengineered. It's utterly and totally retarded. The culture shock I experienced when I switched to Java, from 15+ years of C server/systems programming was over the moon. Factories here, decorators there. wtflol. Patterns are not Java specific, but it is all the lingo you need to be able to parse....

But hey, we can keep selling courses ....

It has become an enterprise language and therefore, the biggest issue is not causing too much uprising.

On the side, I do RoR and NodeJS projects and those are a ton of fun to do, and give me ideas on how to reduce clutter and complexity in the Java projects.

Post reply on HN