r/programming • • Feb 22 '15

Java Makes Programmers Want To Do Absolutely Anything Else With Their Time

http://www.forbes.com/sites/quora/2015/02/21/java-makes-programmers-want-to-do-absolutely-anything-else-with-their-time/
35 Upvotes

636 comments sorted by

View all comments

66

u/[deleted] Feb 22 '15

I'm going to address some of the points from the first page because I can't be bothered to read the rest.

[..] a VM that has a macroscopic startup time [..]

That doesn't mean anything for applications with a measurable runtime. If you're writing a web service, you don't really care about the 2 extra milliseconds it may need to start up. Meanwhile, overall system performance tends to be excellent.

For real-world production servers, it tends to require a fair amount of JVM tuning.

Nope. Haven't run into a situation where that was necessary. At worst you need to increase the maximum heap size for a program that needs a lot of memory. That's not fine tuning. That's common sense.

The language sucks, [..]

Literally nothing else said to back that opinion.

[..] Java culture is one of mediocrity and bad taste, with MetaModelVibratorVisitorFactory classes dominating.

Juvenile.

[..] top Scala engineers [..] are really freaking good.

So are the top Java engineers. What's your point?

The only real issue brushed by is that there tends to be a large number of bad to mediocre developers working with Java. I don't know why that's Java's fault. Bad programmers follow success. Whichever language is in high demand (and so has the most jobs), has to bear the cross of having the worst programmers around it.

15

u/strattonbrazil Feb 22 '15

For real-world production servers, it tends to require a fair amount of JVM tuning.

I've seen stories where massive services will have a bit of JVM tuning done to be more efficient. Good for them. Seriously, what's the alternative? Running a slower language like ruby? The usual workflow I see is write something in ruby (or some other scripting language) just to get it up, switch to java for performance as many companies have done (Twitter, Google, Foursquare, etc.), and then do performance tuning because why use X machines when you could do the same work on half of them?

11

u/bcash Feb 22 '15

Engineers at Twitter have forked OpenJDK and run a modified JVM with an extra generation in the memory model. It's a clever optimisation alright, but it still would have worked without it. When you get to Twitter-scale shaving 5% of run-time equals quite a lot of saved cash.

But exactly as you say, what's the alternative? Re-write everything in C and do all memory management manually? That would almost certainly work too, but at the moment they have good performance and a high-level language (mostly Scala rather than Java, but still valid as it was JVM tuning we were talking about).

1

u/[deleted] Feb 22 '15

My rails apps run on the JVM now. Still tuning but much faster. Kind of a pain to roll the servers, but all in all, thanks java!

1

u/segv Feb 22 '15

Out of curiosity, why do you think it's painful?

From my experience all you really have to do is copy over JDK (as in, copy the files, don't even have to 'install' it), copy over the application, update JAVA_HOME and PATH and hit start.sh for the application (if you have special needs the workflow needs to be changed, of course).

Since you can put your application with all of its dependencies in a single package, the ease of (repeatable, predictable) deployment is miles and miles ahead of some systems associated with other languages (looking at you, virtualenv) - no manual updates on each of the boxes, no binary incompatibility with a binary blob you have to dlopen and so on.

2

u/[deleted] Feb 22 '15

Oh no, I'm talking about how long it takes torque box to roll over when I'm doing a code push. Annoying. And the jit takes a while to kick in after that.

3

u/MorrisonLevi Feb 22 '15

The only real issue brushed by is that there tends to be a large number of bad to mediocre developers working with Java. I don't know why that's Java's fault. Bad programmers follow success. Whichever language is in high demand (and so has the most jobs), has to bear the cross of having the worst programmers around it.

I thought you were talking about PHP for a minute.

/ducks

11

u/wtfdaemon Feb 22 '15

You kidding about the lack of need for JVM tuning? I've made a ton of money over the last decade specializing in performance/stability/scalability analysis and repair of JVM-based application servers. It's admittedly gotten a lot better over that time out of the box, but if you aren't doing some profiling (including with stress/load testing), you ain't doing it right.

2

u/[deleted] Feb 22 '15

As a professional android developer, I don't mind it. It's not my idea of a "perfect" language, but it is more than adequate for what I need it for

2

u/Bobby_Bonsaimind Feb 22 '15
[..] Java culture is one of mediocrity and bad taste, with MetaModelVibratorVisitorFactory classes dominating.

Juvenile.

I like that argument most, "the language sucks because the dev team had naming standards and actually stuck to them".

-6

u/virtyx Feb 22 '15

2 extra milliseconds it may need to start up

More like 4s in my experience. Even if it "doesn't make that big of a difference" it's still needless and should really be tuned/tweaked. Want to write a command-line program in Java? Hope you enjoy the mandatory startup lag... (Same with GUI, etc.)

10

u/[deleted] Feb 22 '15

4 seconds? I don't mean to go off topic but are you running Java 1.4 on a 15 year old machine? That shouldn't happen unless you're doing 4 seconds of initialization, probably with disk and network IO, at program start-up.

Also, for command line programs, the startup delay is unnoticeable. From what I remember reading, most humans perceive a visual delay of less than 100 milliseconds as instantaneous. So if you wrote a command line program in Java, it would appear to have started up instantaneously.

3

u/Milyardo Feb 22 '15 edited Feb 22 '15

This assertion is pretty easy to test as well.

cat <<'EOF' > hello.scala
#!/usr/bin/env bash
exec scala -savecompiled "$0" "$@"
!#

println("Hello World")
EOF

chmod u+x ./hello.scala
time ./hello.scala

Which produces:

$ time ./hello.scala                                                                               
Hello World                                                                                                 
                                                                                                        
real    0m0.833s                                                                                            
user    0m0.513s                                                                                            
sys     0m0.054s
$

and on the second run after compilation:

$ time ./hello.scala                                                                               
Hello World                                                                                                 
                                                                                                        
real    0m0.387s                                                                                            
user    0m0.361s                                                                                            
sys     0m0.048s

Mind you the version of scala I have installed to my path right now is ancient and an actual Java Hello world would start up in less time:

$ scala -version                                                                                   
Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL                                           

2

u/Nutomic Feb 22 '15

The discussion was specifically about java.

Scala has a longer startup time because it has to load its (bigger) standard library.

3

u/Milyardo Feb 22 '15 edited Feb 22 '15

The discussion was specifically about java.

The discussion was specifically about the start-up time of the JVM and the Java runtime.

Scala has a longer startup time because it has to load its (bigger) standard library.

I already mentioned this fact, but that's not why a Scala's Hello World would take longer to startup. The number of classes you have on the classes you have on the class path is irrelevant, classes are only loaded on the JVM as they're used. In this case Predef.scala and Console.scala are the only extra classes used.

Scala would take longer to startup because of the scala shell script executable which runs MainGenericRunner, bootrapping the compiler before running our hello world script that was already compiled.

1

u/Gurkenmaster Feb 22 '15

The discussion was specifically about the start-up time of the JVM and the Java runtime.

Yes but a large number of Clojure devs complain about JVM startup when it's caused boostrapping their core library.

2

u/[deleted] Feb 22 '15

Woop de fucking do. 4s (a gross over-estimation) is nothing for a web service, and most web frameworks would love a 4s startup. The last RoR project I was on was in the 10s range.

Edit: Also I'm calling BS on 4s. Clojure is in the ~2.5s range. There is no way Java is slower than Clojure on the startup front.

1

u/virtyx Feb 22 '15

The point is that it's a bit of a killer for command line apps. Compare Maven start time to e.g. something like Fabric.

Although you're right calling me on my BS, I actually was thinking of Clojure. Whoops!

1

u/[deleted] Feb 23 '15

Indeed, Clojure's startup time is too damned slow for CLI apps. Shame, it's fun to write but it does not fit in that niche, although there are already a crap ton of choices for good CLI apps, tbh.