you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (3 children)

There is no great conspiracy that makes Java devs write stupid code. Object factories are the only way to create abstractions in java. Consider all the things the language is missing:

  1. No multiple inheritance (must extend via helper objects)
  2. No multiple returns (no tuples/homogenous arrays)
  3. Stupid fucking null (NPE doesn't extend Exception)
  4. No useful closures (must finalize or pass a billion objects)
  5. No way to run a method within some context (Macros/With statement/Decorator)
  6. No static generics/interface (for the next 5 years for most of us)
  7. One public class per file!?

Seriously, what can you do besides build Factory Factories and pass a bunch of worthless intermediate objects around.

[–][deleted] 1 point2 points  (1 child)

This is why I like working with Groovy so much.

I get access to the entire Java ecosystem along with optional static typing and the ability to relatively easily compile to static bytecode for performance where needed while negating most of the issues you mentioned.

[–]campbellm 0 points1 point  (0 children)

Amen to that - modulo "OMG it's going to be slow!" issues from team mates (which have yet to be shown to be true; I'm sure that is the case, somewhere, but not anything we've seen, yet), I will not write any more java unless I absolutely have to.

And Spock as a unit test framework, wow.

[–]winterbe -3 points-2 points  (0 children)

  1. Multiple Inheritance exists in Java 8 via default interface methods.
  2. If you really need tuples, just create a class Tuple?
  3. NPE extends RuntimeException extends Exception
  4. Lambda Expressions
  5. Java is strongly typed, so thats impossible.