Happy 20th Birthday Java!
Thursday, May 21st, 2015Happy 20th Birthday Java! Next year I’ll buy you a drink. InfoWorld has published some of my thoughts on the occasion, “Java at 20: How it changed programming forever”.
Happy 20th Birthday Java! Next year I’ll buy you a drink. InfoWorld has published some of my thoughts on the occasion, “Java at 20: How it changed programming forever”.
java.util.Arrays
uses quicksort (actually dual pivot quicksort in the most recent version) for primitive types such as int
and mergesort for objects that implement Comparable
or use a Comparator
. Why the difference? Why not pick one and use it for all cases? Robert Sedgewick suggests that “the designer’s assessment of the idea that if a programmer’s using objects maybe space is not a critically important consideration and so the extra space used by mergesort maybe’s not a problem and if the programmer’s using primitive types maybe performance is the most important thing so we use the quicksort”, but I think there’s a much more obvious reason.
(more…)
In my day job I work with a lot of very smart developers who graduated from top university CS programs such as MIT, CMU, and Chicago. They cut their teeth on languages like Haskell, Scheme, and Lisp. They find functional programming to be a natural, intuitive, beautiful, and efficient style of programming. They’re only wrong about one of those.
(more…)
I hate 1% problems. No this isn’t an OWS slogan. I’m thinking of those code issues that really aren’t a problem 99% of the time, but when they bite, they’re really hard to debug and they cause real pain. Several common cases in Java:
java.util.Date
or java.util.Calendar
instead of JodaTime.Locale
when doing language sensitive operations such as toLowerCase()
and toUpperCase()
.What I hate most is that it’s really, really hard to convince other developers that these are problems they should take seriously. (more…)
Have you ever seen an Ant error message like this?
BUILD FAILED /Users/elharo/Projects/XOM/build.xml:545: Problem: failed to create task or type scp Cause: Could not load a dependent class com/jcraft/jsch/Logger It is not enough to have Ant's optional JARs you need the JAR files that the optional tasks depend upon. Ant's optional task dependencies are listed in the manual. Action: Determine what extra JAR files are needed, and place them in one of: -/opt/ant/lib -/Users/elharo/.ant/lib -a directory added on the command line with the -lib argument Do not panic, this is a common problem. The commonest cause is a missing JAR. This is not a bug; it is a configuration problem
As usual, the ant error message is completely unhelpful, though for once it’s at least technically correct. (Most of the time when ant says, “This is not a bug; it is a configuration problem”, it is in fact a bug and not a configuration problem.) Here’s what’s really happening.
(more…)