Why Java Sucks – Jonathan Gardner
Yes, java Sucks. But in many real and very important ways it sucks less than any of the alternatives. Especially considering the age of the language, and how backwards compatible it has been over the last 12 years.<p>Sure the eco system went all XML, but to be honest is the current JSON craze so much better? Yet this XML heritage is not something one must suffer through these days.<p>GC pauses, know your tools. Azul Vega was a thing in 2005 which means GC pauses are an option not a requirement. Of course there is the whole family of JavaRT as well and things like IBM metronome. If you have an big project burning engineering hours on Java GC they should look further afield. Sure most of these tools cost money. You think the extra hardware needed to run most of this stuff in Perl is cheap?<p>Considering where python and perl went in their 5-&gt;6 and 2-&gt;3 migrations even Java 1.4 to 1.5 was smooth. Heck even the annoying into of assert as a keyword in 1.4 was painless compared to those. I know of 2 projects that even with much more man power thrown at it have difficulty moving from Perl 5.8 to 5.12 and beyond. Gosh its like WebSphere migrations from 3 to 4 where unique in that regards, not...<p>Look I understand, we all hate that crap java code some consultants and solution experts wrote and that we need to deal with. But to be honest, equivalent consultants and solution experts with Perl, C, Python or JS don&#x27;t create any better solutions. In someways Java pays the price of it being practically so much better that these teams in their enterprise constrains actually get something out of the door. Unlike, many other teams. Crap that ships is much better than the stuff that never got anywhere.<p>The hasNext and next methods are very nice. Because the author assumes all calls to next must be consumed. Well that is not true, and then having hasNext return a boolean instead of an expensive object (e.g due to remote calls) allows for lots of nice optimisations. Throwing exceptions for normal results is a horror that is too common in Python, e.g. urllib2 and 302 redirects.<p>This actually is rant of someone who does not really seem to know better. Yes there are some good points in it regarding generic erasure. And it is a pain, but on the other hand it made the migration possible.<p>Hey if you don&#x27;t like longs and int casting rules just use BigInteger everywhere. Sure its slow, but so is the cpython and mri ruby implementations. 32bits is not the same as 64 and the Java Memory Model can be a rude awakening if you use longs where you should have used ints.<p>The camelCase thing, use an better tool ctrl-alt-R and its done consistently and correctly.<p>Things that would be nice too have in Java do exist. Getting Function etc.. in Java8 would have been great a decade ago. Rust borrow checking would be nice as well as a change in that locks operate (i.e. consuming a function that is called on the data) instead of the otherway round (i.e. like Perl6 locks)<p>The advice to use Vanilla C as an option. A language where the equivalent of following is undefined and can do anything? Including rm -rf!!! Sure no implementation calls rm -rf on undefined behaviour, except every hacker coming in via a memory corruption bug. A class of bugs that is not present in other languages, and why it should not be your first port of call in the normal circumstances.<p><pre><code>  public class WhyIsThisUndefinedInC {
    int[] a = new int[]{Integer.MAX_VALUE};
    public test()
    {
       new Thread(()-&gt;(a[0]++).start();
       new Thread(()-&gt;(a[0]++).start();
       System.out.println(a);
    }
  }
</code></pre>
In any well defined language you can have 3 outcomes, considering the total lack of locking etc... C gives you infinite!
Heck moving a small C code base to a new compiler&#x2F;libc combo is a massive undertaking in technical debt reduction.
Any of the other languages, except haskel lack a memory model that is sane and useable (or any at all). When you can easily have 144 cores in single box that is not a great place to be in!<p>Sure we all hate Oracle, and their Sales teams. But on the other hand most of the time the customers deserve the sales team. Oh yeah I know its dirty to actually make money on Software it needs to be sponsored by privacy invading ad companies, or written by PostDocs with a lack of job stability. The JVM is solid, and WORA is true for certified Java TCK passing implementations. Android is not one of those.