The Java Flaw – Execution in the Kingdom of Nouns

I recently stumbled upon a rather old but very interesting article from Steve Yegge. It describes quite visually one of the problems I am constantly struggling with in Java. In Java Kingdom, the poor VERBS (methods) are second-class citizens. Every VERB needs to be attached to a NOUN (class), there is no notion of a free-floating VERB. For every simple sentence you want to formulate, you need to glue the VERB to some NOUN. Simple calculations like (x + 1) need to be packed into  a ValueIncreaser which maybe implements a IntegerToIntegerFunction, so that you can also use (x * 2) ValueDoubler as a second strategy. One problem here is the amount of boilerplate, which is outrageous for small functions and leads many developers to not sufficiently split and modularize their code. Another problem is that the same method might be defined in two different interfaces. E.g. every time you want to be able to switch between two third-party libraries which provide the same functionality, you need to create adapters which hide the the interfaces although the methods themselves possibly have the same signature. One might argue, that introducing functions as first-class breaks object orientation. On the other hand functions can just be anonymous classes implementing generic Function1Argument<TReturn, TArgument1> … Function3Arguments<TReturn, TArgument1, TArgument2, TArgument3>… I think this is how it is done in Scala, and will be in Java closures. Until we FINALLY get closures (probably in September 2010) I will go on bemoaning that Java is such a slow-moving language and Scala is not really ready for productive use because of the bad IDE support.


Martin is developing a bid management solution for crealytics. He is also a long-term meditator and interested in neuro-feedback.

    Find more about me on:
  • twitter