7 ms·
No. It has a flawed concurrency model. Heap objects have too much overhead. Poor support for functional programming. Not open source. Except for a major redesi
by tomp 15y ago
No. It has a flawed concurrency model. Heap objects have too much overhead. Poor support for functional programming. Not open source.
Except for a major redesign of the JVM (is that still Java?), it's a dying/stagnating platform.
- devs1010 15y agoThe JVM is written in C, if thats what you mean by "is that still Java". I agree Java has its weak spots but I still feel it has its places (maybe I'm a bit biased as I do a lot of Java dev), the whole JSP, Java full web stack is pretty awful, I definitely agree with critics who say things along these lines, but for writing code that isn't just CRUD and actually does computations, uses complex data structures, etc I don't think any dynamic language would be replacing this anytime soon. (are people really writing large scale search engines in Ruby or Python, etc?) I prefer Java to C# as I develop on Linux and have never been into the whole Microsoft scene, so I think its a good alternative to the .Net world. I think the future of Java on the web is mainly for powering API's, whether internal or public, while other languages continue to take over anything relating to the front-end. With java, you have tons of libraries for doing complex computing, the ones that come to mind first for me are search oriented ones like Apache Lucene / Solr as well as NLP libs, etc... Java no longer needs to try to be the "end all" solution, but are there other platforms that have the wealth of libraries for working with big data? (honestly am a bit curious about this)
- tomp 15y ago> The JVM is written in C, if thats what you mean by "is that still Java". No, I mean that if you completely redesign the JVM, you might as well invent a new language/VM without all the crap that comes from backwards compatibility (e.g. type erasure for generics, value types, ...). I agree that dynamic languages won't replace Java, and C/C++ can't compete for business applications either, but I'm betting on a new language that combines the benefits of static&dynamic, object&functional programming. C# would be a powerful contender, if it were truly cross-platform. Legacy code is a big "problem", however, all these projects already have language/platform neutral API (e.g. Thrift interfaces), so integrating them into new environments will be much easier than it was in the past.
- soc88 15y ago> ... I'm betting on a new language that combines the benefits of static&dynamic, object&functional programming Like Scala? Already 8 years old.
- devs1010 15y agoI think this will happen eventually as well, however it still feels far off, I definitely get frustrated with Java's lack of functional programming, I just think its so well rooted now in so many organizations it will be a while until a new platform can really take over.. I haven't really looked at Scala but plan to, the problem is, there just aren't many companies using it and unless you're starting your own, it feels like you have to keep your experience in line with what companies are using
- pagekalisedown 15y agoYou don't think they can fix all that between now and 2021? http://news.ycombinator.com/item?id=3775400 http://news.ycombinator.com/item?id=3775400
- brownbat 15y agoAgreed. Also, Java (or just the JRE?) is a security nightmare.
- brownbat 15y ago1) http://krebsonsecurity.com/2010/10/microsoft-a-tidal-wave-of-java-exploitation/ http://krebsonsecurity.com/2010/10/microsoft-a-tidal-wave-of... 2) http://news.cnet.com/8301-13579_3-57410476-37/apples-security-code-of-silence-a-big-problem/ http://news.cnet.com/8301-13579_3-57410476-37/apples-securit... 3) http://krebsonsecurity.com/2012/03/new-java-attack-rolled-into-exploit-packs/ http://krebsonsecurity.com/2012/03/new-java-attack-rolled-in... Oracle has been irresponsible if not reckless on the security front; between them and Adobe, you have the source for most of the malware attacks out there. If a company sold locks to everyone in America, and failed to notice that their locks accepted any key, I'd like to think they'd be held accountable in some way for the ensuing wave of burglaries. I know, security isn't trivial. But if you're deploying software this widely, you have a duty to the public to hire yourself a security aware dev team and make half an effort.
- moondowner 15y ago> Poor support for functional programming. Not open source. For the concurrency model and heap I'm not competent enough to debate, but for the other stuff you say I can't agree. For functional programming in Java there are a lot of ways of doing it and tutorials as well, starting from those on DeveloperWorks https://www.ibm.com/developerworks/java/library/j-fp/index.html https://www.ibm.com/developerworks/java/library/j-fp/index.h... and OpenJDK shows that it is OpenSource indeed. For example, JBoss (Red Hat's division) uses OpenJDK. And I don't get the point of redesigning the JVM? What's wrong with it now? Is it's architecture somewhat wrong? Please elaborate..
- tomp 15y ago> > Poor support for functional programming. Let me elaborate. There are no tail calls. The GC is not suited to functional programs (lots of small, short-lived allocations) (though that has been improving recently). No first class functions (you have to make an object with a method instead). I might be wrong, but that's a significant overhead.
- drstrangevibes 15y agothese are scheduled to be addressed in java 8 & 9
- soc88 15y ago> The GC is not suited to functional programs (lots of small, short-lived allocations) WUT? That's _exactly_ the thing the GC is good at, and it's that way not since yesterday. The limiting factor is the speed of allocation (no GC involved), not GC.
- tomp 15y agoThe design of the GC can limit the speed of allocation as well. If your VM has a copying (moving) GC for the young generation, allocating a new object is exactly two very fast machine instructions: add to the current top of young heap, and check for overflow. That's how OCaml does it. I'm not sure how to do it concurrency-safe, though. Maybe using small per-thread heaps that get collected whenever an object is shared between threads, or by statically inferring which objects can be shared and which are thread-local.
- smanek 15y agoI think Java is a pretty bad language, but most of your points are provably wrong. You're either grossly misinformed (some of what you say was true about a decade ago, but hasn't been since around the 1.5 release in ~'04) or purposefully spreading lies. You're factually wrong about the open-source thing: the primary impl of Java is open source (http://hg.openjdk.java.net/jdk7u/jdk7u http://hg.openjdk.java.net/jdk7u/jdk7u). Sure, some impls like Azul might not be - but that's the joy of an Open language with a real spec, anyone can write an impl under any license they choose. The claim that Objects have 'too much' overhead is subjective - but also basically wrong. Generally Objects in Java have 8 bytes of straight book-keeping overhead, plus padding to get the size of the fields to the nearest multiple of 8 bytes. That's expensive relative to C, but cheap compared to almost any other object oriented, GCd language (and can often be avoided via primitives, escape analysis, etc). For reference, CPython (the main Python impl) has ~30 bytes of overhead on an Int between tag bits, book keeping, etc last time I investigated. How do you think the Java concurrency model is flawed? Almost any concurrency model I can think of, from Erlang-style message passing (see: Akka) to the new Fork/Join framework can be implemented in Java since its concurrency primitives are complete. I've even done basic impls of STM on AtomicRefs. Frankly, Java has one of the better defined and fine-grained concurrency models I know of. C++ just got a well-defined memory model in the '11 standard IIRC (vs '04 for the JVM). I'm with you on the functional programming thing - syntax on anonymous inner classes and a lack of type inference make it way too verbose. But it's (largely) fixed via Project Lambda in Java 8. And, in the meantime, there are plenty of great JVM languages (Scala, Clojure, etc) with better support.
- tomp 15y agoHm... I'm not trying to argue with you, you're right that I only have a superficial overview of the Java/JVM/J2EE ecosystem, but I will try to elaborate on the points of my original post, which was rather sparse, I admit. As I read Wikipedia, HotSpot is opensource. I'm not sure if that includes the best JIT compiler (what the JVM is known for) as well, or if that's still closed/proprietary, but I'd be pleasantly surprised if it's open source as well. Still, we have the patents issue, i.e. the current legal battle between Google and Oracle. Releasing the source but suing anyone who uses it is not the way to do open source, IMGO (true, the source was release by Sun, and Oracle is the one who's suing, but still). I believe that a general purpose programming language (suitable for business applications) has to be able to perform as well as C for heavily optimized code. What I mean is that you have to be able to write algorithms that run very fast. You can probably do that with C# (supports unboxed structs) and maybe even Objective-C (supports MemoryPools, and method lookup caching), but not Java (AFAIK). Sure, you can always link to external C libraries, but then you have to face dependency hell and portability issues. The issue that I see with Java's concurrency model is not that it is not powerful enough, but that it is too powerful. It allows synchronization on any heap-allocated object, which probably has a lot of overhead (used to be performance overhead, but HotSpot was heavily optimized for that, so after a lot of programmer-hours overhead, the performance overhead was lowered). However, I think that this kind of threading model is not scalable to massively parallel/distributed environments. Synchronization/sharing will have to be limited, e.g. as in Erlang/WebWorkers/Rust, using GCD in Objective-C, using MVar (Haskell) or transactional variables (Clojure). Java probably can never do that, without sacrificing backwards compatibility. Lack of support for functional programming was meant more on the JVM level. There are no tail calls, no fast object allocation, no true polymorphism, and I'm guessing that since closures have to be represented as objects, they are not particularly cheap.