Live data from Hacker News

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

programmers.stackexchange.com

111–120 of 188 posts

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

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

''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 without it.

I said evented servers out-perform threaded servers. Threaded servers will eat more RAM and have higher cost of context switching. As far as application code goes, your controller isn't supposed to spawn threads(at least mine doesn't). The heavy-lifting should be done by the background services, and you can very well do concurrency in Ruby/Python(EventMachine, gevent). Generally, threaded code doesn't cut it where number of threads are large.

And I am pointing this out for the second time. You ignored it all and went on a tangential regarding how I am a frontend developer/designer without formal cs education, and am wondering why concurrency even exists.

> but in real-world programming you can't go far without it.

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?

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

#112

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 dependency injection), JAX-RS (REST), JSF + PrimeFaces (very productive front-end development) and lightweight, fast web application servers (Tomcat 7, Glassfish).

And you have access, when and if you need it, to a very mature, stable and capable set of libraries, open source projects and tools. Plus the ability to deploy to almost anywhere including PaaS platforms.

So I think there's a lot to like in modern Java.

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

#113
post #91

This is just my experience but if there has existed a common line of thinking with the rabid Java fans I've worked with, it would be closed mindedness to the point of being its own brand of Stockholm syndrome. The thinking that whatever the project at hand may be, a Java based solution is always the correct answer and there is nothing to learn from alternative platforms. I've heard "Why would anyone want to use anyth…

>>the rabid Java fans I've worked with [closed mindedness] It is hard to argue against anecdotal evidence, but of the cases you mention -- java, Rails, Django -- imho, it is not exactly the Java people who seem to be the worst language/framework fanatics... (That said, scripting languages eat static languages' lunch for development speed in most every case I've seen.)

That kind of framework enthusiasm doesn't really stem from the closed minded mindset I was referring to. Most Ruby & Python devs I've met would admit that Java is a much better choice than their perspective languages for something like that requires distributed concurrency and speed (like Cassandra or Redis). The people I'm talking about are the ones that wouldn't look seriously at RabbitMQ because it's written in Erlang, not Java.

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

#114

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…

Thank you for your very in-depth explanation.

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

#115
We (plumgine.com - in private beta) have been using Java with a success with Play Framework and asynchronous AJAX fronted (some parts with Backbone.JS).

I have been using Java for a while (8 years - J2EE, Android, some desktop utils) and back in the JSF days I used to hate the Java web with a passion. Then I found Stripes (step in a good direction) and Play Framework (absolutely awesome Java web framework).

These days I can whip out prototype in Java+Play Framework faster than anything else.

Some of the reasons:

* I don't have to worry about naming methods/members because I can safely rename them later

* I can easily map Java objects to JSON and back using Jackson

* most of the time I don't worry about database schema - Hibernate (JPA) generates it for me

* Play Framework works in the "hit refresh" mode to see changes

* deployment to Heroku is as seamless as any other.

There is increasingly more action going on in the browser in JavaScript and I think Java (with Play Framework) is a great tool for building backend APIs that will be consumed by your JavaScript client.

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

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

Your Java IDE also lets you move methods and fields, extract interfaces from concrete classes, push members up or down, find all references to a member (reliably), view inheritance relationships, and much more. And it can do all of those safely, warning you if you'll shadow another name. I wish I had that stuff in a Ruby IDE. I've used Eclipse for a long time, but not for JEE projects, and I don't see any "stop the w…

> Your Java IDE also lets you move methods and fields, extract interfaces from concrete classes, push members up or down, find all references to a member (reliably), view inheritance relationships, and much more. And it can do all of those safely, warning you if you'll shadow another name. I wish I had that stuff in a Ruby IDE.

Some of it isn't applicable to Ruby, and some of it has to be done manually. True that you will have to rely on tests or something to make sure you didn't shadow anything, or you renamed at all places, or you didn't rename something which shouldn't have been renamed.

> I've used Eclipse for a long time, but not for JEE projects, and I don't see any "stop the world" behavior when it's compiling Java

What machine do you use? I was using a 4 gigs, dual core machine, and eclipse regularly stalled while compiling and launching.

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

#117
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 think you mean "characters". Rather than code. "public static void main()" isn't a lot of code. It's three keywords, and one identifier. You may consider it a lot of characters, but it's pretty rare that a programmers bottleneck is speed of typing. I wish people would stop confusing "number of characters" with "amount of code". And FWIW, I find your example far harder to decipher. I have to know what => means, # me…

This is just a sad Stokholm defence - against languages that threatens your sacred cow - which is understandable since the Java code example got pwned.

So rather than defending the code example on merit, you dive into pedantic nit-picking territory. I used to be defensive about my choice language as well, till I matured and realized holding onto sacred cows just hurts your ability to learn from others doing it better and being more productive; and just clouds your ability to choose the right tool for the job.

More code = more code, to read, to decipher, that hides intent, that adds complexity, that can have bugs and can go wrong. Code-size is codes worst enemy.

I don't even know Ruby, but it's implementation is vastly more readable and would look a lot closer to what the perfect DSL would look like for this task, than the Java example.

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

#118
post #87

Earlier quoted context omitted.

Actually, with Java, I type more than I think. A lot more. Compare this to Haskell, where a single keyword might involve substantial thought, or APL, where one character more or less could represent a pretty fundamental restructuring of part of the program. That Java makes you repeat yourself is not controversial. That being averse to this means you dislike thought is a somewhat bizarre position to hold.

> That Java makes you repeat yourself is not controversial. That being averse to this means you dislike thought is a somewhat bizarre position to hold. The English language makes you repeat yourself. I don't see it as a bottleneck. I've never considered a bottleneck to programming. possibly when programming some assembly routines. But if you're typing too much, you're probably repeating yourself too much, which means…

Things that can be libraries in other languages end up being "design patterns" in Java. It's just not flexible enouth, both Ruby and Haskell are more flexible than it. Both in different ways.

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

#119
post #37

Earlier quoted context omitted.

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

Actually, it needs pure functions. Lambdas are one way to add them with the benefit of being buzzword-compliant.

Purity is orthogonal to lambda abstractions. It's matter of what function can do (pure or not) and function creation (a lambda or something more verbose).

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

#120

Earlier quoted context omitted.

The JVM is very fast to start on my machines. For Java 7 on Linux x86_64: t:~% time java HelloWorld Hello from Java! java HelloWorld 0.04s user 0.02s system 94% cpu 0.063 total It's not as fast as C or Ruby, but who cares about .063 seconds spent once at start-up? t:~% time ./hello Hello from C! ./hello 0.00s user 0.00s system 0% cpu 0.002 total t:~% time ruby hello.rb Hello from Ruby! ruby hello.rb 0.00s user 0.00s…

How about the same test with a '-client' switch...

I get the same times, more or less. I'm not sure the -client switch changes any behavior that early in the VM's life, before any garbage collection or sizable allocation happens. It would still be using a 64-bit data model with the -client switch (-d32 gives me: "Error: This Java instance does not support a 32-bit JVM.").
Post reply on HN