Hacker News new | ask | show | jobs
by qu4z-2 4878 days ago
I believe the Java equivalent is something like

  passableF = new NotAClosure() {
    public void execute(int i) {
      return f(i);
    }
  }
But maybe someone knows better than me. I've had thankfully little to do with Java recently.

EDIT: Which I guess defeats the purpose of "without an object", but...

1 comments

Just to note, I am in no way claiming Java is superior. Java is inferior in ways I think are not the ones Yegge claims.

For me, these are the things Java sucks at.

1) There is no easy way to create lists or maps. Look at python; how easy it is to create a dictionary. In Java, you have to "write code" to put elements in a map.

2) Reflection is very weak. It is not type checked at compile time. You have to write a lot of garbage just to run the show.

3) The getters/setters are a hell. Not to write them mind you, but the amount of cruft that creeps in, that you have to filter out to get to the heart of the problem during reading.

4) The constructors: A a = new A() (wtf....)

5) piss-poor Generics.

6) File Operations are pure crap.

7) One class per file? Omg.. For a long time, I thought i sucked at OOPS. The single biggest reason it took me long to get acquainted with OOPS is because of one class per file. Any other class is a new file, a context switch in my mind. In Java, Objects are first class entities; it should be cheap(in terms of things i need to look at) to define, create, and switch between them.

Finally, I think Java sucks because of its verbosity. And a subliminal style that it supports. There are a lot of programmers in Java who think the best way of multiplying two numbers is to add one of them other number of times . Somehow, everything should be drawn out.

My "favourite" thing about the One Class Per File thing is that (certainly when I last used it) javac would refuse to compile the class file unless it was in a directory tree identical to its namespace, and you fully specified that on the command-line.

  # Worked
  javac org/eclipse/something/SomeClass.java

  # Failed
  cd org/eclipse/something/ && javac SomeClass.java
Yep, unacceptable dude! How dare you exhibit common sense? :)
For all of its warts, Groovy really makes much of this more tolerable in an environment that readily interoperates (call either way in/out) with legacy Java code.

Java file handling with dozens of classes still seems a horrific solution, like you said. I don't miss having to constantly check return codes and "errno", vs getting IOException, but I do miss the simplicity some days of "FILE *" and fopen()/popen(). (I also don't miss maintaining code that FAILS to check error codes while doing I/O)

Thanks for your replies, by the way. Thoughtful without being combative.

> For all of its warts, Groovy really makes much of this more tolerable in an environment that readily interoperates (call either way in/out) with legacy Java code.

5 yrs ago Groovy had the best interop with Java, and its promoters said so often, but things have changed a lot since then. Perhaps now you'll find another language has all the interop you need but without those warts.

He hee. I'm glad you think so.