Nov 25

Ok, here’s the first post in this series. I’m going to take a critical look at the languages I use the most (or am learning) and try to find 10 things that drive me crazy about them. This doesn’t necessarily mean that I hate the language itself, these are just a few things that might drive me crazy.

  1. UI - Doing UI development in Java sucks. Layout management is horrendous. You get the joy of laying something out and then being nice and surprised at the results when you run it. Much like the proverbial box of chocolate, you never know what you are going to get. You have two crappy choices, AWT and Swing. AWT sucks worse than Swing. Good luck.
  2. Bloat - Java has gotten HUGE. What better way to gauge it’s unmitigated bloat than to take a look at the page count of the venerable Nutshell books.2nd Edition (couldn’t find 1st) 628 - 5th Edition (latest) 1254 pages! I know, stupid measurement, but it is fairly accurate. Java continues releasing revisions, but does not remove cruft for fear of ruining backwards compatibility. So, as a result we have multiple ways to handle XML parsing, Concurrency, UI development, and more. Sometimes, backwards compatibility isn’t worth the cost.
  3. Primitives and Objects - int/Integer, float/Float, double/Double, etc. Why support both? This is an unneeded complication, in my mind. This leads to “autoboxing” to solve the issue of making int == Integer, which then has its own problems. Pick one and stick with it.
  4. Generics - I don’t have as big a problem as most with Generics. However, I do hate that it will no accept a primitive, requiring objects. Therefore, I can’t have a List of int primitives. Instead, it’s Integer objects. Treating them like primitives brings “autoboxing” into the fold and creates another level of complication with NPE checks, etc. Again, if they wouldn’t have done (3), this wouldn’t have been a headache.
  5. Switches - Now the reverse of Generics. Switches only switch on primitives, I can’t switch on an Object using its built in .equals method. Why?
  6. Classpath Mechanism – The complication of classpath management had made it virtually impossible to run a non-trivial application by hand. Have you seen the classpath’s of a production application? God help you if you just need to start it on a Terminal.
  7. Runtime and System – Seriously, can anyone ever remember what feature lives where? Why are these two separate classes? I have to pull out a damn reference manual every time.
  8. Preferring Verbosity Over Ease - I know, I know, there are a lot of reasons to not support operator overloading in Java, but there are times I would love a little conciseness.
  9. Strong Conventions Should Be at Compiler - Yeah, this one is going to sound stupid, but it’s something I think the language should have. Sun is adamant about using a strong coding convention. And people are very good at following it. It’s one of Java’s biggest strengths. I can download any Java API and easily read it, because the code is going to look like all other Java APIs. This is powerful. Enforce it! If you don’t following convention, have the compiler catch it. I’d prefer an error, but a warning would work.
  10. instanceof and Casting - Lastly, if I have a block of code that checks instanceof, why are you making me cast in that block’s scope? Be smart! I just made sure it’s the right type, don’t make me create a cast.

And that’s it. 10 things. That felt good to get off my shoulders. I love you Java, we good, right?

Comments are closed.

preload preload preload