News for hackers. Stuff that matters.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by dmk23 on Wednesday October 09, 2013 @06:57PM (#6524503)
Any talk of Java "dying" is just nonsensical

Java hands down is the most obvious choice for any applications that require performance, yet are too complicated to write and support in C/C++/other lower level languages. Java JIT is very mature unlike JITs for most other languages, which largely remain at the level of experimental projects and fall short on key production requirements.

Given that the entire Hadoop ecosystem is based upon Java as well, it is here to stay for anything that has to deal with "Big Data"

Re:If Java Is Dying, It Sure Looks Awfully Healthy by anologwintermut on Wednesday October 09, 2013 @07:08PM (#6524550)
Isn't the most obvious choice for things that require performance but are too complicated to write in C, C++?

Isn't Java the choice for things that aren't performance critical but are too complicated to write in C?

Java survives because thats actually most things.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by wheaties on Wednesday October 09, 2013 @07:40PM (#6524695)
Like Erlang's GC what all with the 5 9's of uptime it was designed to handle. I mean, come on, the GC algorithm it uses may be battle tested and far simpler than the GC beast that is the JVM but simple is bad, right?
Re:If Java Is Dying, It Sure Looks Awfully Healthy by fleitz on Wednesday October 09, 2013 @07:13PM (#6524578)
Yes, that's why kernels are written in java.

If you're writing complex code java is rarely the answer as it requires so much complexity itself.

Hint: Most java projects just appear to be complex because of the poor quality of the language (and developers).

Java is hands down the choice for simple projects written by way too many poor quality developers. The JVM can barely manage 12 GB of memory, Java is a piece of crap when it comes to anything that's actually complex.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by millerm on Wednesday October 09, 2013 @07:32PM (#6524667)
I would venture to say, with no facts or figures mind you, that if you were to evaluate the number of lines of code dedicated to kernel programming to that of applications running applications on the Internet, that the resultant figure would be so small for kernel code that it would look like kernel development doesn't even exist.

Saying that developers who use Java are poor quality is also an awful thing to say. Yes, there are many "poor" Java developers. But, it's only because there are so many Java developers in the first place. So, of course when you take even a small percentage of such a large number there will still be a large enough sample to look significant. It's the same for all other languages.

Java has been my primary language for the last 14 years. During that time I have worked with countless individuals who I would regard as some of the smartest and most competent programmers (who develop using Java) I have known or heard of. These people make your banks, file sharing sites, massive online market places, electronic billing etc. work. So, go ahead and bash all the developers from Google, Sun, SpringSource, Apache Contributors, Oracle and the other 10,000+ companies out there, but empirical evidence has shown that the language and platform work.

Your statement is just so "trollish"... seriously?

Edit: capitalized Internet. Letting the run-on sentences and bad grammar fly.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by Dewie on Thursday October 10, 2013 @02:48AM (#6526067)
> Saying that developers who use Java are poor quality is also an awful thing to say.

You can't have a medium to large Java thread on this site without a lot of people deriding Java developers. It's practically a law of nature.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by fleitz on Wednesday October 09, 2013 @07:41PM (#6524699)
What about java makes it better for high performance / complexity code?

I never said there isn't a lot of java code, or that it doesn't work, my assertion is that java is not the hands down choice for high complexity / performance work.

If you've got a bunch of mediocre programmers who can't be trusted to make + add things together then sure java is a great choice.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by bdamm on Wednesday October 09, 2013 @08:06PM (#6524806)
It's a natural fit for enterprise programming where time to implement is usually key and logic is endlessly extended to accommodate whatever new business requirements emerge after the last round was deployed. And robustness is valued more highly than raw performance. Use Java - pay for twice the servers and get ten times the uptime? Done.

That means that days or weeks spent hunting your latest memory corruption issue makes C a non-option for these applications.

As for mediocre programmers - sure, and a large bunch of mediocre programmers scales, whereas a small team of star programmers doesn't. Someone has to tweak the UI. Someone has to implement all that tedious persistence logic. You need star programmers for that? No.

I'm excited to see if Go intrudes on this field, but it's a big field and Go's just starting out.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by fleitz on Wednesday October 09, 2013 @08:22PM (#6524873)
Yet again I ask what makes java good for high complexity / performance code and get told it's good for managing mediocre programmers.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by kd0amg on Thursday October 10, 2013 @12:13PM (#6528456)
In the kind of situation GP describes, what matters is probably the well-established practices for extending the behavior of an already-built system without breaking what's already there. A lot of Java practice has built up around having behavior determined dynamically (OOP is a nice fit for that, whereas C does not have great facilities for it). Much of the "ceremony" involved in using the big, complex Java frameworks is about preparing a piece of code for eventual extension. When some behavior is hard-coded in, it's difficult to change later, so the code is parameterized over anything and everything that might eventually change. Of course this looks silly when you do it for small things that won't change -- no need for FizzStrategy and BuzzStrategy interfaces when the only thing you'd ever want to do is print "fizz" or "buzz".

Quite a bit of that programming practice did develop in C++, but Java as a language provides stronger safety guarantees than C++ (lots of memory-related errors are difficult to impossible to have in Java) without sacrificing all that much performance. When you ask for a reasonably performant, statically-typed, memory-safe, object-oriented language, you're going to get pointed at Java (and C#). So that's what people use in that domain.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by neeleshs on Thursday October 10, 2013 @12:48AM (#6525703)
Oh please, Workday uses a JVM managing 160GB. Lucene/Solr are not simple projects, by any yardstick, for example. I do agree Java the language is somewhat cumbersome, but saying that its a piece of crap for anything thats complex is naive
Re:If Java Is Dying, It Sure Looks Awfully Healthy by bradhe on Wednesday October 09, 2013 @07:16PM (#6524586)
This comment is laughable at best. Ignorant might be a better word for it.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by fleitz on Wednesday October 09, 2013 @07:18PM (#6524598)
Care to elaborate?

Here's the 12 GB of memory...

http://www.datastax.com/docs/1.0/operations/tuning

As far as the language is concerned...

What problem of high performance & complexity apps does Java 7 solve that C++11 doesn't?

Re:If Java Is Dying, It Sure Looks Awfully Healthy by jfoutz on Wednesday October 09, 2013 @07:28PM (#6524649)
It solves the problem of using mediocre developers to get code into production. Clunky, slow and overly complicated is infinitely better than a segfault.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by sillysaurus2 on Wednesday October 09, 2013 @07:29PM (#6524653)
Automatic memory management...?

"Just use Boost" is not a viable strategy when it adds so much complexity in and of itself.

I'm not defending Java, but it's helpful to know what the limits of each tool are.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by eropple on Wednesday October 09, 2013 @08:10PM (#6524819)
Automatic memory management (especially with a garbage collector) is antithetical to high performance. I like the JVM (for Scala, mostly; Java-the-language can go screw), but there is nothing there really remotely close to C++ and C, and the garbage collector is a very large part of why.. Rust might horn in on C++'s bailiwick, but until then, it's gonna be a while.

I strongly disagree that Boost really adds "so much complexity"--and, by the way, shared_ptr and friends are in C++11, and by extension within the standard library. So you don't even need this, unless your goal is to target extremely old platforms. But honestly, if you seriously need shared_ptr, your code design is probably just Not Very Good.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by sillysaurus2 on Wednesday October 09, 2013 @08:23PM (#6524875)
Automatic memory management (especially with a garbage collector) is antithetical to high performance.

The LMAX Disruptor pattern would like to have a word with you.

http://lmax-exchange.github.io/disruptor/

http://martinfowler.com/articles/lmax.html

http://stackoverflow.com/questions/6559308/how-does-lmaxs-di...

I'm not just namechecking the Disruptor pattern. I have extensive experience with it. It's about 10% slower than what could be achieved with C -- which is to say, the benefits of not having to program in C far outweigh the 10% loss of performance. And its performance is almost always far higher than what's needed, i.e. the bottlenecks are elsewhere.

I strongly disagree that Boost really adds "so much complexity"

We'll have to agree to disagree, I think. Importing Boost is often a sign that something is awry with the design goals of the project. Either the choice of language is wrong, or the project is too ambitious. Though there are some aspects of Boost that are pretty good, such as its unit testing framework.

if you seriously need shared_ptr, your code design is probably just Not Very Good.

This I fully agree with.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by haberman on Thursday October 10, 2013 @03:48AM (#6526233)
> It's about 10% slower than what could be achieved with C

What does that even mean?

Are you saying that you have a proof of the theoretically fastest C program that would implement the same functionality and it's 10% slower than that? Does the C you're comparing it against use the Disruptor pattern too? Or is this just a comparison against a naive, single-threaded C program? How does that number vary with the overall heap size of the program?

Numbers like this get thrown around that strike me as incredibly dubious.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by pron on Thursday October 10, 2013 @05:48AM (#6526581)
Sigh. This again? A good garbage collector will always reach a higher throughput than "manual" dynamic allocation/deallocation in C/C++. Pauses are a different matter, and can impact latency; in cases where latency is crucial, Java programs either resort to manual memory management or use a commercial low-latency GC.

If you're comparing the JVM's GCed heap with some specific, user-managed allocation scheme, then know that the latter can be done (and is often done) in Java too.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by alpatters on Thursday October 10, 2013 @06:55AM (#6526735)
C++ gives you the option to just put your objects on the stack and have them clean themselves up upon destruction. Enforcing the placement of small objects on the heap, even a garbage collected heap, seems such a waste of time and efficiency. You shouldn't really use the term "always" either. You have the option of implementing a garbage collector manually, or an object memory pool to remove the malloc/free new/delete overhead.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by pron on Thursday October 10, 2013 @07:45AM (#6526882)
> C++ gives you the option to just put your objects on the stack and have them clean themselves up upon destruction.

Modern machines have, I don't know, say, 64GB RAM? How much of that can you use for thread stacks? 1GB tops? Modern applications work with really big heaps. Stack allocation is irrelevant for most of what the application is doing.

> Enforcing the placement of small objects on the heap, even a garbage collected heap, seems such a waste of time and efficiency.

Yeah, it seems that way, but it turns out that it isn't. Previous attempts to allocate Java objects on the stack showed little or no improvements.

A heap allocation in Java is a pointer bump, and deallocation of a short-lived object is free (Well, this is not quite true, because many allocations will trigger a young-generation collection which, in the JDK's GCs – though not in some commercial ones – takes linear time in the size of surviving objects)

> You have the option of implementing a garbage collector manually, or an object memory pool to remove the malloc/free new/delete overhead.

You have the same option in Java, too, and it's pretty much the same amount of work.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by alpatters on Thursday October 10, 2013 @08:41AM (#6527195)
> Stack allocation is irrelevant for most of what the application is doing.

Well I disagree with that. In C++ it is quite common for most objects to be allocated on the stack. I have never heard stack allocation being described as irrelevant. Of course if the language puts everything on the heap then that statement might be true.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by pron on Thursday October 10, 2013 @12:24PM (#6528519)
> In C++ it is quite common for most objects to be allocated on the stack.

Most objects? You have 64GB of RAM! You want to tell me that you can take advantage of all that RAM with thread stacks? You're unlikely to even use 4GB of stack.

If you don't, then you're talking about a small application.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by pjmlp on Thursday October 10, 2013 @02:03AM (#6525921)
Good luck doing manual memory management in whatever language (C, Pascal, C++, ...) with distributed teams, using developers of disparate skill levels.

Hunting for memory leaks and pointers gone berserk will become someone's full time job.

I like C++, but don't miss using it in enterprise projects.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by artsrc on Wednesday October 09, 2013 @07:33PM (#6524670)
C++ is a tool for language experts. If you can effectively apply that expertise it is extremely expressive and efficient.

Java does have some unfortunate complexity, but I don't think it is in the same league.

Java also includes a library that is more extensive in some areas than the vanilla standard C++ one.

The JVM is also more robust to some types of programmer errors than any run time for C++ that I know of.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by fleitz on Wednesday October 09, 2013 @07:47PM (#6524717)
I'm not talking about how many features the language has, I'm talking about the endless amount of line noise that you need to accomplish simple tasks.

Most of what the code does is hidden behind ceremony.

Imagine Newtown writing out instructions on how to calculate gravity instead of just writing: F = G((m1 m2)/(r^2))

I really don't understand how a language that can't succinctly express calculus from 300 years ago would be regarded as suitable for complex code.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by bdamm on Wednesday October 09, 2013 @08:13PM (#6524837)
Languages like Matlab are best suited for expressing calculus. Why are you choosing a poor tool for the job?

Most Java programmers don't care about expressing calculus. They care about expressing interactions between web services, sql, and applying rules as the data flows through their modules. Or between user interface elements and service requests. It's all about moving data around, working on that data when you've got it, and triggering actions.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by fleitz on Wednesday October 09, 2013 @08:20PM (#6524864)
The problems of pushing bits from one server to another aren't that complicated and the pomp and circumstance of java gets in the way of actually accomplishing those things.

As you point out when you have a reasonably complicated problem like applying functions java fails miserably and other languages are a much better choice.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by cgh on Thursday October 10, 2013 @12:52AM (#6525717)
No offence, but it's clear you have no idea about the domains in which server-side Java is typically used. Very large enterprises have all kinds of weirdness and the Java ecosystem has a bunch of libraries found in no other language ecosystem that make things manageable. Java-the-language is sadly verbose and tedious but that's not why people choose it.

So server-side Java lives in a niche and I would never suggest it for, say, anything client-side or basic web apps.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by tracker1 on Thursday October 10, 2013 @05:10AM (#6526466)
I'd say that NodeJS or Ruby would be decent alternatives depending on your need. npm and gem are really nice in this space and cover just about any need you might have without weighing your system down in pomp and circumstance.

The runtimes aren't that much slower, and for I/O bound tasks, odds are Node is going to run just as fast with less application complexity.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by bdamm on Thursday October 10, 2013 @07:46PM (#6530713)
Actually, part of the problem is the academic experience of believing that applying functions is hard and pushing bits is simple. It deceives delusional academics like yourself into believing it's just a matter of doing the work and not really a real computation problem at all.

No, in the real world, it's exactly the opposite. Nobody cares about writing a function because generally that's the simple part. Do it however you want. Deploying the system to take inputs and feed outputs, now that's the hard part. Where do those inputs come from? In what form? Are there security requirements to gather or push data? Do you store-and-forward or don't you? What protocol? Stateful or not stateful? Transactional or not transactional? The problems involved in "move these bits in this format on this machine to those bits in that form on that machine over there" are in fact so complex that you can't even prove it to be an NP-complete problem because the problem itself transcends algorithmic analysis. It is much more a social problem than a technical problem, but the social problem is so massive that any simple-minded technical approach will fail to address the scope of the issue and in every case I've ever seen, simply makes the problem worse.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by bradhe on Thursday October 10, 2013 @04:04AM (#6526281)
The "ceremony" you're talking about has nothing to do with the language itself and everything to do with the community. You can write Java and not use the factory pattern, you know.

Hell, Scala is one INSANELY complicated language. It's got about every feature under the sun. Java is simple and to the point...unless you really want to use spring or something of the sort.

Anyway, you've got a really contorted view of Java, and you are conflating some fundamental things.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by kamaal on Thursday October 10, 2013 @05:09AM (#6526461)
Community is a big part of the language. Else we would be writing in our self invented languages. You can write Java like anything you want, but that will make you an alien in a big world. Code reviewers won't accept your code for being the odd-one-out.

And its not about complexity or features in a tool, its about how those features interplay with the base design of the tool.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by Theriac25 on Thursday October 10, 2013 @02:46AM (#6526063)
Portability, memory safety, speed of compilation, retaining the sanity of developers.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by pron on Thursday October 10, 2013 @07:56AM (#6526920)
Concurrent data structures (hazard pointers don't perform as well as an implementation with a GC).
Re:If Java Is Dying, It Sure Looks Awfully Healthy by pron on Thursday October 10, 2013 @07:51AM (#6526897)
You seriously don't know what you're talking about.

Virtually all serious software that uses complex concurrent data structures is written in Java nowadays, because the JDK is pretty much the only runtime that supports state-of-the-art, envelope-pushing, concurrency.

Here's my previous discussion with haberman on the subject: https://news.ycombinator.com/item?id=6505853

Re:If Java Is Dying, It Sure Looks Awfully Healthy by codygman on Thursday October 10, 2013 @12:37PM (#6528603)
Re:If Java Is Dying, It Sure Looks Awfully Healthy by pron on Thursday October 10, 2013 @05:18PM (#6530103)
Erlang is awesome, but only offers high-level concurrency constructs (actually, just a couple), it does not support low level ones (CAS). You can't write, say, a good concurrent hash-map in Erlang. Or in Haskell, for that matter.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by codygman on Thursday October 10, 2013 @09:12PM (#6530972)
Unless I'm mistaken, this library provides CAS for haskell: http://hackage.haskell.org/package/bits-atomic

Though if you were only affirming that it isn't a language construct you are correct.

Re:If Java Is Dying, It Sure Looks Awfully Healthy by EdwardDiego on Thursday October 10, 2013 @12:28AM (#6525635)
> Java is a piece of crap when it comes to anything that's actually complex.

Define complex?

Re:If Java Is Dying, It Sure Looks Awfully Healthy by Zigurd on Thursday October 10, 2013 @09:36AM (#6527540)
I'd like to see any language withstand the combination of big project, lots of managers, mixed levels of experience and expertise on the team, and over-reliance on structure and methodology versus having the right people. It just happens that Java gets picked for those kinds of projects.
Re:If Java Is Dying, It Sure Looks Awfully Healthy by dinkumthinkum on Wednesday October 09, 2013 @07:20PM (#6524606)
Oh come on. To say it is the "obvious" choice is heavy editorializing. I agree it's not going anywhere. As others have pointed out there is a fine language called C++. In point of fact Java is not the obvious choice, that's bit much. There are some very good arguments of Java that may or may not be deal breakers but are still issues ... There must be a middle ground from the power of C that is not OOP gone awry. :)