Live data from Hacker News

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

programmers.stackexchange.com

101–110 of 188 posts

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

#101

As a young developer (early 20's) I think Java's lack of usage in webdev has to do with several "problems". 1.) Java has the rep of being bloated and slow. (At least when compared to C/C++) 2.) Related to #1, almost all the tools the majority of webdevers use are written in C/C++ and not Java. For instance, Apache, Nginx, Redis, MongoDB, MySQL, SQLite, Webkit, V8 - which gives me the feeling that using/improving C/C+…

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.

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

#102
post #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)?

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

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

#103
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 equally. I hope you do realize that JDBC/JNDI are perfectly compatible with Mysql - more so, since they are the same business entity.

3. Lighttpd vs Apache is again an unfair comparison. You can perfectly run Lighttpd in front of Tomcat.

I seriously suggest you re-evaluate Java if you are purely looking for performance. Developer productivity is a whole different story altogether.

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

#104
post #98

Earlier quoted context omitted.

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…

The last part of your comment is just language bias. symbols and hashes are fundamental to ruby. Why would I use string concatenation like my parent, when the language support string interpolation. It's as unclear to you as generics or annotations might be to someone who didn't know Java. Surely you see that? I think you are being pedantic about characters vs code. But, for what it's worth, I disagree. You are having…

I grew up reading assembly code listings. Being able to read code is a really really important skill IMHO. Something like Java is very very easy to read. It's mainly keyword based, rather than special character based. I'd much rather read a 1,000 line Java program, than a 100 line program.

The other point I'd make is that Java is probably about as verbose as english is. But we all manage, using English. We don't moan on and on that talking, writing, reading is so inefficient and we should all switch to something better. English also has odd grammar and spelling rules which are inconsistent and plain stupid sometimes. Yet, English works pretty well for what we use it for. Communicating.

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

#105

Earlier quoted context omitted.

Is Rails that slow? There's absolutely nothing on my machine slower to start up that the jvm.

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

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

#106
post #87

Earlier quoted context omitted.

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.

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 you're doing something wrong.

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

#107
post #100

Earlier quoted context omitted.

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

The OP asked why Java isn't used for the web. One of the more popular Java web frameworks heavily relies on XML. It has nothing to do with Java, but it has everything to do with what the OP asked about.

Write your own framework. It's actually not rocket science. You can have a pretty good Java web server going in about 200 lines of code.

Just write a simple HTTP server in Java, and have it work as you want it to. Without XML...

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

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

Nah, there are always favourites and 90% of the industry is following them. If you google 100 MVC web frameworks for Java, that doesn't mean anything but that the language is popular.

There are only a couple of frameworks that are in real use. Some large and 'lucky' companies are glued to IBM/Oracle so are forced to use proprietary solutions without this luxury of googling for something new.

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

#109

I've worked with PHP for 16 years, and with Grails for almost 5. There are some aspects of Grails and Groovy that make me more productive than developing in PHP. GORM simplicity and expressiveness, and CriteriaBuilder stuff, combined make using direct SQL very rare (required in a few cases, but rare). However, there are aspects of PHP that make things more simple, and this gets down to somewhat of a cultural thing. O…

I can't see why you can't serialize session to database or memcache or anything else if you want. The amount of code involved is almost zero... Also I don't see a reason to have a shared storage for session objects in a scalable distributed application you are trying to build. In Java you could, for example, use ehcache with out-of-box replication - simpler than using external C-based application like memcache. And i…

Friend in question is certainly not a young junior dev - >10 years of dev experience, 8 in java, and does java training. Trainers may be more focused on language stuff vs admin stuff, so I cut some slack there. But.. the majority of java people I've known have been developers only, who don't do any server admin. Again, not saying java devs who know sys/server admin don't exist, but, the ones I know who do that aren't 'java devs' in the sense of only doing java, but tend to be polyglots with experience from multiple backgrounds.

I'm not sure why you'd not have a shared storage for session data in a multi-server system. What else do you suggest?

http://ehcache.org/documentation/configuration/configuration - that's an insane amount of configuration it looks like compared to something like PHP. It also looks like you're tying yourself to a specific caching solution vs having generalized session data.

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

#110
I actually think the IDEs for Java, e.g. Eclipse and IntelliJ, are quite evolved and help speed webapp development, and they do it in ways that make up for Java's verbosity and boilerplate.

For me a lot of the web frameworks for Java felt cumbersome and I found that Java worked better when functioning as a high-throughput backend service instead of handling front-end UI. Oddly, with Java, I was more concerned with concurrency issues, GC tuning, threading, and other systems-y problems, and with Python I was more concerned with concise and Pythonic syntax and faster iteration.

Post reply on HN