Saturday, August 12, 2006

Yegge's Kingdom of Nouns

{

I'm late to the party once again; I discovered Steve Yegge just recently and ran across his essay "Execution in the Kingdom of Noungs." Yegge is a great writer and I can see why the essay recieved a lot of attention. Yegge basically asserts that Java is a kingdom of nouns; a language which focuses on things (objects) which he parallels as "nouns" over actions which he parallels as "verbs." This leads to a lot of verbose monstrositities in code and is, in his opinion, a bad thing compared to languages where verbs are parallel or even more first class than nouns - from which we get references to functional languages and the nirvana of LISP.

I remember learning java many years ago coming from the black sheep of all programming languages, Visual Basic. When I got to programming user interfaces with AWT and SWING, I remember being mesmerized by the sheer weight of it. In Visual Basic, one would double click on a button and the tool would create an event procedure that looked like this:

Sub MyButton_Click()
'code here
End Sub

I made the assumption that the tool was abstracting details away for me, but it was simple, intuitive, and effective.

In Java, I learned that to write an event handler I needed to implement an interface with a different class or override a method from an anonymous instance of a class that implemented the event handling interface. At first it seemed cool to throw all the terms around: "listener interface, anonymous instance... " but I had trouble stitching it all together cohesively by hand. It's been a while but I remember liking the idea of keeping a separate class to do my event handling rather than using an anonymous one but running into the trickiness of making references to data in the UI class where the event was being triggered.

I thought this was just a matter of tools; if I got the right IDE I would be able to nail the issue. But the IDEs I used tended to do things differently; I'm digging into memory here but I remember liking Borland's JBuilder for development and disliking how it used Borland helper classes for event handling to try to clean things up.

I think Yegge could have driven his point home about nouns if he'd focused entirely on event handling. To handle an event you need to know about two nouns: the listener interface and the class that implements that interface for you wherein you are given an opportunity to write your code.

I remember getting finally to go to training in Java (after I'd taught myself most of what I'd eventually know) and asking about that. People looked at me with the condescending "complexity is cool" look that usually sends Visual Basic programmers back to their environments to be productive.

And I can see some niceties of the extra nouns in Java. Building even more layers of abstraction is easier (e.g. handling many events with the same class implementing the listener interface) -

It's been a long time but I may be returning to the Java world; I made need to get Java certification for academic reasons. It will be interesting to study the language again with these thoughts in mind.

}

No comments: