Opinions
10 Sep 2016
All opinions here are subject to change. Some of the most fun I've had as a developer has been changing my mind.
A few of Java's Pain Points:
- Why are bytes signed? Shouldn't 11111111 / FF be 255 and not -1?
- In fact, why is there a lack of unsigned types to begin with?
- Is it good that OOP is the favored paradigm in Java? In retrospect, does that decision seem inflexible?
- Why does Java lack multiline string literals? How does this affect embedding long strings like SQL statements?
- How does Java deal with the fact that both inheritance and threads break encapsulation?
- What does Java's age tell us about its decision to store strings as utf-16, little endian? Java's char type cannot fit Unicode's higher code points, so either surrogate pairs are used, or int gets used for larger code points. What encoding might Java choose today if it could start fresh?
- Java has a large presence on the web, and, today, that means the cloud. What does it mean that Java does not compile down to a single binary for easy deployment? Even setting aside for a moment deploying .war files to a Servlet container, what does it mean to require a JVM on every machine in a cloud that Java applications are deployed to? In a world where a few computer architectures have "won" (Intel/Arm), should Java compile to platform-specific binaries to ease deployment?
- Java the language could be used in a reasonably lightweight way, but why does it seem to attract architecture astronauts and heavyweight frameworks?
- Why is Java so verbose, even in later versions? When a programming language seems to require an IDE rather than just benefit from and IDE, is that good?
- What are the pros and cons of Java's backward compatibility? Is its standard library rich and multifaceted, or does it have too many ways of doing the same thing, without enough guidance on which ways of doing things are most modern, and which have been deprecated?
- The JVM's word size may not always match the underlying CPU's word size
- No support of primitives in generics except via memory- and CPU- intensive boxing and unboxing
Donald Knuth says "Premature optimization is the root of all evil." After reading 20 years' worth of enterprise Java, I often wonder if this dictum is truer: "Premature abstraction is the root of all evil."
A Few Choice Quotes:
"Duplication is better than the wrong abstraction." --Sandi Metz